void OnPlayerInit(BasePlayer player) { if (player.inventory.containerWear.itemList.Count() == 0) { GivePants(player); return; } Item valid = player.inventory.containerWear.itemList.Where(k => Pants.Contains(k.info.shortname)).Select(k => k).FirstOrDefault(); if (valid == null) { GivePants(player); } }
object CanMoveItem(Item item, PlayerInventory playerLoot, uint targetContainer, int targetSlot) { if (item == null || playerLoot == null) { return(null); } if (playerLoot.containerWear.itemList.Contains(item) && Pants.Contains(item.info.shortname)) { return(false); } Item valid = playerLoot.containerWear.itemList.Where(k => Pants.Contains(k.info.shortname)).Select(k => k).FirstOrDefault(); if (Pants.Contains(item.info.shortname) && valid == null) { timer.Once(1, () => MovePants(item, playerLoot.containerWear)); return(false); } if (playerLoot.containerWear.uid == targetContainer && valid != null && !Pants.Contains(item.info.shortname) && targetSlot == valid.position) { return(false); } return(null); }
object OnItemAction(Item item, string cmd) { if (item == null || item.parent == null || item.parent.playerOwner == null) { return(null); } if (cmd == "drop" && item.parent.playerOwner.inventory.containerWear.itemList.Contains(item) && Pants.Contains(item.info.shortname)) { return(true); } return(null); }