XG-Proyect-v3.x.x icon indicating copy to clipboard operation
XG-Proyect-v3.x.x copied to clipboard

[Mejora Futura] Recursos extendidos en overlib igual que ogame

Open jonamix-ar opened this issue 5 years ago • 1 comments

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**
                    <tr class='header'>
                        <td align="center" width="85" class='header'>
                            <img src="{dpath}resources/metal.png" width="48" height="32" onmouseover="return overlib('<table width=250><tr><td colspan=2 class=c align=center>{Metal}</td></tr><tr><th>{tn_available}:</th><th><span>{metal_available}</span></th></tr><tr><th>{tn_storage_capacity}:</th><th><span>{metal_max}</span></th></tr><tr><th>{tn_current_production}:</th><th><span>{metal_production}</span></th></tr><tr><th>{tn_den_capacity}:</th><th><span>0</span></th></tr></table>', CENTER, WIDTH, 200);" onmouseout="return nd();">
                        </td>

                        <td align="center" width="85" class='header'>
                            <img src="{dpath}resources/crystal.png" width="48" height="32" onmouseover="return overlib('<table width=210><tr><td colspan=2 class=c align=center>{Crystal}</td></tr><tr><th>{tn_available}:</th><th><span>{crystal_available}</span></th></tr><tr><th>{tn_storage_capacity}:</th><th><span>{crystal_max}</span></th></tr><tr><th>{tn_current_production}:</th><th><span>{crystal_production}</span></th></tr><tr><th>{tn_den_capacity}:</th><th><span>0</span></th></tr></table>', CENTER, WIDTH, 200);" onmouseout="return nd();">
                        </td>

                        <td align="center" width="85" class='header'>
                            <img src="{dpath}resources/deuterium.png" width="48" height="32" onmouseover="return overlib('<table width=210><tr><td colspan=2 class=c align=center>{Deuterium}</td></tr><tr><th>{tn_available}:</th><th><span>{deuterium_available}</span></th></tr><tr><th>{tn_storage_capacity}:</th><th><span>{deuterium_max}</span></th></tr><tr><th>{tn_current_production}:</th><th><span>{deuterium_production}</span></th></tr><tr><th>{tn_den_capacity}:</th><th><span>0</span></th></tr></table>', CENTER, WIDTH, 200);" onmouseout="return nd();">
                        </td>

                        <td align="center" width="85" class='header'>
                            <img src="{dpath}resources/ressourcen_DM.gif" width="48" height="32" onmouseover="return overlib('<table width=210><tr><td colspan=2 class=c align=center>{Darkmatter}</td></tr><tr><th>{tn_available}:</th><th><span>{darkmatter}</span></th></tr><tr><th>{tn_purchased}:</th><th><span>0</span></th></tr><tr><th>{tn_found}:</th><th><span>0</span></th></tr></table>', CENTER, WIDTH, 150);" onmouseout="return nd();">
                        </td>

                        <td align="center" width="85" class='header'>
                            <img src="{dpath}resources/energy.png" width="48" height="32" onmouseover="return overlib('<table width=190><tr><td colspan=2 class=c align=center>{Energy}</td></tr><tr><th>{tn_available}:</th><th><span>{energy_available}</span></th></tr><tr><th>{tn_current_production}:</th><th><span>{energy_production}</span></th></tr><tr><th>{tn_consumption}:</th><th><span>{energy_consumption}</span></th></tr></table>', CENTER, WIDTH, 150);" onmouseout="return nd();">
                        </td>
                    </tr>
                    <tr class='header'>
                        <td align="center" class='header' width="90">
                            <font>{metal}</font>
                        </td>
                        <td align="center" class='header' width="90">
                            <font>{crystal}</font>
                        </td>
                        <td align="center" class='header' width="90">
                            <font>{deuterium}</font>
                        </td>
                        <td align="center" class='header' width="90">
                            <font color="#FFFFFF">{darkmatter}</font>
                        </td>
                        <td align="center" class='header' width="90">{energy}</td>
                    </tr>
                </table>
            </td>

**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)

jonamix-ar avatar Oct 31 '19 01:10 jonamix-ar

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;

}`

fr0st87 avatar Sep 16 '23 21:09 fr0st87