public override void Spawn(Point3D point, Map map)
        {
            base.Spawn(point, map);

            Type itemType = null;

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

            if (itemType != null)
            {
                UOACZScavengeOre item = (UOACZScavengeOre)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_UOACZPickaxe.Deleted || m_UOACZPickaxe.RootParent != from)
                {
                    return;
                }
                PlayerMobile player = from as PlayerMobile;

                if (!UOACZSystem.IsUOACZValidMobile(player))
                {
                    return;
                }
                if (!player.IsUOACZHuman)
                {
                    return;
                }

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

                Item oneHand    = from.FindItemOnLayer(Layer.OneHanded);
                Item firstValid = from.FindItemOnLayer(Layer.FirstValid);

                if (!(oneHand == m_UOACZPickaxe || firstValid == m_UOACZPickaxe))
                {
                    from.SendMessage("You must equip this pickaxe in order to use it.");
                    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);

                UOACZScavengeOre scavengeOre = null;

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

                foreach (Item item in nearbyItems)
                {
                    if (item is UOACZScavengeOre)
                    {
                        scavengeOre = item as UOACZScavengeOre;
                        break;
                    }
                }

                nearbyItems.Free();

                if (target is UOACZScavengeOre)
                {
                    scavengeOre = target as UOACZScavengeOre;
                }

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

                    int interactionCount = scavengeOre.GetInteractions(player);

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

                    scavengeOre.Interact(player);
                }

                else
                {
                    from.SendMessage("The earth here is brittle and you must target a large ore formation in order to mine any significant amounts of ore.");
                    return;
                }
            }