Player and terId location

General discussion about Life is Feudal MMO and Life is Feudal: Your Own, The main section and backbone of the forums.

Markvart
 
Posts: 7
Joined: 02 Dec 2014, 14:36

Player and terId location

Post by Markvart » 08 Dec 2014, 14:04

Hi guys,

I want to write my map tool to monitor the players on my server but I'm having trouble using data from the f_fromGeoID procedure.
If i'm right x and y are coordinates inside one terId.

But is there any map or a way to find where these terId are located on the island map ?

That guy certainly found out as he did what i'm looking for : http://stingraygames.net/maplif.aspx

Many thanks

User avatar
Vamyan
 
Posts: 198
Joined: 23 Oct 2014, 22:29

Re: Player and terId location

Post by Vamyan » 08 Dec 2014, 15:23

From a geoID? I don't know. I mean, I guess you could roughly calculate, but those numbers are only to within 2 meters (one square) and each TerID is 500x500 squares making each TerID 1km^2 and the entire map 3km^2...

so assuming 250, 250 in terid 446 is 0,0 and 1,1 in 242 is -1500,1500, that'd be... x-250, y-250... ya know what, screw it. I'll just make an sql proc.

Code: Select all
DELIMITER |
CREATE PROCEDURE `p_WorldCoordsFromGeoID`(IN `GeoID` INT UNSIGNED)
   LANGUAGE SQL
   NOT DETERMINISTIC
   CONTAINS SQL
   SQL SECURITY DEFINER
   COMMENT ''
BEGIN
   DECLARE worldX, worldY BIGINT;
   select
      (geoID >> 18) as terID,
      (geoID & ((1 << 9) - 1)) as `x`,
      ((geoID >> 9) & ((1 << (9)) - 1)) as `y` INTO @terID,worldX,worldY;
   SET worldX = worldX * 2 - 500;
   SET worldY = worldY * -2 + 500;
   CASE @terID
      WHEN 442 THEN BEGIN
            SET worldX = worldX - 1000;
            SET worldY = worldY + 1000;
         END;
      WHEN 443 THEN BEGIN
            SET worldY = worldY + 1000;
         END;
               WHEN 444 THEN BEGIN
            SET worldX = worldX + 1000;
            SET worldY = worldY + 1000;
         END;
      WHEN 445 THEN BEGIN
            SET worldX = worldX + 1000;
         END;
      WHEN 446 THEN BEGIN END;
      WHEN 447 THEN BEGIN
            SET worldX = worldX + 1000;
         END;
      WHEN 448 THEN BEGIN
            SET worldX = worldX - 1000;
            SET worldY = worldY - 1000;
         END;
      WHEN 449 THEN BEGIN
            SET worldY = worldY - 1000;
         END;
      WHEN 448 THEN BEGIN
            SET worldX = worldX + 1000;
            SET worldY = worldY - 1000;
         END;
   END CASE;
   SELECT worldX, worldY;
END|


Markvart
 
Posts: 7
Joined: 02 Dec 2014, 14:36

Re: Player and terId location

Post by Markvart » 08 Dec 2014, 15:52

Thank you for the proc i'll study it when back home as it will certainly be useful but my question was :

How do you guys know which exact area of the map does each terID (1km x 1km square) cover ?

Is it something like that ?

442 443 444
445 446 447
448 449 450

User avatar
Vamyan
 
Posts: 198
Joined: 23 Oct 2014, 22:29

Re: Player and terId location

Post by Vamyan » 08 Dec 2014, 16:20

Yes. Exactly like that.


Markvart
 
Posts: 7
Joined: 02 Dec 2014, 14:36

Re: Player and terId location

Post by Markvart » 08 Dec 2014, 16:59

Thank you for your time and kindness

Return to General Discussion

cron