Max Button for fleet and defence pages

Status
Not open for further replies.
Joined
Jan 1, 2009
Messages
385
Reaction score
20

AdriaN401MasteR - Max Button for fleet and defence pages - RaGEZONE Forums
Hi there O-game lovers,

I'm sorry I haven't posted any tutorial in the last couple of weeks/months but I had some problems and some things I had to solve.

Let's stop talking and start working.



1. Open FleetBuildingPage.php ( you should know where that is.. well anyway.. includes/functions )

2. Search for:
PHP:
// Case nombre d'elements a construire
                $PageTable .= "<th class=k>";
                // Si ... Et Seulement si je peux construire je mets la p'tite zone de saisie
                if ($CanBuildOne) {
                    $TabIndex++;                    $PageTable .= 
"<input type=text name=fmenge[".$Element."] alt='".$lang['tech'][$Element]."' size=16 maxlength=15 value=0 tabindex=".$TabIndex.">";
Remember that if you are looking for the exact match then there are 80% chances your will fail.

3. Add AFTER that code:
PHP:
$maxElement = GetMaxConstructibleElements($Element, $CurrentPlanet);
                    if ($maxElement > MAX_FLEET_OR_DEFS_PER_ROW) 
$maxElement = MAX_FLEET_OR_DEFS_PER_ROW; 
                    $PageTable .= "<br><a href='javascript:' 
onclick=\"document.getElementsByName('fmenge[".$Element."]')[0].value = '$maxElement';\">(Max : {$maxElement})</a>";

4. Save and close.

5. Open DefensesBuildingPage.php ( includes/functions )

6. Search for:
PHP:
// Si ... Et Seulement si je peux construire je mets la p'tite zone de saisie
                if ($CanBuildOne) {
                    $InQueue = strpos ( $CurrentPlanet['b_hangar_id'], $Element.",");
                    $IsBuild = ($CurrentPlanet[$resource[407]] >= 1) ? true : false;
                    $BuildIt = true;
                    if ($Element == 407 || $Element == 408) {
                        $BuildIt = false;
                        if ( $InQueue === false && !$IsBuild) {
                            $BuildIt = true;
                        }
                    }

                    if ( !
$BuildIt ) {
                        $PageTable .= "<font color=\"red\">".$lang['only_one']."</font>";
                    } else {
                        $TabIndex++;
Again, might not be the exact match.

7. Add after it:
PHP:
$maxElement = GetMaxConstructibleElements($Element, $CurrentPlanet);
                    if ($maxElement > MAX_FLEET_OR_DEFS_PER_ROW) $maxElement 
= MAX_FLEET_OR_DEFS_PER_ROW; 
                        $PageTable .= "<br><a href='javascript:' 
onclick=\"document.getElementsByName('fmenge[".$Element."]')[0].value = '$maxElement';\">(Max : {$maxElement})</a>";

8. Save and close.

9. You should also do this step. Open GetMaxConstructibleElements.php and go to the bottom.

10. Insert above:
PHP:
return $MaxElements;
The following code:
PHP:
    if ($maxElement > MAX_FLEET_OR_DEFS_PER_ROW) $maxElement = MAX_FLEET_OR_DEFS_PER_ROW;

I believe that the code is clear and you can see what each line does.

I hope this helps :blush:.

Greetings,
Angel
 
Last edited:
Status
Not open for further replies.
Back