35 lines
1.1 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|