示例#1
0
        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);
        }
示例#2
0
        object OnItemPickup(Item item, BasePlayer player)
        {
            WorldItem wItem = item.GetWorldEntity() as WorldItem;

            if (wItem.item == null)
            {
                return(null);
            }
            if (item.info.shortname == "note")
            {
                PortableBounty pBounty = wItem.gameObject.GetComponent <PortableBounty>();
                if (pBounty != null)
                {
                    Bounty bounty = pBounty.bounty;
                    if (bounty == null)
                    {
                        Puts($"pBounty.bounty on Note[{item.uid}] is null. This shouldn't happen!");
                        return(null);
                    }
                    BountyData.AddBounty(bounty);
                }
            }

            return(null);
        }