From 2fb6331d7b2da8d09d0d4e158c702e92df609eb8 Mon Sep 17 00:00:00 2001
From: Bolton <48883340+BoltonDev@users.noreply.github.com>
Date: Wed, 4 Dec 2024 22:38:57 +0100
Subject: [PATCH] fix: DroppingCandy event
---
.../Scp330/DroppingScp330EventArgs.cs | 4 ++--
.../Patches/Events/Scp330/DroppingCandy.cs | 18 ++++++++++++------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/EXILED/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs
index 1542d6aa0e..0ead45776d 100644
--- a/EXILED/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs
+++ b/EXILED/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs
@@ -39,9 +39,9 @@ public DroppingScp330EventArgs(Player player, Scp330Bag scp330, CandyKindID cand
}
///
- /// Gets or sets a value representing the being picked up.
+ /// Gets a value representing the being picked up.
///
- public Scp330 Scp330 { get; set; } // Todo Remove set
+ public Scp330 Scp330 { get; }
///
public Item Item => Scp330;
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs b/EXILED/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs
index 21f4d40ed9..36ea89bccd 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs
@@ -56,15 +56,14 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions);
}
+
+ private static CandyKindID GetCandyID(Scp330Bag scp330Bag, int index)
+ {
+ if (index < 0 || index > scp330Bag.Candies.Count)
+ return CandyKindID.None;
+ return scp330Bag.Candies[index];
+ }
}
}
\ No newline at end of file