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.
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 02:22 PM.
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.
Originally Posted by Thurallor
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?
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.
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
Starting tomorrow, there will be a reliable way to identify the server:
Originally Posted by Cordovan
The /loc command has been modified to include the player's server ID and timestamp. Including this information with GM correspondence could help us expedite your request.
It requires a click from the user, but it's a huge improvement over the options we had before!
It will also probably break a lot of existing plugins that rely on the "/loc" command's output format.