public HarvestSoundTimer( Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked, bool last ) : base( def.EffectSoundDelay )
		{
			m_From = from;
			m_Tool = tool;
			m_System = system;
			m_Definition = def;
			m_ToHarvest = toHarvest;
			m_Locked = locked;
			m_Last = last;
		}
Esempio n. 2
0
        public void Prospect(Mobile from, object toProspect)
        {
            if (!IsChildOf(from.Backpack) && Parent != from)
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
                return;
            }

            HarvestSystem system = Mining.System;

            int     tileID;
            Map     map;
            Point3D loc;

            if (!system.GetHarvestDetails(from, this, toProspect, out tileID, out map, out loc))
            {
                from.SendLocalizedMessage(1049048);                   // You cannot use your prospector tool on that.
                return;
            }

            HarvestDefinition def = system.GetDefinition(tileID);

            if (def == null || def.Veins.Length <= 1)
            {
                from.SendLocalizedMessage(1049048);                   // You cannot use your prospector tool on that.
                return;
            }

            HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

            if (bank == null)
            {
                from.SendLocalizedMessage(1049048);                   // You cannot use your prospector tool on that.
                return;
            }

            HarvestVein vein = bank.Vein, defaultVein = bank.DefaultVein;

            if (vein == null || defaultVein == null)
            {
                from.SendLocalizedMessage(1049048);                   // You cannot use your prospector tool on that.
                return;
            }
            else if (vein != defaultVein)
            {
                from.SendLocalizedMessage(1049049);                   // That ore looks to be prospected already.
                return;
            }

            int veinIndex = Array.IndexOf(def.Veins, vein);

            if (veinIndex < 0)
            {
                from.SendLocalizedMessage(1049048);                   // You cannot use your prospector tool on that.
            }
            else if (veinIndex >= (def.Veins.Length - 1))
            {
                from.SendLocalizedMessage(1049061);                   // You cannot improve valorite ore through prospecting.
            }
            else
            {
                bank.Vein = def.Veins[veinIndex + 1];
                from.SendLocalizedMessage(1049050 + veinIndex);

                --UsesRemaining;

                if (UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049062);                       // You have used up your prospector's tool.
                    Delete();
                }
            }
        }
Esempio n. 3
0
        public void DoMining()
        {
            if (Map == null || Map == Map.Internal)
            {
                return;
            }

            // We may not mine while we are fighting
            if (Combatant != null)
            {
                return;
            }

            HarvestSystem     system = Mining.System;
            HarvestDefinition def    = Mining.System.OreAndStone;

            // Our target is the land tile under us
            Map     map = Map;
            Point3D loc = Location;
            int     x = 0, y = 0;

            GetMiningOffset(Direction, ref x, ref y);
            loc.X += x;
            loc.Y += y;
            int tileId = map.Tiles.GetLandTile(loc.X, loc.Y).ID & 0x3FFF;

            if (!def.Validate(tileId))
            {
                return;
            }

            HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

            if (bank == null || bank.Current < def.ConsumedPerHarvest)
            {
                return;
            }

            HarvestVein vein = bank.Vein;

            if (vein == null)
            {
                return;
            }

            HarvestResource primary  = vein.PrimaryResource;
            HarvestResource fallback = def.Resources[0];

            HarvestResource resource = system.MutateResource(this, null, def, map, loc, vein, primary, fallback);

            double skillBase = Skills[def.Skill].Base;

            Type type = null;

            if (skillBase >= resource.ReqSkill && CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill))
            {
                type = system.GetResourceType(this, null, def, map, loc, resource);

                if (type != null)
                {
                    type = system.MutateType(type, this, null, def, map, loc, resource);
                }

                if (type != null)
                {
                    Item item = system.Construct(type, this, null);

                    if (item == null)
                    {
                        type = null;
                    }
                    else
                    {
                        if (item.Stackable)
                        {
                            int amount        = def.ConsumedPerHarvest;
                            int feluccaAmount = def.ConsumedPerFeluccaHarvest;

                            bool inFelucca = map == Map.Felucca;

                            if (inFelucca)
                            {
                                item.Amount = feluccaAmount;
                            }
                            else
                            {
                                item.Amount = amount;
                            }
                        }

                        bank.Consume(item.Amount, this);

                        item.MoveToWorld(loc, map);

                        system.DoHarvestingEffect(this, def, loc);
                        system.DoHarvestingSound(this, def, null);

                        // Mine for gems
                        BonusHarvestResource bonus = def.GetBonusResource();

                        if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill)
                        {
                            Item bonusItem = system.Construct(bonus.Type, this, null);

                            bonusItem.MoveToWorld(loc, map);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                // Portals - To prevent resource exploitation, creatures can not be carved in a portal.
                Map targetMap = Map.Internal;
                if (targeted is BaseCreature)
                {
                    BaseCreature target = ((BaseCreature)targeted);
                    targetMap = target.Map;
                }
                else if (targeted is Corpse)
                {
                    Corpse target = ((Corpse)targeted);
                    targetMap = target.Map;
                }

                ((ICarvable)targeted).Carve(from, m_Item);
            }

            else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
            {
                SwampDragon pet = (SwampDragon)targeted;

                if (!pet.Controlled || pet.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1053022);                       // You cannot remove barding from a swamp dragon you do not own.
                }
                else
                {
                    pet.HasBarding = false;
                }
            }

            else
            {
                HarvestSystem     system = Lumberjacking.System;
                HarvestDefinition def    = Lumberjacking.System.Definition;

                int     tileID;
                Map     map;
                Point3D loc;

                if (!system.GetHarvestDetails(from, m_Item, targeted, out tileID, out map, out loc))
                {
                    from.SendLocalizedMessage(500494);                       // You can't use a bladed item on that!
                }
                else if (!def.Validate(tileID))
                {
                    from.SendLocalizedMessage(500494);                       // You can't use a bladed item on that!
                }
                else
                {
                    HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

                    if (bank == null)
                    {
                        return;
                    }

                    if (bank.Current < 5)
                    {
                        from.SendLocalizedMessage(500493);                           // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume(5, from);

                        Item item = new Kindling();

                        if (from.PlaceInBackpack(item))
                        {
                            from.SendLocalizedMessage(500491);                               // You put some kindling into your backpack.
                            from.SendLocalizedMessage(500492);                               // An axe would probably get you more wood.
                        }
                        else
                        {
                            from.SendLocalizedMessage(500490);                               // You can't place any kindling into your backpack!

                            item.Delete();
                        }
                    }
                }
            }
        }
Esempio n. 5
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, m_Item);
            }
            else if (targeted is Container)
            {
                Container body = (Container)targeted;

                if (body.ItemID >= 0x4B5A && body.ItemID <= 0x4BAB)
                {
                    body.ItemID = Utility.RandomList(0xECA, 0xECB, 0xECC, 0xECD, 0xECE, 0xECF, 0xED0, 0xED1, 0xED2);
                    body.Hue    = 0;

                    from.CriminalAction(true);
                    Misc.Titles.AwardKarma(from, -50, true);

                    body.DropItem(new BodyPart(0x1D9F));
                    body.DropItem(new BodyPart(0x1DA4));
                    body.DropItem(new BodyPart(0x1DA2));
                    body.DropItem(new BodyPart(0x1DA3));
                    body.DropItem(new BodyPart(0x1DA1));
                    body.DropItem(new BodyPart(0x1DA0));

                    from.SendMessage("You hack up the body into bloody pieces.");
                }
            }
            else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
            {
                SwampDragon pet = (SwampDragon)targeted;

                if (!pet.Controlled || pet.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1053022);                       // You cannot remove barding from a swamp dragon you do not own.
                }
                else
                {
                    pet.HasBarding = false;
                }
            }
            else
            {
                HarvestSystem     system = Lumberjacking.System;
                HarvestDefinition def    = Lumberjacking.System.Definition;

                int     tileID;
                Map     map;
                Point3D loc;

                if (!system.GetHarvestDetails(from, m_Item, targeted, out tileID, out map, out loc))
                {
                    from.SendLocalizedMessage(500494);                       // You can't use a bladed item on that!
                }
                else if (!def.Validate(tileID))
                {
                    from.SendLocalizedMessage(500494);                       // You can't use a bladed item on that!
                }
                else
                {
                    HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

                    if (bank == null)
                    {
                        return;
                    }

                    if (bank.Current < 5)
                    {
                        from.SendMessage("There is not enough here to harvest.");
                        //from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume(5, from);

                        if (tileID == 0x4D96 || tileID == 0x4D9A)                           // apples
                        {
                            Item item = new Apple();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put an apple into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any apples into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4DA6 || tileID == 0x4DAA)                           // pears
                        {
                            Item item = new Pear();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put a pear into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any pears into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4D9E || tileID == 0x4DA2)                           // peaches
                        {
                            Item item = new Peach();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put a peach into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any peaches into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4CDA || tileID == 0x4CDB || tileID == 0x4CDC || tileID == 0x4CDD || tileID == 0x4CDE || tileID == 0x4CDF)                           // acorns
                        {
                            Item item = new Acorn();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put an acorn into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any acorns into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4CA8 || tileID == 0x4CAA || tileID == 0x4CAB)                           // bananas
                        {
                            Item item = new Banana();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put a banana into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any bananas into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4C95)                           // coconut
                        {
                            Item item = new Coconut();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put a coconut into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any coconuts into your backpack!");
                                item.Delete();
                            }
                        }
                        else if (tileID == 0x4C96)                           // dates
                        {
                            Item item = new Dates();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendMessage("You put some dates into your backpack.");
                            }
                            else
                            {
                                from.SendMessage("You can't place any dates into your backpack!");
                                item.Delete();
                            }
                        }
                        else
                        {
                            Item item = new Kindling();

                            if (from.PlaceInBackpack(item))
                            {
                                from.SendLocalizedMessage(500491);                                   // You put some kindling into your backpack.
                                from.SendLocalizedMessage(500492);                                   // An axe would probably get you more wood.
                            }
                            else
                            {
                                from.SendLocalizedMessage(500490);                                   // You can't place any kindling into your backpack!

                                item.Delete();
                            }
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        public bool DoDisposeOre(int x, int y, int z, Map map, Mobile from)
        {
            if (!IsMiningTile(x, y, map))
            {
                this.Say("I can not mine here !");
                m_Mine       = false;
                this.Hue     = 0;
                ControlOrder = OrderType.Follow;
                return(false);
            }

            HarvestBank bank = Mining.System.OreAndStone.GetBank(map, x, y);

            if (bank == null)
            {
                this.Say("I can not mine here !");
                m_Mine       = false;
                this.Hue     = 0;
                ControlOrder = OrderType.Follow;
                return(false);
            }

            if (bank.Current <= 0)
            {
                this.Say("No Ore remains !");
                m_Mine       = false;
                this.Hue     = 0;
                ControlOrder = OrderType.Follow;
                return(false);
            }

            HarvestVein vein = bank.DefaultVein;

            if (vein == null)
            {
                this.Say("I can not mine here !");
                m_Mine       = false;
                this.Hue     = 0;
                ControlOrder = OrderType.Follow;
                return(false);
            }

            HarvestDefinition def = Mining.System.OreAndStone;
            HarvestResource   res = vein.PrimaryResource;
            BaseOre           ore = Mining.System.Construct(res.Types[0], null) as BaseOre;

            if (ore == null)
            {
                this.Say("I can not mine here !");
                m_Mine       = false;
                this.Hue     = 0;
                ControlOrder = OrderType.Follow;
                return(false);
            }

            if (ore.Resource > CraftResource.Iron)
            {
                double minskill  = 0.0;
                double minskill2 = 0.0;
                double maxskill  = 0.0;
                double skillbase = this.Skills.Mining.Base;

                switch (ore.Resource)
                {
                case CraftResource.Iron: { minskill = 00.0; minskill2 = 00.0; maxskill = 100.0; } break;

                case CraftResource.DullCopper: { minskill = 60.0; minskill2 = 25.0; maxskill = 105.0; } break;

                case CraftResource.ShadowIron: { minskill = 65.0; minskill2 = 30.0; maxskill = 110.0; } break;

                case CraftResource.Copper: { minskill = 70.0; minskill2 = 35.0; maxskill = 115.0; } break;

                case CraftResource.Gold: { minskill = 75.0; minskill2 = 40.0; maxskill = 120.0; } break;

                case CraftResource.Agapite: { minskill = 80.0; minskill2 = 45.0; maxskill = 120.0; } break;

                case CraftResource.Verite: { minskill = 85.0; minskill2 = 50.0; maxskill = 120.0; } break;

                case CraftResource.Valorite: { minskill = 90.0; minskill2 = 55.0; maxskill = 120.0; } break;
                }

                if (Utility.RandomDouble() <= 0.30 || skillbase < minskill)
                {
                    ore = new IronOre(); minskill = 00.0; minskill2 = 00.0; maxskill = 100.0;
                }
                if (!(from.CheckSkill(SkillName.Mining, minskill2, maxskill)))
                {
                    ore.Delete();
                    return(false);
                }
            }

            ore.Amount = (map == Map.Felucca ? 2 : 1);
            if (from != null)
            {
                from.AddToBackpack(ore);
            }
            else
            {
                ore.Delete();
            }
            bank.Consume(ore.Amount, this);
            this.Hue = ore.Hue;
            return(true);
        }
Esempio n. 7
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, m_Item);
            }
            else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
            {
                SwampDragon pet = (SwampDragon)targeted;

                if (!pet.Controlled || pet.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1053022);                     // You cannot remove barding from a swamp dragon you do not own.
                }
                else
                {
                    pet.HasBarding = false;
                }
            }
            else
            {
                if (targeted is StaticTarget)
                {
                    int itemID = ((StaticTarget)targeted).ItemID;

                    if (itemID == 0xD15 || itemID == 0xD16)                     // red mushroom
                    {
                        PlayerMobile player = from as PlayerMobile;

                        if (player != null)
                        {
                            QuestSystem qs = player.Quest;

                            if (qs is WitchApprenticeQuest)
                            {
                                FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                                if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms)
                                {
                                    player.SendLocalizedMessage(1055036);                                     // You slice a red cap mushroom from its stem.
                                    obj.Complete();
                                    return;
                                }
                            }
                        }
                    }
                }

                HarvestSystem     system = Lumberjacking.System;
                HarvestDefinition def    = Lumberjacking.System.Definition;


                if (!system.GetHarvestDetails(from, m_Item, targeted, out int tileID, out Map map, out Point3D loc))
                {
                    from.SendLocalizedMessage(500494);                     // You can't use a bladed item on that!
                }
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                if (targeted is Item)
                {
                    Item item = targeted as Item;

                    if (item.IsLockedDown || (item.RootParent is Container && (!item.Movable || !((Container)item.RootParent).LiftOverride)))
                    {
                        from.SendLocalizedMessage(500494); // You can't use a bladed item on that!
                        return;
                    }
                }

                if (((ICarvable)targeted).Carve(from, m_Item) && Siege.SiegeShard)
                {
                    Siege.CheckUsesRemaining(from, m_Item);
                }
            }
            else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding)
            {
                SwampDragon pet = (SwampDragon)targeted;

                if (!pet.Controlled || pet.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1053022); // You cannot remove barding from a swamp dragon you do not own.
                }
                else
                {
                    pet.HasBarding = false;

                    if (Siege.SiegeShard && m_Item is IUsesRemaining)
                    {
                        Siege.CheckUsesRemaining(from, m_Item);
                    }
                }
            }
            else
            {
                if (targeted is StaticTarget)
                {
                    int itemID = ((StaticTarget)targeted).ItemID;

                    if (itemID == 0xD15 || itemID == 0xD16) // red mushroom
                    {
                        PlayerMobile player = from as PlayerMobile;

                        if (player != null)
                        {
                            QuestSystem qs = player.Quest;

                            if (qs is WitchApprenticeQuest)
                            {
                                FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                                if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms)
                                {
                                    player.SendLocalizedMessage(1055036); // You slice a red cap mushroom from its stem.
                                    obj.Complete();

                                    if (Siege.SiegeShard && m_Item is IUsesRemaining)
                                    {
                                        Siege.CheckUsesRemaining(from, m_Item);
                                    }

                                    return;
                                }
                            }
                        }
                    }
                }

                HarvestSystem     system = Lumberjacking.System;
                HarvestDefinition def    = Lumberjacking.System.Definition;

                int     tileID;
                Map     map;
                Point3D loc;

                if (!system.GetHarvestDetails(from, m_Item, targeted, out tileID, out map, out loc))
                {
                    from.SendLocalizedMessage(500494); // You can't use a bladed item on that!
                }
                else if (!def.Validate(tileID))
                {
                    from.SendLocalizedMessage(500494); // You can't use a bladed item on that!
                }
                else
                {
                    HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

                    if (bank == null)
                    {
                        return;
                    }

                    if (bank.Current < 5)
                    {
                        from.SendLocalizedMessage(500493); // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume(5, from);

                        Item item = new Kindling();

                        if (from.PlaceInBackpack(item))
                        {
                            from.SendLocalizedMessage(500491); // You put some kindling into your backpack.
                            from.SendLocalizedMessage(500492); // An axe would probably get you more wood.
                        }
                        else
                        {
                            from.SendLocalizedMessage(500490); // You can't place any kindling into your backpack!

                            item.Delete();
                        }

                        if (Siege.SiegeShard && m_Item is IUsesRemaining)
                        {
                            Siege.CheckUsesRemaining(from, m_Item);
                        }
                    }
                }
            }
        }
        public void Prospect(Mobile from, object toProspect)
        {
            if (!IsChildOf(from.Backpack) && Parent != from)
            {
                from.SendAsciiMessage("That must be in your pack for you to use it.");
                return;
            }

            HarvestSystem system = Mining.System;

            int     tileID;
            Map     map;
            Point3D loc;

            if (!system.GetHarvestDetails(from, this, toProspect, out tileID, out map, out loc))
            {
                from.SendAsciiMessage("You cannot use your prospector tool on that.");                   //
                return;
            }

            HarvestDefinition def = system.GetDefinition(tileID);

            if (def == null || def.Veins.Length <= 1)
            {
                from.SendAsciiMessage("You cannot use your prospector tool on that.");                   //
                return;
            }

            HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

            if (bank == null)
            {
                from.SendAsciiMessage("You cannot use your prospector tool on that.");                   //
                return;
            }

            HarvestVein vein = bank.Vein, defaultVein = bank.DefaultVein;

            if (vein == null || defaultVein == null)
            {
                from.SendAsciiMessage("You cannot use your prospector tool on that.");                   //
                return;
            }
            else if (vein != defaultVein)
            {
                from.SendAsciiMessage("That ore looks to be prospected already.");                   //
                return;
            }

            int veinIndex = Array.IndexOf(def.Veins, vein);

            if (veinIndex < 0)
            {
                from.SendAsciiMessage("You cannot use your prospector tool on that.");                   //
            }
            else if (veinIndex >= (def.Veins.Length - 1))
            {
                from.SendAsciiMessage("You cannot improve valorite ore through prospecting.");                   //
            }
            else
            {
                bank.Vein = def.Veins[veinIndex + 1];
                if (veinIndex == 0)
                {
                    from.SendAsciiMessage("You sift through the ore and find dull copper can be mined there.");
                }
                else if (veinIndex == 1)
                {
                    from.SendAsciiMessage("You sift through the ore and find shadow iron can be mined there.");
                }
                else if (veinIndex == 2)
                {
                    from.SendAsciiMessage("You sift through the ore and find copper ore can be mined there.");
                }
                else if (veinIndex == 3)
                {
                    from.SendAsciiMessage("You sift through the ore and find bronze can be mined there.");
                }
                else if (veinIndex == 4)
                {
                    from.SendAsciiMessage("You sift through the ore and find gold ore can be mined there.");
                }
                else if (veinIndex == 5)
                {
                    from.SendAsciiMessage("You sift through the ore and find agapite can be mined there.");
                }
                else if (veinIndex == 6)
                {
                    from.SendAsciiMessage("You sift through the ore and find verite can be mined there.");
                }
                else if (veinIndex == 7)
                {
                    from.SendAsciiMessage("You sift through the ore and find valorite can be mined there.");
                }
                else
                {
                    from.SendAsciiMessage("bug");
                }

                --UsesRemaining;

                if (UsesRemaining <= 0)
                {
                    from.SendAsciiMessage("You have used up your prospector's tool.");                       //
                    Delete();
                }
            }
        }