aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYour Name <you@example.com>2019-01-16 03:12:49 +0900
committerYour Name <you@example.com>2019-01-16 03:12:49 +0900
commit8652f0cbfd3ca93daf0f2c9fefd2bec4a76763ed (patch)
tree5c27626adc3130aaaa3bd5632366f72213eaa31c
parentca5d7381247f1e4d57881d389b045b393a4ecc3e (diff)
downloadwf-clock-8652f0cbfd3ca93daf0f2c9fefd2bec4a76763ed.tar.gz
make cetus time stand-alone
It seems with U24.2.8 worldState.php no longer includes the cetus time (in other words, the bounty missions). The magic numbers are taken from tenno.tools.
-rw-r--r--WarframeClock.sln5
-rw-r--r--WarframeClock/Program.cs37
2 files changed, 29 insertions, 13 deletions
diff --git a/WarframeClock.sln b/WarframeClock.sln
index b5cb3dd..e94a933 100644
--- a/WarframeClock.sln
+++ b/WarframeClock.sln
@@ -5,6 +5,11 @@ VisualStudioVersion = 15.0.28307.271
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WarframeClock", "WarframeClock\WarframeClock.csproj", "{B6F30BD0-5917-4C89-8C8D-DEF0029E08A3}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BDF96AA8-18DB-4063-BD9A-CDAE76F35F43}"
+ ProjectSection(SolutionItems) = preProject
+ README.txt = README.txt
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/WarframeClock/Program.cs b/WarframeClock/Program.cs
index 9d287f0..edf7dea 100644
--- a/WarframeClock/Program.cs
+++ b/WarframeClock/Program.cs
@@ -8,20 +8,26 @@ namespace WarframeClock
{
class Program
{
+ private static bool UseWorldStatePhp = false;
+
public class WorldStateDataStruct
{
public long CetusExpiry { get; set; } = -1;
public string CetusExpiryString()
{
- if (CetusExpiry < 0)
- return "Plains: <NOT READY>";
-
- long cetusLen = 150 * 60, cetusDayLen = 100 * 60;
-
var currentTime = GetCurrentTime();
- var cetusBegin = CetusExpiry / 1000 - cetusLen;
- cetusBegin += (currentTime - cetusBegin) / cetusLen * cetusLen;
+ double cetusLen = 8998.8748;
+ double cetusDayLen = 8248.9686 - 2249.7187;
+ double cetusBegin = 1509371722 + 2249.7187;
+
+ if (UseWorldStatePhp)
+ {
+ if (CetusExpiry < 0)
+ return "Plains: <NOT READY>";
+ cetusBegin = CetusExpiry / 1000 - cetusLen;
+ }
+ cetusBegin += Math.Floor((currentTime - cetusBegin) / cetusLen) * cetusLen;
if (currentTime < cetusBegin + cetusDayLen)
return $"Plains: ☀ {GetReadableTimeSpan(cetusBegin + cetusDayLen - currentTime)}";
@@ -31,9 +37,9 @@ namespace WarframeClock
public string VallisExpiryString()
{
- long currentTime = GetCurrentTime();
- long dayStart = 1542131224;
- dayStart += (currentTime - dayStart) / 1600 * 1600;
+ double currentTime = GetCurrentTime();
+ double dayStart = 1542131224;
+ dayStart += Math.Floor((currentTime - dayStart) / 1600) * 1600;
if (currentTime - dayStart < 400)
return $"Vallis: ❄️[→☁] {GetReadableTimeSpan(dayStart + 400 - currentTime)}";
@@ -45,9 +51,10 @@ namespace WarframeClock
return $"Vallis: ☁[→❄️] {GetReadableTimeSpan(dayStart + 1600 - currentTime)}";
}
- private long GetCurrentTime() => (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
+ private double GetCurrentTime() => DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds / 1000;
- private string GetReadableTimeSpan(long span) => $"{span / 60}m{span % 60}s";
+ private string GetReadableTimeSpan(double span) =>
+ $"{Math.Floor(span / 60)}m{Math.Floor(span % 60)}s";
}
public static WorldStateDataStruct WorldStateData = new WorldStateDataStruct();
@@ -56,8 +63,12 @@ namespace WarframeClock
static void Main(string[] args)
{
StartNotifyIcon();
- StartWorldStateFetch();
StartOverlay();
+
+ if (UseWorldStatePhp)
+ {
+ StartWorldStateFetch();
+ }
}
private static void StartNotifyIcon()