Example #1
0
        public bool Run(params object[] args)
        {
            NWPlaceable point  = (Object.OBJECT_SELF);
            NWPlayer    player = _.GetLastClosedBy();

            if (!player.IsPlayer)
            {
                return(false);
            }

            bool isFullyHarvested = point.GetLocalInt("SCAVENGE_POINT_FULLY_HARVESTED") == 1;

            if (!point.InventoryItems.Any() && isFullyHarvested)
            {
                string seed = point.GetLocalString("SCAVENGE_POINT_SEED");
                if (!string.IsNullOrWhiteSpace(seed))
                {
                    _.CreateObject(NWScript.OBJECT_TYPE_ITEM, seed, point.Location);
                }

                point.Destroy();
                _farming.RemoveGrowingPlant(point);
            }
            return(false);
        }
Example #2
0
        public bool Run(params object[] args)
        {
            NWPlayer    oPC         = NWPlayer.Wrap(_.GetLastDisturbed());
            NWItem      oItem       = NWItem.Wrap(_.GetInventoryDisturbItem());
            NWPlaceable point       = NWPlaceable.Wrap(NWN.Object.OBJECT_SELF);
            int         disturbType = _.GetInventoryDisturbType();

            if (disturbType == INVENTORY_DISTURB_TYPE_ADDED)
            {
                _item.ReturnItem(oPC, oItem);
            }
            else
            {
                if (point.InventoryItems.Count <= 0 && point.GetLocalInt("FORAGE_POINT_FULLY_HARVESTED") == 1)
                {
                    string seed = point.GetLocalString("FORAGE_POINT_SEED");
                    if (!string.IsNullOrWhiteSpace(seed))
                    {
                        _.CreateObject(OBJECT_TYPE_ITEM, seed, point.Location);

                        int perkLevel = _perk.GetPCPerkLevel(oPC, PerkType.SeedPicker);
                        if (_random.Random(100) + 1 <= perkLevel * 10)
                        {
                            _.CreateObject(OBJECT_TYPE_ITEM, seed, point.Location);
                        }
                    }

                    point.Destroy();
                    _farming.RemoveGrowingPlant(point);
                }
            }
            return(true);
        }
Example #3
0
        public bool Run(params object[] args)
        {
            NWPlaceable point = NWPlaceable.Wrap(Object.OBJECT_SELF);

            bool isFullyHarvested = point.GetLocalInt("FORAGE_POINT_FULLY_HARVESTED") == 1;

            if (point.InventoryItems.Count <= 0 && isFullyHarvested)
            {
                string seed = point.GetLocalString("FORAGE_POINT_SEED");
                if (!string.IsNullOrWhiteSpace(seed))
                {
                    _.CreateObject(NWScript.OBJECT_TYPE_ITEM, seed, point.Location);
                }

                point.Destroy();
                _farming.RemoveGrowingPlant(point);
            }
            return(false);
        }