object CanMoveItem(Item item, PlayerInventory playerLoot, uint targetContainer, int targetSlot, int amount) { if (item == null) { return(null); } if (item.info.shortname != "note") { return(null); } if (!item.HasFlag(global::Item.Flag.OnFire)) { return(null); } Bounty bounty = BountyData.GetBounty(item); if (bounty == null) { return(null); } item.text = bounty.text; item.MarkDirty(); return(null); }
void OnItemDropped(Item item, BaseEntity entity) { if (item.info.shortname != "note") { return; } if (!item.HasFlag(global::Item.Flag.OnFire)) { return; } Bounty bounty = BountyData.GetBounty(item); if (bounty == null) { return; } //attach portableBounty WorldItem wItem = entity as WorldItem; PortableBounty pBounty = wItem.gameObject.AddComponent <PortableBounty>(); pBounty.bounty = bounty; //remove Bounty from Data BountyData.removeBounty(item.uid); }
void OnActiveItemChanged(BasePlayer player, Item oldItem, Item newItem) { if (player == null) { return; } if (newItem != null) { if (newItem?.info?.shortname == "note" && newItem.HasFlag(global::Item.Flag.OnFire)) { Bounty bounty = BountyData.GetBounty(newItem); if (bounty != null) { sendBounty(player, bounty); return; } } } closeBounty(player); }
object OnServerCommand(ConsoleSystem.Arg arg) { if (arg == null) { return(null); } //note.update UID Content BasePlayer player = arg.Player(); if (player == null) { return(null); } if (arg.cmd.FullName == "note.update") { #if DEBUG player.ChatMessage($"note.update {arg.FullString}"); #endif Item note = findItemByUID(player.inventory, uint.Parse(arg.Args[0])); if (note == null) { return(null); } Bounty bounty = BountyData.GetBounty(note); if (bounty == null) { return(null); } timer.Once(0.2f, () => { note.text = bounty.text; note.MarkDirty(); }); } return(null); }