TravianZ icon indicating copy to clipboard operation
TravianZ copied to clipboard

Sending troops ends up with "Coordinates do not exist" error

Open greldinard opened this issue 3 years ago • 5 comments

  1. expected behaviour Entering Coordinates target fiels will send troops to the corresponding field.

  2. incorrect behaviour Message "Coordinates do not exist" appears, troops are not send. Probable encoding error? But where? Apache? PHP?

  3. the operating system & version Ubuntu 20.04

  4. PHP version on the server PHP 7.4.3

  5. MySQL / MariaDB version on the server MySQL 8.0.27

greldinard avatar Nov 08 '21 10:11 greldinard

Resolved:

Change the function:

public function getBaseID($x, $y){
		return ((WORLD_MAX - $y) * (WORLD_MAX * 2 + 1)) + (WORLD_MAX + $x + 1);
	}

in the file GameEngine/Generator.php to:

public function getBaseID($x, $y){
		return ((WORLD_MAX - $y) * (WORLD_MAX * 2 + 1)) + (WORLD_MAX - $x + 1);
	}

And the coordinated will be calculated correctly.

greldinard avatar Nov 26 '21 07:11 greldinard

I just setup a server for me to play around and that '+' to '-' change actually breaks the game for me, making both the map and attack coordinates unusable. Reverting back the '+' to '-' is actually a fix for me.

xPh03n1x avatar Mar 07 '22 00:03 xPh03n1x

Resolved: ...snip... And the coordinated will be calculated correctly.

Applied this fix locally on my test system and gave it a quick test: appears it fixed my issue of being unable to raid some locations as well. Thank you.

My test system is:

  • Ubuntu 20.04.4 LTS (5.4.0-104-generic) fully patched
  • mysql-server-8.0
  • php7.4

gdinit avatar Mar 10 '22 22:03 gdinit

Guys, i think the fix is:

$a = ( WORLD_MAX - $y );
$b = ( WORLD_MAX - $x );  
if ( $b < 0 ) {
    	$b = -$b;
} 
return ( $a * (WORLD_MAX * 2 + 1) ) + $b + 1;

Tested doing:

SELECT* FROM `s1_wdata` WHERE ( ( 100 - y ) * 201 + ABS( 100 - x ) + 1 ) <> id

the result is empty

aleferri avatar Mar 21 '22 00:03 aleferri