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

Repaired Defense overrides all players after attack #131

Closed
Bustux opened this issue May 27, 2016 · 5 comments
Closed

Repaired Defense overrides all players after attack #131

Bustux opened this issue May 27, 2016 · 5 comments
Assignees
Labels
Bug Issues that is an error, bug or it is not working as expected Fixed Issues that after being labeled as Bug have been resolved
Milestone

Comments

@Bustux
Copy link

Bustux commented May 27, 2016

After a attack the repaired defenses of the attacked player overrides the defense of all players.

application\libraries\missions\attack.php Line 773-781
original :
parent::$db->query( "UPDATE" . PLANETS . "," . SHIPS . "," . DEFENSES . "SET " . $fleetArray. " planet_metal=planet_metal- " . $steal['metal'] . ", planet_crystal=planet_crystal- " . $steal['crystal'] . ", planet_deuterium=planet_deuterium- " . $steal['deuterium'] . " WHEREplanet_id= '" . $target_planet['planet_id'] . "' AND ship_planet_id= '" . $target_planet['planet_id'] . "'" );

fix :
parent::$db->query( "UPDATE" . PLANETS . "," . SHIPS . "," . DEFENSES . "SET " . $fleetArray. " planet_metal=planet_metal- " . $steal['metal'] . ", planet_crystal=planet_crystal- " . $steal['crystal'] . ", planet_deuterium=planet_deuterium- " . $steal['deuterium'] . " WHEREplanet_id= '" . $target_planet['planet_id'] . "' AND ship_planet_id= '" . $target_planet['planet_id'] . "' AND defense_planet_id= '" . $target_planet['planet_id'] . "'" );

@LucasKovacs LucasKovacs added the Bug Issues that is an error, bug or it is not working as expected label May 31, 2016
@LucasKovacs LucasKovacs modified the milestone: v3.0.2 May 31, 2016
@Jorch95
Copy link

Jorch95 commented Jun 17, 2016

And this fix resolved the problem ? Because I hace a similar bug.

@Jorch95
Copy link

Jorch95 commented Jun 17, 2016

Hello @Bustux !! I had the same bug like you and i replace the fix that you've posted here. After this, i send an attack to see if everything was ok, but after the attack, the Battle Report didn't appear and the defenses of the attacked planet didn't change at all.

Forgive my writting, my english is rusty.

@FedePuratich
Copy link

FedePuratich commented Jun 17, 2016

Hello, im working with @Jorch95 and we tested this fix, at first time with this code we have this error and the battle didn't happen

Database query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATExgp_planets,xgp_ships,xgp_defensesSETdefense_rocket_launcher= 5,' at line 1 Last SQL Query: UPDATExgp_planets,xgp_ships,xgp_defensesSET defense_rocket_launcher = 5, defense_light_laser = 1, ship_espionage_probe = 1, ship_solar_satellite = 1, planet_metal=planet_metal- 0, planet_crystal=planet_crystal- 0, planet_deuterium=planet_deuterium- 0 WHERE planet_id= '18' AND ship_planet_id= '18' AND defense_planet_id= '18'`

at second time we change the code for

parent::$db->query( "UPDATE" . PLANETS . "," . SHIPS . "," . DEFENSES . "SET " . $fleetArray. " planet_metal=planet_metal- " . $steal['metal'] . ", planet_crystal=planet_crystal- " . $steal['crystal'] . ", planet_deuterium=planet_deuterium- " . $steal['deuterium'] . " WHEREplanet_id= '" . $target_planet['planet_id'] . "' AND ship_planet_id= '" . $target_planet['planet_id'] . "' AND defense_planet_id= '" . $target_planet['planet_id'] . "'" //FIX );

and the battle went well but we have this error in the log

Database query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATExgp_planets,xgp_ships,xgp_defensesSETdefense_rocket_launcher= 1,' at line 1 Last SQL Query: UPDATExgp_planets,xgp_ships,xgp_defensesSET defense_rocket_launcher = 1, defense_light_laser = 1, ship_small_cargo_ship = 0, ship_light_fighter = 0, ship_solar_satellite = 0, planet_metal=planet_metal- 4649.3284708378, planet_crystal=planet_crystal- 2533.9406055383, planet_deuterium=planet_deuterium- 1758.6564847222 WHERE planet_id= '19' AND ship_planet_id= '19' AND defense_planet_id= '19'`

sorry for my troglodit english

@FedePuratich
Copy link

We tryed again and it's work.. idk the reason because the second error.

@Bustux
Copy link
Author

Bustux commented Jun 18, 2016

@FedePuratich
Ok i cant say 100% want went wrong with your implementation.
Here is the php file as we use it on our server and until now we had no problems with it: http://pastebin.com/4j7iqiQr . After i write this fix i got a pm with a better fix. I haven't tested it but my be it will help you.
parent::$db->query( "UPDATE " . PLANETS . ", " . SHIPS . ", " . DEFENSES . " SET " . $fleetArray. " planet_metal = planet_metal - " . $steal['metal'] . ", planet_crystal = planet_crystal - " . $steal['crystal'] . ", planet_deuterium = planet_deuterium - " . $steal['deuterium'] . " WHERE planet_id = '" . $target_planet['planet_id'] . "' AND ship_planet_id = '" . $target_planet['planet_id'] . "' AND defense_planet_id= '" . $target_planet['planet_id'] . "'" );

LucasKovacs added a commit that referenced this issue Sep 27, 2016
@LucasKovacs LucasKovacs self-assigned this Sep 28, 2016
@LucasKovacs LucasKovacs added the Fixed Issues that after being labeled as Bug have been resolved label Oct 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues that is an error, bug or it is not working as expected Fixed Issues that after being labeled as Bug have been resolved
Projects
None yet
Development

No branches or pull requests

4 participants