We have detected that cookies are not enabled on your browser. Please enable cookies to ensure the proper experience.
Results 1 to 5 of 5
  1. #1

    Detecting the server

    In the process of diagnosing a plugin issue, I may have accidentally discovered how to detect which server you're logged into.

    It seems that each server has its own "game timer" (the value returned by Turbine.Engine.GetGameTime()) which is significantly different from every other server. If you subtract the "game time" from the "local time" (which is the same for all servers) using the expression (Turbine.Engine.GetLocalTime() - Turbine.Engine.GetGameTime()), you get a pretty stable value for each server, that only varies by ±1 second or so:

    Server local time - game time
    Gladden 1178127221
    Landroval 1178132198
    Brandywine 1178171801
    Arkenstone 1178716300
    Sirannon 1180187358
    Laurelin 1180230289
    Evernight 1180278158
    Belegaer 1180348254
    Crickhollow 1283960584
    Gwaihir 1286462731

    The only question is whether these numbers remain valid after server resets and game updates. I'll recheck them then and report the results here. If the numbers stay the same, it will be trivial to implement a Turbine.Engine.GetServerName() function.

    Note that "local time" seems to be a misnomer; the value seems to be independent of timezone. Which makes it handy for this purpose.
    Thurallor, Warden of Landroval
    Author of plugins: SequenceBars, Reminders, others

  2. #2
    Arkenstone was rebooted today. Afterwards, the difference between "game time" and "local time" has changed to 1178716405, which is 105 seconds higher than the previous value (1178716300).

    I decided to go ahead and recheck the values for the other servers, even though AFAIK none of them has been rebooted:

    Server local time - game time (previous) local time - game time (current) difference
    Gladden 1178127221 1178127421 +200
    Landroval 1178132198 1178132060 -138
    Brandywine 1178171801 1178171624 -177
    Arkenstone 1178716300 1178716405 +105
    Sirannon 1180187358 1180187294 -64
    Laurelin 1180230289 1180230163 -126
    Evernight 1180278158 1180277867 -291
    Belegaer 1180348254 1180348127 -127
    Crickhollow 1283960584 1283960477 -107
    Gwaihir 1286462731 1286462482 -249

    Looks like the numbers can change at other times, other than server reboots.
    Last edited by Thurallor; Feb 05 2018 at 03:22 PM.
    Thurallor, Warden of Landroval
    Author of plugins: SequenceBars, Reminders, others

  3. #3
    Join Date
    Jun 2011
    Location
    EU
    Posts
    812
    Quote Originally Posted by Thurallor View Post
    I may have accidentally discovered how to detect which server you're logged into.
    Well, if you really need the server names for your plugin, you could manually create 10 different "servername.plugindata"-files for each server directory within your PluginData directory (or 12 if you want to include Bullroarer and Palantir), each returning the corresponding server name string. Once all files are created, all plugins can always access the correct file (= the file associeted with your current server) and can get the string of the current servername.

    Quote Originally Posted by Thurallor View Post
    Note that "local time" seems to be a misnomer; the value seems to be independent of timezone. Which makes it handy for this purpose.
    I always assumed "local time" would be the Turbine API equivalent to Lua's os.time (= Operating System time on your local machine), no?
    Eruadarion | Captain | on Gwaihir [EU-DE]
    www.avorthalier.eu

  4. #4
    Quote Originally Posted by Eruadarion View Post
    Well, if you really need the server names for your plugin, you could manually create 10 different "servername.plugindata"-files for each server directory within your PluginData directory (or 12 if you want to include Bullroarer and Palantir), each returning the corresponding server name string. Once all files are created, all plugins can always access the correct file (= the file associeted with your current server) and can get the string of the current servername.
    Sure, that's fine if I'm the only person using the plugin. But I prefer that to not be the case for the plugins I write.

    I could instruct users to create those 10 files in those 10 locations, but then I'm making it even harder for people to use the plugin, and the number of people willing to mess with it goes down. And Plugin Compendium can't create files in the PluginData folder, AFAIK.

    I always assumed "local time" would be the Turbine API equivalent to Lua's os.time (= Operating System time on your local machine), no?
    Not sure. According to the SSG Lua API docs, Turbine.Engine.GetLocalTime() "Gets the number of seconds since 1/1/1970." I tried changing the OS time and timezone on my machine, and it didn't affect the return value.
    Thurallor, Warden of Landroval
    Author of plugins: SequenceBars, Reminders, others

  5. #5
    Join Date
    Feb 2007
    Location
    Philadelphia, PA
    Posts
    2,994
    Quote Originally Posted by Thurallor View Post
    Not sure. According to the SSG Lua API docs, Turbine.Engine.GetLocalTime() "Gets the number of seconds since 1/1/1970."
    That "date" is a standard for Unix based system.

    To quote the WIKIpedia entry: "Unix time (also known as POSIX time or UNIX Epoch time) is a system for describing a point in time, defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, minus the number of leap seconds that have taken place since then.

    I don't know if Windows uses the same definition -- but the implication is that the Game Servers are running on Unix (or possibley Linux) based systems.

    The only way I can think of to obtain the name of your world is to grab the XML from the Launcher, the way PyLotro used to do. That XML is passed to the GLS to get the IP addresses associated with the particular servers as part of the pre-login authentication process. However, that info is gone once you are in-game. Of course, there are no hooks in the Launcher to do that. . . sigh.
    Bill Magill Mac Player Founder/Lifetimer
    Old Timers Guild - Gladden
    Sr. Editor LOTRO-Wiki.com

    Val - Man Minstrel (106)
    Valalin - Dwarf Minsrel (71)
    Valamar - Dwarf Hunter (115)
    Valdicta - Dwarf RK (105)
    Valhad - Elf LM (66)
    Valkeeper - Elf RK (87)
    Valwood - Dwarf RK (81)

    Valhunt - Dwarf Hunter (71)
    Valanne - Beorning (105)
    Ninth - Man Warden (66)

    "Laid back, not so serious, no drama.
    All about the fun!"


 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

This form's session has expired. You need to reload the page.

Reload