aboutsummaryrefslogtreecommitdiffstats
path: root/WarframeClock
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 /WarframeClock
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.
Diffstat (limited to 'WarframeClock')
-rw-r--r--WarframeClock/Program.cs37
1 files changed, 24 insertions, 13 deletions
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()