XG-Proyect-v3.x.x
XG-Proyect-v3.x.x copied to clipboard
[Mejora Futura] Recursos extendidos en overlib igual que ogame
Esto seria como el tooltip de ogame pero echo con el overlib
Quedaria 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**
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;
}`