Files
7d2dXG/Mods/zzz_REBIRTH__Utils/Harmony/Harmony_XUiM_PlayerInventory.cs
Nathaniel Cosford 062dfab2cd Patched
2025-05-30 01:04:40 +09:30

35 lines
1.1 KiB
C#

using Audio;
namespace Harmony.XUiM_PlayerInventoryPatches
{
[HarmonyPatch(typeof(XUiM_PlayerInventory))]
[HarmonyPatch("DropItem")]
public class DropItemPatch
{
public static bool Prefix(XUiM_PlayerInventory __instance, ItemStack stack)
{
GameManager instance = GameManager.Instance;
if ((bool)(UnityEngine.Object)instance)
{
int playerid = __instance.localPlayer.entityId;
bool isArrow = stack.itemValue.ItemClass.Name.ToLower().Contains("ammoarrow") ||
stack.itemValue.ItemClass.Name.ToLower().Contains("ammocrossbowbolt");
if (isArrow)
{
playerid = -1;
}
instance.ItemDropServer(stack, __instance.localPlayer.GetDropPosition(), Vector3.zero, playerid, 60f, false);
Manager.BroadcastPlay("itemdropped");
}
__instance.xui.CollectedItemList?.RemoveItemStack(stack);
return false;
}
}
}