Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small bug on statistics update after missile attack #145

Open
Quaua00 opened this issue Jun 18, 2024 · 1 comment
Open

small bug on statistics update after missile attack #145

Quaua00 opened this issue Jun 18, 2024 · 1 comment

Comments

@Quaua00
Copy link

Quaua00 commented Jun 18, 2024

after completing a missile attack the attacker and defender statistics do not update automatically but after the queues are updated. as for the attacker add this line before RecalcRanks() in raketen.php:

AdjustStats ( $origin['owner_id'], (25000*$amount), 0, 0, '-' );

However, the update of the defender who calculates the costs of the destroyed defenses would be missing

@Quaua00
Copy link
Author

Quaua00 commented Jun 18, 2024

I managed to integrate the statistics update for defenses too. the only thing is that I used a variable that is not present in this online source as I inserted the feature as in the original version which counts how many defenses have been destroyed next to the type of defense.

in any case these are the codes to insert into raketen.php after these lines:

SetPlanetDefense ( $planet_id, $target ); if ($moon_attack) { SetPlanetDefense ( $moon_planet['planet_id'], $moon_planet ); }

INSERT:

$total_cost= 0;

if (!empty($destroyed_defense)) {
    foreach ($destroyed_defense as $defense_key => $destroyed_count) {
        $defense_id = substr($defense_key, 1); 
        $cost_per_defense = ShipyardPrice($defense_id); 
        foreach ($cost_per_defense as $resource => $cost) {
            $total_cost += $cost * $destroyed_count; 
        }
    }
}
AdjustStats ( $origin['owner_id'], (25000*$amount), 0, 0, '-' );
AdjustStats ( $target['owner_id'], $total_cost, 0, 0, '-' );
RecalcRanks ();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant