Skip to content

Commit f8070a7

Browse files
committed
fix wrong max health value for iron axe
1 parent 61cae92 commit f8070a7

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ For support or to discuss any other modding related topic you can join our [Star
1616

1717
## Changelog
1818

19+
0.0.3:
20+
21+
- fix wrong durability value for iron axe
22+
1923
0.0.2:
2024

2125
- also include metal tools

ShowDurability/Patches/Dynamic/Slot_Patch.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ namespace ShowDurability.Patches.Dynamic
88
class Slot_Patch
99
{
1010
static float MAX_HEALTH_WOOD = 300f;
11-
static float MAX_HEALTH_IRON_PICKAXE = 600f;
12-
static float MAX_HEALTH_IRON_AXE = 540f;
11+
static float MAX_HEALTH_IRON = 600f;
1312

1413
[HarmonyPostfix]
1514
[HarmonyPatch(typeof(Slot), "Refresh")]
@@ -24,21 +23,12 @@ public static void Refresh_Postfix(Slot __instance)
2423

2524
__instance.Refreshed.Send(__instance);
2625
}
27-
else if (__instance?.CurrentItem?.Name == "METAL PICKAXE")
26+
else if (__instance?.CurrentItem?.Name == "METAL PICKAXE" || __instance?.CurrentItem?.Name == "METAL AX")
2827
{
2928
DurabilityBar bar = (DurabilityBar)AccessTools.Field(typeof(Slot), "m_DurabilityBar").GetValue(__instance);
3029
bar.SetActive(true);
3130

32-
bar.SetFillAmount(__instance.CurrentItem.GetPropertyValue("Durability").Float.Current / MAX_HEALTH_IRON_PICKAXE);
33-
34-
__instance.Refreshed.Send(__instance);
35-
}
36-
else if(__instance?.CurrentItem?.Name == "METAL AX")
37-
{
38-
DurabilityBar bar = (DurabilityBar)AccessTools.Field(typeof(Slot), "m_DurabilityBar").GetValue(__instance);
39-
bar.SetActive(true);
40-
41-
bar.SetFillAmount(__instance.CurrentItem.GetPropertyValue("Durability").Float.Current / MAX_HEALTH_IRON_AXE);
31+
bar.SetFillAmount(__instance.CurrentItem.GetPropertyValue("Durability").Float.Current / MAX_HEALTH_IRON);
4232

4333
__instance.Refreshed.Send(__instance);
4434
}

ShowDurability/ShowDurability.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace ShowDurability
88
{
9-
[BepInPlugin("com.sp00ktober.ShowDurability", "ShowDurability", "0.0.2")]
9+
[BepInPlugin("com.sp00ktober.ShowDurability", "ShowDurability", "0.0.3")]
1010
public class ShowDurability : BaseUnityPlugin
1111
{
1212
private void Awake()
@@ -20,7 +20,7 @@ private static void InitPatches()
2020

2121
try
2222
{
23-
Debug.Log("Applying patches from ShowDurability 0.0.2");
23+
Debug.Log("Applying patches from ShowDurability 0.0.3");
2424

2525
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.sp00ktober.de");
2626

ShowDurability/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ShowDurability",
33
"description": "BepInEx mod for Starsand to show the durability of some tools which have it normally hidden.",
4-
"version_number": "0.0.2",
4+
"version_number": "0.0.3",
55
"dependencies": [
66
"BepInEx-BepInExPack_Starsand-5.4.16"
77
],

0 commit comments

Comments
 (0)