Ejemplo n.º 1
0
            protected override void OnTick()
            {
                ++m_Count;
                if (m_Count < m_MaxCount)
                {
                    new SoundTimer(m_From).Start();
                    if (m_From.Mounted)
                    {
                        m_From.Animate(26, 5, 2, true, false, 0);
                    }
                    else
                    {
                        m_From.Animate(9, 5, 2, true, false, 0);
                    }
                }
                else
                {
                    m_Bank.Consume(Lumberjacking.System.Definition, 5, m_From);

                    Item item = new Kindling();

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

                        item.Delete();
                    }
                }
            }
Ejemplo n.º 2
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, null, def, map, loc);
                        system.DoHarvestingSound(this, null, 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);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
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();
                            }
                        }
                    }
                }

                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(def, 5);

                            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();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public bool DoDisposeLog(int x, int y, int z, Map map, Mobile from)
        {
            HarvestBank bank = Lumberjacking.System.Definition.GetBank(map, x, y);

            if (bank == null)
            {
                this.Say("I can not lumberjack here");
                return(false);
            }
            if (bank.Current <= 0)
            {
                return(false);
            }
            HarvestVein vein = bank.DefaultVein;

            if (vein == null)
            {
                this.Say("I can not mine here");
                return(false);
            }
            HarvestDefinition def = Lumberjacking.System.Definition;
            HarvestResource   res = vein.PrimaryResource;
            Log log = Lumberjacking.System.Construct(res.Types[0], null) as Log;

            if (log == null)
            {
                return(false);
            }
            if (log.Resource > CraftResource.RegularWood)
            {
                double minskill  = 0.0;
                double minskill2 = 0.0;
                double maxskill  = 0.0;
                double skillbase = this.Skills.Lumberjacking.Base;
                if (this.Skills.Lumberjacking.Base < 120.0)
                {
                    this.Say("skill = {0}", Convert.ToString(skillbase));
                }
                switch (log.Resource)
                {
                case CraftResource.RegularWood: { minskill = 00.0; minskill2 = 00.0; maxskill = 100.0; } break;

                case CraftResource.AshTree: { minskill = 55.0; minskill2 = 25.0; maxskill = 105.0; } break;

                case CraftResource.CherryTree: { minskill = 60.0; minskill2 = 30.0; maxskill = 110.0; } break;

                case CraftResource.EbonyTree: { minskill = 65.0; minskill2 = 35.0; maxskill = 115.0; } break;

                case CraftResource.GoldenOakTree: { minskill = 70.0; minskill2 = 40.0; maxskill = 120.0; } break;

                case CraftResource.HickoryTree: { minskill = 75.0; minskill2 = 45.0; maxskill = 120.0; } break;

                case CraftResource.MahoganyTree: { minskill = 80.0; minskill2 = 50.0; maxskill = 120.0; } break;

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

                case CraftResource.PineTree: { minskill = 90.0; minskill2 = 50.0; maxskill = 120.0; } break;

                case CraftResource.RosewoodTree: { minskill = 95.0; minskill2 = 50.0; maxskill = 120.0; } break;

                case CraftResource.WalnutTree: { minskill = 100.0; minskill2 = 50.0; maxskill = 120.0; } break;

                case CraftResource.ElvenTree: { minskill = 100.1; minskill2 = 50.0; maxskill = 120.0; } break;
                }
                if (Utility.RandomDouble() <= 0.30 || skillbase < minskill)
                {
                    log = new Log(); minskill = 00.0; minskill2 = 00.0; maxskill = 100.0;
                }
                if (!(from.CheckSkill(SkillName.Lumberjacking, minskill2, maxskill)))
                {
                    log.Delete();
                    return(false);
                }
            }
            log.Amount = (map == Map.Felucca ? 2 : 1);
            if (from != null)
            {
                from.AddToBackpack(log);
            }
            else
            {
                log.Delete();
            }
            bank.Consume(log.Amount, this);
            this.Hue = log.Hue;

            return(true);
        }
Ejemplo n.º 5
0
        public bool DoDisposeOre(int x, int y, int z, Map map, Mobile from)
        {
            HarvestBank bank = Mining.System.OreAndStone.GetBank(map, x, y);

            if (bank == null)
            {
                this.Say("I can not mine here");
                return(false);
            }
            if (bank.Current <= 0)
            {
                return(false);
            }
            HarvestVein vein = bank.DefaultVein;

            if (vein == null)
            {
                this.Say("I can not mine here");
                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)
            {
                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;
                if (this.Skills.Mining.Base < 120.0)
                {
                    this.Say("skill = {0}", Convert.ToString(skillbase));
                }
                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;

                case CraftResource.Nepturite: { minskill = 114.0; minskill2 = 64.0; maxskill = 120.0; } break;

                case CraftResource.Obsidian: { minskill = 119.0; minskill2 = 69.0; maxskill = 120.0; } break;

                case CraftResource.Mithril: { minskill = 123.0; minskill2 = 74.0; maxskill = 120.0; } break;

                case CraftResource.Xormite: { minskill = 128.0; minskill2 = 78.0; maxskill = 120.0; } break;

                case CraftResource.Dwarven: { minskill = 133.0; minskill2 = 83.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);
        }
Ejemplo 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.MIron)
            {
                double minskill  = 0.0;
                double minskill2 = 0.0;
                double maxskill  = 0.0;
                double skillbase = this.Skills.Mining.Base;

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

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

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

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

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

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

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

                case CraftResource.MValorite: { 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);
        }
Ejemplo 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 ForestWyrm && ((ForestWyrm)targeted).HasBarding)
            {
                ForestWyrm pet = (ForestWyrm)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;
                }
            }
            #region CropSystem
            else if (targeted is Weeds)
            {
                ((Weeds)targeted).Delete();

                from.SendMessage("You slice the roots of the weed and toss them away.");
            }
            else if (targeted is Food && ((Food)targeted).SeedType != null)
            {
                try
                {
                    Food food   = targeted as Food;
                    int  amount = (food.Amount * Utility.RandomMinMax(2, 6));
                    Item seed   = Activator.CreateInstance(food.SeedType, amount) as Item;

                    if (seed != null)
                    {
                        from.AddToBackpack(seed);
                        from.SendMessage(String.Format("You slice open the plant{0} and remove {1} seeds.",
                                                       (food.Amount > 1 ? "s" : ""), (food.Amount > 1 ? "their" : "its")));
                    }

                    food.Delete();
                }
                catch { }
            }
            else if (targeted is Flax)
            {
                int amount = (((Flax)targeted).Amount * Utility.RandomMinMax(2, 6));

                from.AddToBackpack(new FlaxSeed(amount));
                from.SendMessage("You cut off the stalk of the flax and throw it away, keeping the seeds for later use.");

                ((Flax)targeted).Delete();
            }
            else if (targeted is WheatSheaf)
            {
                int amount = (((WheatSheaf)targeted).Amount * Utility.RandomMinMax(3, 8));

                from.AddToBackpack(new WheatSeed(amount));
                from.SendMessage("You split open the wheat and take all the seeds you can find.");

                ((WheatSheaf)targeted).Delete();
            }
            else if (targeted is Rose)
            {
                from.AddToBackpack(new RoseBud(Utility.RandomMinMax(3, 6)));
                from.SendMessage("You break away the petals of the flowers and gently remove the buds.");

                ((Rose)targeted).Delete();
            }
            #endregion
            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();
                        }
                    }
                }
            }
        }
Ejemplo n.º 8
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
            {
                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.GetCurrentFor(from) < 5)
                    {
                        from.SendLocalizedMessage(500493);                           // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume(def, 5);

                        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();
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (this.m_Item.Deleted)
            {
                return;
            }

            if (targeted is ICarvable)
            {
                ((ICarvable)targeted).Carve(from, this.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, this.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();
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        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 Mobile)
                {
                    ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500450, from.NetState); // You can only skin dead creatures.
                    return;
                }
                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.SendMessage("Voce nao pode cortar nada ali"); // You can't use a bladed item on that!
                }
                else if (!def.Validate(tileID))
                {
                    from.SendMessage("Voce nao pode cortar nada ali"); // 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("Nao tem madeira suficiente aqui"); // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume(5, from);

                        Item item = new Kindling();

                        if (from.PlaceInBackpack(item))
                        {
                            from.SendMessage("Voce colocou alguns galhos secos em sua mochila"); // You put some kindling into your backpack.
                        }
                        else
                        {
                            from.SendMessage("Nao cabe mais em sua mochila");  // You can't place any kindling into your backpack!

                            item.Delete();
                        }

                        if (Siege.SiegeShard && m_Item is IUsesRemaining)
                        {
                            Siege.CheckUsesRemaining(from, m_Item);
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
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();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
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 Head)
            {
                Head targ = (Head)targeted;

                if (from.Karma > -1500)
                {
                    from.SendMessage("Vous n'avez pas le profil d'un dépeceur de crâne...");
                    return;
                }

                if (from.Dex <= Utility.Random(110))
                {
                    from.SendMessage("Vous avez été trop maladroit et avez raté le dépeçage");
                    targ.Delete();
                    return;
                }

                from.SendMessage("Vous achevez d'enlever la chair du crâne.");
                from.AddToBackpack(new Skull());
                targ.Consume();
            }
            else if (targeted is Pumpkin)
            {
                Pumpkin targ = (Pumpkin)targeted;

                if (from.Dex <= Utility.Random(100))
                {
                    from.SendMessage("Vous avez été trop maladroit et avez raté votre tracé");
                    targ.Consume();
                    return;
                }

                int karma = 0;

                if (from.Karma > 100)
                {
                    karma++;
                }
                else if (from.Karma < -100)
                {
                    karma--;
                }

                int chance = Utility.Random(4) + karma;

                if (chance >= 2)
                {
                    from.AddToBackpack(new SmileyPumpkin());
                }
                else
                {
                    from.AddToBackpack(new EvilPumpkin());
                }

                from.SendMessage("Vous taillez la citrouille selon votre humeur");
                targ.Consume();
            }
            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;

                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);

                        if (map.Season == (int)ServerSeasons.Season.Spring && Utility.RandomDouble() < 0.33)
                        {
                            from.PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, false, "De la sève se met à couler du tronc, souhaitez-vous la recueillir?", from.NetState);
                            from.BeginTarget(2, false, TargetFlags.None, new TargetCallback(OnSelectTarget));
                            return;
                        }

                        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();
                        }
                    }
                }
            }
        }
Ejemplo n.º 13
0
        public void DoMining()
        {
            if (Map == null || Map == Map.Internal)
            {
                return;
            }

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

            if (this.Backpack.TotalWeight >= this.Backpack.MaxWeight)
            {
                Emote(String.Format("My backpack is full and cannot hold anymore!", Name));

                if (m_MiningTimer != null && m_MiningTimer.Running)
                {
                    m_MiningTimer.Stop();
                    Emote(String.Format("{0} stops mining", Name));
                }
            }

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

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

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

            foreach (StaticTile staticTile in this.GetStaticTilesInRange(map, 0))
            {
                if ((staticTile.ID >= 1339 && staticTile.ID >= 1359) || (staticTile.ID >= 1361 && staticTile.ID >= 1363) ||
                    staticTile.ID == 1386)
                {
                    tileId = staticTile.ID;
                }
            }

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

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

            bool available = (bank != null && bank.Current >= def.ConsumedPerHarvest);

            if (!available)
            {
                Emote(String.Format("There is no metal here to mine"));
                return;
            }

            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 = this.Skills[def.Skill].Base;

            Type type = null;

            if (skillBase >= resource.ReqSkill && this.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);

                        Container pack = this.Backpack;

                        if (pack == null)
                        {
                            return;
                        }

                        this.Hue = item.Hue;

                        pack.DropItem(item);

                        if (item.ItemID == 6583)
                        {
                            item.Delete();
                        }
                        else
                        {
                            Smelt(item);
                        }

                        // item.MoveToWorld(loc, map);

                        system.DoHarvestingEffect(this, null, def, map, loc);
                        system.DoHarvestingSound(this, null, 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);

                            //item.MoveToWorld(loc, map);
                            //pack.DropItem( bonusItem );
                            pack.TryDropItem(this, bonusItem, false);
                        }
                    }
                }
            }
        }