XGProyect / XG-Proyect-v3.x.x

XG Proyect is an OGame clone open-source web application framework designed for creating game clones, particularly those inspired by the popular game OGame, set in a vast and captivating space-themed universe.
https://xgproyect.org
GNU General Public License v3.0
144 stars 97 forks source link

[Mejora Futura] Recursos extendidos en overlib igual que ogame #274

Open jonamix-ar opened 4 years ago

jonamix-ar commented 4 years ago

Esto seria como el tooltip de ogame pero echo con el overlib esto

Quedaria asi asi

TEMPLATE LIB

$metal = FormatLib::prettyNumber($this->current_planet['planet_metal']);
$crystal = FormatLib::prettyNumber($this->current_planet['planet_crystal']);
$deuterium = FormatLib::prettyNumber($this->current_planet['planet_deuterium']);
$darkmatter = FormatLib::prettyNumber($this->current_user['premium_dark_matter']);
$energy = FormatLib::prettyNumber(
    $this->current_planet['planet_energy_max'] + $this->current_planet['planet_energy_used']
);
$energy_consumption = FormatLib::prettyNumber($this->current_planet['planet_energy_used']);

$metal_available = FormatLib::prettyNumber($this->current_planet['planet_metal']);
$crystal_available = FormatLib::prettyNumber($this->current_planet['planet_crystal']);
$deuterium_available = FormatLib::prettyNumber($this->current_planet['planet_deuterium']);
$energy_available = FormatLib::prettyNumber(
            $this->current_planet['planet_energy_max'] + $this->current_planet['planet_energy_used']
);

$metal_max = FormatLib::prettyNumber($this->current_planet['planet_metal_max']);
$crystal_max = FormatLib::prettyNumber($this->current_planet['planet_crystal_max']);
$deuterium_max = FormatLib::prettyNumber($this->current_planet['planet_deuterium_max']);

$geologe_boost = 1 + ( 1 * ( OfficiersLib::isOfficierActive($this->current_user['premium_officier_geologist']) ? GEOLOGUE : 0 ) );
$engineer_boost = 1 + ( 1 * ( OfficiersLib::isOfficierActive($this->current_user['premium_officier_engineer']) ? ENGINEER_ENERGY : 0 ) );

$production_level = $this->prod_level($this->current_planet['planet_energy_used'], $this->current_planet['planet_energy_max']);
$metal_prod = '+' . FormatLib::prettyNumber(floor((($this->current_planet['planet_metal_perhour'] * 0.01 * $production_level) + FunctionsLib::readConfig('metal_basic_income'))));
$crystal_prod = '+' . FormatLib::prettyNumber(floor((($this->current_planet['planet_crystal_perhour'] * 0.01 * $production_level) + FunctionsLib::readConfig('crystal_basic_income'))));
$deuterium_prod = '+' . FormatLib::prettyNumber(floor((($this->current_planet['planet_deuterium_perhour'] * 0.01 * $production_level) + FunctionsLib::readConfig('deuterium_basic_income'))));
$energy_prod = '+' . FormatLib::prettyNumber(floor(($this->current_planet['planet_energy_max'] + FunctionsLib::readConfig('energy_basic_income')) + $this->current_planet['planet_energy_used']));

$commander = OfficiersLib::isOfficierActive($this->current_user['premium_officier_commander']) ? '' : '_un';
$admiral = OfficiersLib::isOfficierActive($this->current_user['premium_officier_admiral']) ? '' : '_un';
$engineer = OfficiersLib::isOfficierActive($this->current_user['premium_officier_engineer']) ? '' : '_un';
$geologist = OfficiersLib::isOfficierActive($this->current_user['premium_officier_geologist']) ? '' : '_un';
$technocrat = OfficiersLib::isOfficierActive($this->current_user['premium_officier_technocrat']) ? '' : '_un';

if (($this->current_planet['planet_metal'] >= $this->current_planet['planet_metal_max'])) {

            $metal = FormatLib::colorRed($metal);
}

if (($this->current_planet['planet_crystal'] >= $this->current_planet['planet_crystal_max'])) {

      $crystal = FormatLib::colorRed($crystal);
}

if (($this->current_planet['planet_deuterium'] >= $this->current_planet['planet_deuterium_max'])) {

            $deuterium = FormatLib::colorRed($deuterium);
}

if (($this->current_planet['planet_energy_max'] + $this->current_planet['planet_energy_used']) < 0) {

            $energy = FormatLib::colorRed($energy);
}
$parse['metal'] = $metal;
$parse['metal_available'] = $metal_available;
$parse['metal_production'] = $metal_prod;
$parse['metal_max'] = $metal_max;
$parse['crystal'] = $crystal;
$parse['crystal_available'] = $crystal_available;
$parse['crystal_production'] = $crystal_prod;
$parse['crystal_max'] = $crystal_max;
$parse['deuterium'] = $deuterium;
$parse['deuterium_available'] = $deuterium_available;
$parse['deuterium_production'] = $deuterium_prod;
$parse['deuterium_max'] = $deuterium_max;
$parse['darkmatter'] = $darkmatter;
$parse['energy'] = $energy;
$parse['energy_available'] = $energy_available;
$parse['energy_production'] = $energy_prod;
$parse['energy_consumption'] = $energy_consumption;
$parse['img_commander'] = $commander;
$parse['img_admiral'] = $admiral;
$parse['img_engineer'] = $engineer;
$parse['img_geologist'] = $geologist;
$parse['img_technocrat'] = $technocrat;

        return $this->parseTemplate($this->getTemplate('general/topnav'), $parse);
}

private function prod_level($energy_used, $energy_max) { if ($energy_max == 0 && $energy_used > 0) { $prod_level = 0; } elseif ($energy_max > 0 && abs($energy_used) > $energy_max) { $prod_level = floor(( $energy_max ) / ( $energy_used -1 ) 100); } elseif ($energy_max == 0 && abs($energy_used) > $energy_max) { $prod_level = 0; } else { $prod_level = 100; }

    if ($prod_level > 100) {
        $prod_level = 100;
    }

    return $prod_level;

}


**TOPNAV_VIEW**
{metal} {crystal} {deuterium} {darkmatter} {energy}

**ENGLISH INGAME**

// TOPVNAV 'tn_available' => 'Available', 'tn_storage_capacity' => 'Storage capacity', 'tn_current_production' => 'Current production', 'tn_den_capacity' => 'Den Capacity', 'tn_consumption' => 'Consumption', 'tn_purchased' => 'Purchased', 'tn_found' => 'Found',


**SPANISH INGAME**

// TOPVNAV 'tn_available' => 'Disponible', 'tn_storage_capacity' => 'Capacidad de almacenamiento', 'tn_current_production' => 'Producción actual', 'tn_den_capacity' => 'Capacidad de camuflaje', 'tn_consumption' => 'Uso', 'tn_purchased' => 'Comprada', 'tn_found' => 'Encontrada',



**OGAME IMG RESOURCES**
![crystal](https://user-images.githubusercontent.com/2124810/67912295-45ef6c00-fb68-11e9-8a52-ace8a216ae61.png)
![deuterium](https://user-images.githubusercontent.com/2124810/67912296-46880280-fb68-11e9-8388-3fc2a60ba623.png)
![energy](https://user-images.githubusercontent.com/2124810/67912297-46880280-fb68-11e9-8287-6e9636602f70.png)
![metal](https://user-images.githubusercontent.com/2124810/67912298-46880280-fb68-11e9-8957-ee63eff14197.png)
![ressourcen_DM](https://user-images.githubusercontent.com/2124810/67912300-47209900-fb68-11e9-86c4-aef57d1d64c5.gif)
fr0st87 commented 10 months ago

Exactamente en que parte de TemplateLib va esto:

`$metal = FormatLib::prettyNumber($this->current_planet['planet_metal']); $crystal = FormatLib::prettyNumber($this->current_planet['planet_crystal']); $deuterium = FormatLib::prettyNumber($this->current_planet['planet_deuterium']); $darkmatter = FormatLib::prettyNumber($this->current_user['premium_dark_matter']); $energy = FormatLib::prettyNumber( $this->current_planet['planet_energy_max'] + $this->current_planet['planet_energy_used'] ); $energy_consumption = FormatLib::prettyNumber($this->current_planet['planet_energy_used']);

$metal_available = FormatLib::prettyNumber($this->current_planet['planet_metal']); $crystal_available = FormatLib::prettyNumber($this->current_planet['planet_crystal']); $deuterium_available = FormatLib::prettyNumber($this->current_planet['planet_deuterium']); $energy_available = FormatLib::prettyNumber( $this->current_planet['planet_energy_max'] + $this->current_planet['planet_energy_used'] );

$metal_max = FormatLib::prettyNumber($this->current_planet['planet_metal_max']); $crystal_max = FormatLib::prettyNumber($this->current_planet['planet_crystal_max']); $deuterium_max = FormatLib::prettyNumber($this->current_planet['planet_deuterium_max']);

$geologe_boost = 1 + ( 1 ( OfficiersLib::isOfficierActive($this->current_user['premium_officier_geologist']) ? GEOLOGUE : 0 ) ); $engineer_boost = 1 + ( 1 ( OfficiersLib::isOfficierActive($this->current_user['premium_officier_engineer']) ? ENGINEER_ENERGY : 0 ) );

$production_level = $this->prod_level($this->current_planet['planet_energy_used'], $this->current_planet['planet_energy_max']); $metal_prod = '+' . FormatLib::prettyNumber(floor((($this->current_planet['planet_metal_perhour'] 0.01 $production_level) + FunctionsLib::readConfig('metal_basic_income')))); $crystal_prod = '+' . FormatLib::prettyNumber(floor((($this->current_planet['planet_crystal_perhour'] 0.01 $production_level) + FunctionsLib::readConfig('crystal_basic_income')))); $deuterium_prod = '+' . FormatLib::prettyNumber(floor((($this->current_planet['planet_deuterium_perhour'] 0.01 $production_level) + FunctionsLib::readConfig('deuterium_basic_income')))); $energy_prod = '+' . FormatLib::prettyNumber(floor(($this->current_planet['planet_energy_max'] + FunctionsLib::readConfig('energy_basic_income')) + $this->current_planet['planet_energy_used']));

$commander = OfficiersLib::isOfficierActive($this->current_user['premium_officier_commander']) ? '' : '_un'; $admiral = OfficiersLib::isOfficierActive($this->current_user['premium_officier_admiral']) ? '' : '_un'; $engineer = OfficiersLib::isOfficierActive($this->current_user['premium_officier_engineer']) ? '' : '_un'; $geologist = OfficiersLib::isOfficierActive($this->current_user['premium_officier_geologist']) ? '' : '_un'; $technocrat = OfficiersLib::isOfficierActive($this->current_user['premium_officier_technocrat']) ? '' : '_un';

if (($this->current_planet['planet_metal'] >= $this->current_planet['planet_metal_max'])) {

        $metal = FormatLib::colorRed($metal);

}

if (($this->current_planet['planet_crystal'] >= $this->current_planet['planet_crystal_max'])) {

  $crystal = FormatLib::colorRed($crystal);

}

if (($this->current_planet['planet_deuterium'] >= $this->current_planet['planet_deuterium_max'])) {

        $deuterium = FormatLib::colorRed($deuterium);

}

if (($this->current_planet['planet_energy_max'] + $this->current_planet['planet_energy_used']) < 0) {

        $energy = FormatLib::colorRed($energy);

} $parse['metal'] = $metal; $parse['metal_available'] = $metal_available; $parse['metal_production'] = $metal_prod; $parse['metal_max'] = $metal_max; $parse['crystal'] = $crystal; $parse['crystal_available'] = $crystal_available; $parse['crystal_production'] = $crystal_prod; $parse['crystal_max'] = $crystal_max; $parse['deuterium'] = $deuterium; $parse['deuterium_available'] = $deuterium_available; $parse['deuterium_production'] = $deuterium_prod; $parse['deuterium_max'] = $deuterium_max; $parse['darkmatter'] = $darkmatter; $parse['energy'] = $energy; $parse['energy_available'] = $energy_available; $parse['energy_production'] = $energy_prod; $parse['energy_consumption'] = $energy_consumption; $parse['img_commander'] = $commander; $parse['img_admiral'] = $admiral; $parse['img_engineer'] = $engineer; $parse['img_geologist'] = $geologist; $parse['img_technocrat'] = $technocrat;

    return $this->parseTemplate($this->getTemplate('general/topnav'), $parse);

}

private function prod_level($energy_used, $energy_max) { if ($energy_max == 0 && $energy_used > 0) { $prod_level = 0; } elseif ($energy_max > 0 && abs($energy_used) > $energy_max) { $prod_level = floor(( $energy_max ) / ( $energy_used -1 ) 100); } elseif ($energy_max == 0 && abs($energy_used) > $energy_max) { $prod_level = 0; } else { $prod_level = 100; }

if ($prod_level > 100) {
    $prod_level = 100;
}

return $prod_level;

}`