示例#1
0
        public override void Spawn(Point3D point, Map map)
        {
            base.Spawn(point, map);

            Type itemType = null;

            switch (Utility.RandomMinMax(1, 1))
            {
            case 1: itemType = typeof(UOACZScavengeFishing); break;
            }

            if (itemType != null)
            {
                UOACZScavengeFishing item = (UOACZScavengeFishing)Activator.CreateInstance(itemType);

                if (item != null)
                {
                    item.m_Spawner = this;

                    item.MoveToWorld(point, map);
                    m_Items.Add(item);
                }
            }
        }
示例#2
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (m_UOACZFishingPole.Deleted || m_UOACZFishingPole.RootParent != from)
                {
                    return;
                }
                if (from == null)
                {
                    return;
                }
                if (from.Deleted || !from.Alive)
                {
                    return;
                }

                PlayerMobile player = from as PlayerMobile;

                if (player == null)
                {
                    return;
                }

                if (!player.CanBeginAction(typeof(UOACZBaseScavengeObject)))
                {
                    player.SendMessage("You must wait a moment before using that.");
                    return;
                }

                IPoint3D targetLocation = target as IPoint3D;

                if (targetLocation == null)
                {
                    return;
                }

                Map map = player.Map;

                if (map == null)
                {
                    return;
                }

                SpellHelper.GetSurfaceTop(ref targetLocation);

                Point3D location = new Point3D(targetLocation);

                UOACZScavengeFishing scavengeFishing = null;

                IPooledEnumerable nearbyItems = map.GetItemsInRange(location, 1);

                foreach (Item item in nearbyItems)
                {
                    if (item is UOACZScavengeFishing)
                    {
                        scavengeFishing = item as UOACZScavengeFishing;
                        break;
                    }
                }

                nearbyItems.Free();

                if (target is UOACZScavengeFishing)
                {
                    scavengeFishing = target as UOACZScavengeFishing;
                }

                if (scavengeFishing != null)
                {
                    if (Utility.GetDistance(player.Location, scavengeFishing.Location) > scavengeFishing.InteractionRange)
                    {
                        from.SendMessage("You are too far away to use that.");
                        return;
                    }

                    int interactionCount = scavengeFishing.GetInteractions(player);

                    if (scavengeFishing.YieldsRemaining == 0 || interactionCount >= scavengeFishing.MaxPlayerInteractions)
                    {
                        player.SendMessage(scavengeFishing.NoYieldRemainingText);
                        return;
                    }

                    scavengeFishing.Interact(player);
                }

                else
                {
                    from.SendMessage("There doesn't appear to be fish there. You should look for water with fish swimming near the surface.");
                    return;
                }
            }