Post by Tiscan on Dec 20, 2014 16:07:40 GMT
One thing I really don't like about gw2pao is, that it doesn't seem to check if GW2 is running and what its current state is...
I'm currently playing around with (my first) C# project and I tried to add some logic to make sure it plays nicely with gw2 Basically I'm doing two things... first of all: from time to time i check if there is a gw2-process running:
and to catch if a new map is loading or if the player is still in the char-selection or the login-mask, i keep track of the uiTick value that can be retrieved using the Mumble Link (http://wiki.mumble.info/wiki/Link) ... basically, uiTick is increased every time GW2 updates the MumbleLink-data... and its only updated if the player is in the game-world... so i store the current value in a variable (every time my code runs) and if it doesn't change I know, that the player is either in a loading-screen or the char-selection.
So my code looks basically like this:
Probably not perfect but better than nothing
By checking that stuff you could for example replace the UI-Icon with a Task-Bar Icon as long as GW2 isn't running and hide certain windows that are pointless if GW2 isn't running (map completion for example) or hide the UI while GW2 is loading.
I'm currently playing around with (my first) C# project and I tried to add some logic to make sure it plays nicely with gw2 Basically I'm doing two things... first of all: from time to time i check if there is a gw2-process running:
public bool IsProcessOpen(string name) {
foreach (Process clsProcess in Process.GetProcesses()) {
if (clsProcess.ProcessName.Equals(name, StringComparison.OrdinalIgnoreCase)) {
return true;
}
}
return false;
}
if (IsProcessOpen("gw2")) {
// YAY! Its running!
}
and to catch if a new map is loading or if the player is still in the char-selection or the login-mask, i keep track of the uiTick value that can be retrieved using the Mumble Link (http://wiki.mumble.info/wiki/Link) ... basically, uiTick is increased every time GW2 updates the MumbleLink-data... and its only updated if the player is in the game-world... so i store the current value in a variable (every time my code runs) and if it doesn't change I know, that the player is either in a loading-screen or the char-selection.
So my code looks basically like this:
if (IsProcessOpen("gw2")) {
if (old_tick < playerInfo.tick) {
// Playing!
} else {
// Loading / Char-Selection
}
} else {
// GW2 not running at all
}
old_tick = playerInfo.tick;
Probably not perfect but better than nothing
By checking that stuff you could for example replace the UI-Icon with a Task-Bar Icon as long as GW2 isn't running and hide certain windows that are pointless if GW2 isn't running (map completion for example) or hide the UI while GW2 is loading.