From 1289ddb84b2c3308071d36ebcaec24157a9e75e3 Mon Sep 17 00:00:00 2001 From: Doriel Rivalet <100863878+DorielRivalet@users.noreply.github.com> Date: Thu, 8 Feb 2024 23:57:11 -0300 Subject: [PATCH] fix: buff timers --- .../Models/Addresses/AddressModelHGE.cs | 8 ++++++- .../Models/Addresses/AddressModelNotHGE.cs | 8 ++++++- .../ViewModels/Windows/AddressModel.cs | 22 +++++++++++++------ 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/MHFZ_Overlay/Models/Addresses/AddressModelHGE.cs b/MHFZ_Overlay/Models/Addresses/AddressModelHGE.cs index 65c51865..3fef6ee0 100644 --- a/MHFZ_Overlay/Models/Addresses/AddressModelHGE.cs +++ b/MHFZ_Overlay/Models/Addresses/AddressModelHGE.cs @@ -1837,7 +1837,13 @@ public AddressModelHGE(Mem m) public override int ActiveFeature3() => this.M.Read2Byte("mhfo-hd.dll+E41A2A8"); /// - public override int ServerHeartbeat() => this.M.ReadInt("mhfo-hd.dll+EABD4F0"); + public override int ServerHeartbeatLandOdd() => this.M.ReadInt("mhfo-hd.dll+EABD4F0"); + + /// + public override int ServerHeartbeatLandEven() => this.M.ReadInt("mhfo-hd.dll+E9D1EB0"); + + /// + public override int LandSlot() => this.M.ReadInt("mhfo-hd.dll+EDFB940"); /// public override int GuildFoodStart() => this.M.ReadInt("mhfo-hd.dll+E7FED08"); diff --git a/MHFZ_Overlay/Models/Addresses/AddressModelNotHGE.cs b/MHFZ_Overlay/Models/Addresses/AddressModelNotHGE.cs index e1fcabba..3b67aa78 100644 --- a/MHFZ_Overlay/Models/Addresses/AddressModelNotHGE.cs +++ b/MHFZ_Overlay/Models/Addresses/AddressModelNotHGE.cs @@ -1756,7 +1756,13 @@ public AddressModelNotHGE(Mem m) public override int ActiveFeature3() => this.M.Read2Byte("mhfo.dll+57E26E8"); /// - public override int ServerHeartbeat() => this.M.ReadInt("mhfo.dll+5E83A00"); + public override int ServerHeartbeatLandOdd() => this.M.ReadInt("mhfo.dll+5E83A00"); + + /// + public override int ServerHeartbeatLandEven() => this.M.ReadInt("mhfo.dll+5D983C0"); + + /// + public override int LandSlot() => this.M.ReadInt("mhfo.dll+61C11A0"); /// public override int GuildFoodStart() => this.M.ReadInt("mhfo.dll+5BC70E0"); diff --git a/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs b/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs index 10fa4920..4f9a1765 100644 --- a/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs +++ b/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs @@ -1341,11 +1341,18 @@ 21747 or /// public abstract int ActiveFeature3(); + public abstract int ServerHeartbeatLandEven(); + + public abstract int ServerHeartbeatLandOdd(); + + public abstract int LandSlot(); + + /// /// Updates every 11 seconds /// /// - public abstract int ServerHeartbeat(); + public int ServerHeartbeat => LandSlot() % 2 == 0 ? ServerHeartbeatLandEven() : ServerHeartbeatLandOdd(); public abstract int GuildFoodStart(); @@ -2615,7 +2622,7 @@ public bool DivaSongEnding } var expiry = divaSongStart + (60 * 90); - double secondsLeft = expiry - ServerHeartbeat(); + double secondsLeft = expiry - ServerHeartbeat; return secondsLeft <= 60*10; } @@ -2633,7 +2640,7 @@ public bool DivaSongEnded } var expiry = divaSongStart + (60 * 90); - double secondsLeft = expiry - ServerHeartbeat(); + double secondsLeft = expiry - ServerHeartbeat; return secondsLeft <= 0; } @@ -2659,7 +2666,7 @@ public bool GuildFoodEnding } var expiry = GuildFoodStart() + (60 * 90); - double secondsLeft = expiry - ServerHeartbeat(); + double secondsLeft = expiry - ServerHeartbeat; return secondsLeft <= 60 * 10; } @@ -2675,7 +2682,7 @@ public bool GuildFoodEnded } var expiry = GuildFoodStart() + (60 * 90); - double secondsLeft = expiry - ServerHeartbeat(); + double secondsLeft = expiry - ServerHeartbeat; return secondsLeft <= 0; } @@ -2766,6 +2773,7 @@ public string GetRunBuffsTag(RunBuff runBuff) { return runBuff switch { + RunBuff.None => "None", RunBuff.LeaderboardTimeAttack => "TA", RunBuff.LeaderboardFreestyleDivaSkill => "FDS", RunBuff.LeaderboardFreestyleDivaPrayerGem => "FDP", @@ -13596,7 +13604,7 @@ public string GuildFoodTimeLeft } var expiry = GuildFoodStart() + (60 * 90); - double secondsLeft = expiry - ServerHeartbeat(); + double secondsLeft = expiry - ServerHeartbeat; if (secondsLeft <= 0) { @@ -13619,7 +13627,7 @@ public string DivaSongTimeLeft } var expiry = divaSongStart + (60 * 90); - double secondsLeft = expiry - ServerHeartbeat(); + double secondsLeft = expiry - ServerHeartbeat; if (secondsLeft <= 0) {