Skip to content

Commit

Permalink
1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RedstoneWizard08 committed Apr 12, 2024
1 parent 9958d37 commit b099a93
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.8.0] - 2024-04-12

### Changed

- Fixed health & days left HUD to actually reflect the correct value (in real time)

## [1.7.1] - 2024-04-12

### Changed
Expand Down
2 changes: 1 addition & 1 deletion ConfigurableWarning.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>ConfigurableWarning</AssemblyName>
<Description>Makes the game configurable!</Description>
<Version>1.7.1</Version>
<Version>1.8.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<NoWarn>$(NoWarn);CS0436</NoWarn>
Expand Down
20 changes: 20 additions & 0 deletions Source/Patches/UIPatches.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using HarmonyLib;

namespace ConfigurableWarning.Patches {
[HarmonyPatch]
internal class UIPatches {
[HarmonyPostfix]
[HarmonyPatch(typeof(UI_Health), nameof(UI_Health.Update))]
internal static void UpdateHealth(UI_Health __instance) {
__instance.fill.fillAmount = Player.localPlayer.data.health / Plugin.Instance.PluginConfig.maxHealth.Value;
}

[HarmonyPostfix]
[HarmonyPatch(typeof(UI_DaysLeft), nameof(UI_DaysLeft.Update))]
internal static void UpdateDaysLeft(UI_DaysLeft __instance) {
int num = Plugin.Instance.PluginConfig.daysPerQuota.Value - SurfaceNetworkHandler.RoomStats.CurrentQuotaDay + 1;

__instance.text.text = (num == 1) ? __instance.m_LastDayText : __instance.m_DaysLeftText.Replace("{0}", num.ToString());
}
}
}

0 comments on commit b099a93

Please sign in to comment.