Esempio n. 1
0
        public static void OnHarvest(Mobile from, Item tool, HarvestSystem system, Item resource)
        {
            if (IsCaddellite(from, tool))
            {
                if (resource != null)
                {
                    resource.AttachSocket(new Caddellite());
                }

                if (0.005 > Utility.RandomDouble())
                {
                    if (from != null)
                    {
                        if (system == Fishing.System)
                        {
                            from.SendLocalizedMessage(1158664); // You discover a meteorite entangled in your line!
                        }
                        else if (system == Mining.System)
                        {
                            from.SendLocalizedMessage(1158663); // You discover a meteorite in the dirt!
                        }
                        else if (system == Lumberjacking.System)
                        {
                            from.SendLocalizedMessage(1158665); // You discover a meteorite in the tree!
                        }

                        from.AddToBackpack(new Meteorite());
                    }
                }
            }
        }
Esempio n. 2
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!Sphere.CanUse(from, this))
            {
                return;
            }

            base.OnDoubleClick(from);

            from.SendLocalizedMessage(1010018); // What do you want to use this item on?

            if (HarvestSystem == null)
            {
                return;
            }
            else
            {
                from.Target = new BladedItemTarget(this);
            }

            if (IsChildOf(from.Backpack) || Parent == from)
            {
                HarvestSystem.BeginHarvesting(from, this);
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
Esempio n. 3
0
        public override void OnDoubleClick(Mobile from)
        {
            //equip before using
            base.OnDoubleClick(from);
            if (HarvestSystem == null || Deleted)
            {
                return;
            }

            Point3D loc = GetWorldLocation();

            if (!from.InLOS(loc) || !from.InRange(loc, 2))
            {
                from.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3E9, 1019045);                   // I can't reach that
                return;
            }
            else if (!this.IsAccessibleTo(from))
            {
                this.PublicOverheadMessage(MessageType.Regular, 0x3E9, 1061637);                   // You are not allowed to access this.
                return;
            }

            if (!(this.HarvestSystem is Mining))
            {
                from.SendLocalizedMessage(1010018);                   // What do you want to use this item on?
            }
            HarvestSystem.BeginHarvesting(from, this);
        }
Esempio n. 4
0
 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;
 }
		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. 6
0
        public virtual void LockPick(Mobile from)
        {
            Locked = false;
            Picker = from;

            HarvestSystem.LogHarvest(from, this.GetType());

            if (this.TrapOnLockpick && ExecuteTrap(from))
            {
                this.TrapOnLockpick = false;
            }
        }
Esempio n. 7
0
        public void Carve(Mobile from, Item item)
        {
            if (DateTime.UtcNow < m_NextWoolTime)
            {
                // This sheep is not yet ready to be shorn.
                PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500449, from.NetState);
                return;
            }

            from.SendLocalizedMessage(500452);               // You place the gathered wool into your backpack.
            from.AddToBackpack(new Wool(/*Map == Map.Felucca ?*/ 2 /*: 1*/));
            HarvestSystem.LogHarvest(from, typeof(Wool));
            NextWoolTime = DateTime.UtcNow + TimeSpan.FromHours(3.0);               // TODO: Proper time delay
        }
 public override void OnDoubleClick(Mobile from)
 {
     if (HarvestSystem == null)
     {
         return;
     }
     if (IsChildOf(from.Backpack) || Parent == from)
     {
         HarvestSystem.BeginHarvesting(from, this);
     }
     else
     {
         from.SendLocalizedMessage(1042001);
     }
 }
Esempio n. 9
0
        public override void OnDoubleClick(Mobile from)
        {
            if (HarvestSystem == null)
            {
                return;
            }

            if (IsChildOf(from.Backpack) || Parent == from)
            {
                HarvestSystem.BeginHarvesting(from, this);
            }
            else
            {
                from.SendAsciiMessage("That must be in your pack for you to use it.");                   // That must be in your pack for you to use it.
            }
        }
Esempio n. 10
0
        public static int CheckHarvest(Mobile from, Type type, HarvestSystem system)
        {
            if (system != Lumberjacking.System)
            {
                return(0);
            }

            CraftResource     res      = CraftResources.GetFromType(type);
            WoodsmansTalisman talisman = from.FindItemOnLayer(Layer.Talisman) as WoodsmansTalisman;

            if (talisman != null && talisman.UsesRemaining > 0 && res == talisman.Resource)
            {
                talisman.UsesRemaining--;
                from.SendLocalizedMessage(1152625); // The magic of your talisman guides your hands as you cut the wood.
                return(Utility.RandomMinMax(2, 5));
            }

            return(0);
        }
Esempio n. 11
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            if (HarvestSystem == null)
            {
                return;
            }

            double check = Utility.RandomDouble();

            if (IsChildOf(from.Backpack) || Parent == from)
            {
                HarvestSystem.BeginHarvesting(from, this);
            }
            else
            {
                from.SendAsciiMessage("That must be in your pack for you to use it.");
            }
        }
Esempio n. 12
0
        public override void OnDoubleClick(Mobile from)
        {
            if (HarvestSystem == null)
            {
                return;
            }

            Point3D loc = GetWorldLocation();

            if (!from.InLOS(loc) || !from.InRange(loc, 2))
            {
                from.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3E9, 1019045);                   // I can't reach that
                return;
            }

            if (!(HarvestSystem is Mining))
            {
                from.SendLocalizedMessage(1010018);                   // What do you want to use this item on?
            }
            HarvestSystem.BeginHarvesting(from, this);
        }
Esempio n. 13
0
        public override void OnDoubleClick(Mobile from)
        {
            if (HarvestSystem == null)
            {
                return;
            }

            if (IsChildOf(from.Backpack) || Parent == from)
            {
                if (UsesRemaining > 0)
                {
                    HarvestSystem.BeginHarvesting(from, this);
                }
                else
                {
                    from.SendLocalizedMessage(1072306); // You must wait a moment for it to recharge.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
Esempio n. 14
0
        public override void OnDoubleClick(Mobile from)
        {
            // Scriptiz : gestion du double clic pour équipper un objet
            if (from.FindItemOnLayer(this.Layer) != this)
            {
                base.OnDoubleClick(from);
                return;
            }

            if (HarvestSystem == null)
            {
                return;
            }

            if (IsChildOf(from.Backpack) || Parent == from)
            {
                HarvestSystem.BeginHarvesting(from, this);
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
Esempio n. 15
0
        public static void AddContextMenuEntries(Mobile from, Item item, List <ContextMenuEntry> list, HarvestSystem system)
        {
            if (system != Mining.System)
            {
                return;
            }

            if (!item.IsChildOf(from.Backpack) && item.Parent != from)
            {
                return;
            }

            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            ContextMenuEntry miningEntry = new ContextMenuEntry(pm.ToggleMiningStone ? 6179 : 6178);

            miningEntry.Color = 0x421F;
            list.Add(miningEntry);

            list.Add(new ToggleMiningStoneEntry(pm, false, 6176));
            list.Add(new ToggleMiningStoneEntry(pm, true, 6177));
        }
Esempio n. 16
0
        public static void AddContextMenuEntries(Mobile from, Item item, List <ContextMenuEntry> list, HarvestSystem system)
        {
            if (system != Mining.System)
            {
                return;
            }

            if (!item.IsChildOf(from.Backpack) && item.Parent != from)
            {
                return;
            }

            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            int typeentry = 0;

            if (pm.ToggleMiningStone)
            {
                typeentry = 6179;
            }
            if (pm.ToggleMiningGem)
            {
                typeentry = 1112239;
            }
            if (pm.ToggleStoneOnly)
            {
                typeentry = 1156865;
            }
            if (!pm.ToggleMiningStone && !pm.ToggleMiningGem && !pm.ToggleStoneOnly)
            {
                typeentry = 6178;
            }

            ContextMenuEntry miningEntry = new ContextMenuEntry(typeentry);

            miningEntry.Color = 0x421F;
            list.Add(miningEntry);

            list.Add(new ToggleMiningStoneEntry(pm, MiningType.OreOnly, 6176));         // Set To Ore
            list.Add(new ToggleMiningStoneEntry(pm, MiningType.OreAndStone, 6177));     // Set To Ore and Stone
            list.Add(new ToggleMiningStoneEntry(pm, MiningType.OreAndGems, 1112237));   // Set To Ore and Gems
            list.Add(new ToggleMiningStoneEntry(pm, MiningType.StoneOnly, 1156864));    // Set To Stone
        }
Esempio n. 17
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);
                        }
                    }
                }
            }
        }
Esempio n. 18
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();
                        }
                    }
                }
            }
        }
Esempio n. 19
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. 20
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 = Lumberjacking.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))
            {
                if (veinIndex >= (def.Veins.Length - 1))
                {
                    from.SendMessage("You cannot improve frostwood through prospecting.");
                }
                else
                {
                    bank.Vein = def.Veins[veinIndex + 1];
                    switch (veinIndex)
                    {
                    case 0: from.SendMessage("You sift through the tree and find oak wood can be lumberjacked there"); break;                              //Pine

                    case 1: from.SendMessage("You sift through the tree and find ash wood can be lumberjacked there"); break;                              //Ash

                    case 2: from.SendMessage("You sift through the tree and find yew wood can be lumberjacked there"); break;                              //Mohogany

                    case 3: from.SendMessage("You sift through the tree and find heartwood wood can be lumberjacked there"); break;                        //Yew

                    case 4: from.SendMessage("You sift through the tree and find bloodwood can be lumberjacked there"); break;                             //Oak

                    case 5: from.SendMessage("You sift through the tree and find frostwood wood can be lumberjacked there"); break;                        //Zircote
                    }

                    --UsesRemaining;

                    if (UsesRemaining <= 0)
                    {
                        from.SendLocalizedMessage(1049062);                           // You have used up your prospector's tool.
                        Delete();
                    }
                }
            }
        }
Esempio n. 21
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();
                        }
                    }
                }
            }
        }
        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.
                from.SendMessage("You cannot improve Sunstone ore through prospecting.");
            }
            else
            {
                bank.Vein = def.Veins[veinIndex + 1];
                //from.SendLocalizedMessage( 1049050 + veinIndex );
                switch (veinIndex)
                {
                case 0: from.SendLocalizedMessage(1049050); break;                           // dull copper

                case 1: from.SendLocalizedMessage(1049051); break;                           // shadow iron

                case 2: from.SendLocalizedMessage(1049052); break;                           // copper

                case 3: from.SendLocalizedMessage(1049053); break;                           // bronze

                case 4: from.SendLocalizedMessage(1049054); break;                           // gold

                case 5: from.SendLocalizedMessage(1049055); break;                           // agapite

                case 6: from.SendLocalizedMessage(1049056); break;                           // verite

                case 7: from.SendLocalizedMessage(1049057); break;                           // valorite

                //case 8: from.SendMessage ( "You sift through the ore and find platinum ore can be mined there!" ); break;
                //case 9: from.SendMessage ( "You sift through the ore and find that mythril ore can be mined there!" ); break;
                case 8: from.SendMessage("You sift through the ore and find silver ore can be mined there!"); break;

                //case 11: from.SendMessage ( "You sift through the ore and find that obsidian ore can be mined there!" ); break;
                case 9: from.SendMessage("You sift through the ore and find that jade ore can be mined there!"); break;

                case 10: from.SendMessage("You sift through the ore and find that moonstone ore can be mined there!"); break;

                case 11: from.SendMessage("You sift through the ore and find that sunstone ore can be mined there!"); break;
                    //case 15: from.SendMessage ( "You sift through the ore and find that bloodstone ore can be mined there!" ); break;
                }
                --UsesRemaining;

                if (UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049062);                       // You have used up your prospector's tool.
                    Delete();
                }
            }
        }
Esempio n. 23
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);
                        }
                    }
                }
            }
        }
        public void Prospect(Mobile from, object toProspect)
        {
            if (!this.IsChildOf(from.Backpack) && this.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;
            }
            //daat99 OWLTR start - prospected sticks
            else if (vein != defaultVein || (OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.DAAT99_MINING) && (bank.Vein).IsProspected))
            //daat99 OWLTR end - prospected sticks
            {
                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.
            }
            //daat99 OWLTR start - prospecting
            else if (!OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.DAAT99_MINING))
            {
                if (veinIndex >= (def.Veins.Length - 1))
                {
                    from.SendMessage("You cannot improve Platinum ore through prospecting.");                       // You cannot improve valorite ore through prospecting.
                }
                else
                {
                    bank.Vein = def.Veins[veinIndex + 1];
                    //from.SendLocalizedMessage( 1049050 + veinIndex );
                    switch (veinIndex)
                    {
                    case 0: from.SendLocalizedMessage(1049050); break;                              //Dull Copper

                    case 1: from.SendLocalizedMessage(1049051); break;                              //Shadow Iron

                    case 2: from.SendLocalizedMessage(1049052); break;                              //Copper

                    case 3: from.SendLocalizedMessage(1049053); break;                              //Bronze

                    case 4: from.SendLocalizedMessage(1049054); break;                              //Gold

                    case 5: from.SendLocalizedMessage(1049055); break;                              //Agapite

                    case 6: from.SendLocalizedMessage(1049056); break;                              //Verite

                    case 7: from.SendLocalizedMessage(1049057); break;                              //Valorite

                    case 8: from.SendMessage("You sift through the ore and find blaze ore can be mined there"); break;

                    case 9: from.SendMessage("You sift through the ore and find ice ore can be mined there"); break;

                    case 10: from.SendMessage("You sift through the ore and find toxic ore can be mined there"); break;

                    case 11: from.SendMessage("You sift through the ore and find electrum ore can be mined there"); break;

                    case 12: from.SendMessage("You sift through the ore and find platinum ore can be mined there"); break;
                    }

                    --this.UsesRemaining;

                    if (this.UsesRemaining <= 0)
                    {
                        from.SendLocalizedMessage(1049062); // You have used up your prospector's tool.
                        this.Delete();
                    }
                }
            }
            else
            {
                (bank.Vein).IsProspected = true;
                from.SendMessage("You sift through the ore increasing your chances to find better ores");
                //daat99 OWLTR end - prospecting

                --UsesRemaining;
                if (UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049062);                       // You have used up your prospector's tool.
                    Delete();
                }
            }
        }
Esempio n. 25
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);
                        }
                    }
                }
            }
        }
        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 = Lumberjacking.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 || (OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.DAAT99_LUMBERJACKING) && (bank.Vein).IsProspected))
            {
                from.SendMessage("That tree looks to be prospected already");                   // 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 (!OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.DAAT99_LUMBERJACKING))
            {
                if (veinIndex >= (def.Veins.Length - 1))
                {
                    from.SendMessage("You cannot improve petrefied wood through prospecting.");
                }
                else
                {
                    bank.Vein = def.Veins[veinIndex + 1];
                    switch (veinIndex)
                    {
                    case 0: from.SendMessage("You sift through the tree and find oak wood can be lumberjacked there"); break;                              //Pine

                    case 1: from.SendMessage("You sift through the tree and find ash wood can be lumberjacked there"); break;                              //Ash

                    case 2: from.SendMessage("You sift through the tree and find yew wood can be lumberjacked there"); break;                              //Mohogany

                    case 3: from.SendMessage("You sift through the tree and find heartwood wood can be lumberjacked there"); break;                        //Yew

                    case 4: from.SendMessage("You sift through the tree and find bloodwood can be lumberjacked there"); break;                             //Oak

                    case 5: from.SendMessage("You sift through the tree and find frostwood wood can be lumberjacked there"); break;                        //Zircote

                    case 6: from.SendMessage("You sift through the tree and find ebony wood can be lumberjacked there"); break;                            //Ebony

                    case 7: from.SendMessage("You sift through the tree and find bamboo wood can be lumberjacked there"); break;                           //Bamboo

                    case 8: from.SendMessage("You sift through the tree and find purpleheart wood can be lumberjacked there"); break;                      //Purple Heart

                    case 9: from.SendMessage("You sift through the tree and find redwood wood can be lumberjacked there"); break;                          //Redwood

                    case 10: from.SendMessage("You sift through the tree and find petrified wood can be lumberjacked there"); break;                       //Petrified
                    }

                    --UsesRemaining;

                    if (UsesRemaining <= 0)
                    {
                        from.SendLocalizedMessage(1049062);                           // You have used up your prospector's tool.
                        Delete();
                    }
                }
            }
            else
            {
                (bank.Vein).IsProspected = true;
                from.SendMessage("You sift through the tree increasing your chances to find better woods");
                --UsesRemaining;
                if (UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049062);                       // You have used up your prospector's tool.
                    Delete();
                }
            }
        }
Esempio n. 27
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();
                        }
                    }
                }
            }
        }
Esempio n. 28
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();
                            }
                        }
                    }
                }
            }
        }
Esempio n. 29
0
        protected virtual int GetProgress(ConquestState state, Item item, CraftResource res, HarvestSystem harvest)
        {
            if (item == null || harvest == null)
            {
                return(0);
            }

            if (state.User == null)
            {
                return(0);
            }

            if (ItemType.IsNotNull && !item.TypeEquals(ItemType, ItemChildren))
            {
                if (ItemChangeReset)
                {
                    return(-state.Progress);
                }

                return(0);
            }

            if (Resource != CraftResource.None && res != Resource)
            {
                return(0);
            }

            if (HarvestSystem.IsNotNull && !harvest.TypeEquals(HarvestSystem, false))
            {
                return(0);
            }

            return(item.Amount);
        }
Esempio n. 30
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();
                        }
                    }
                }
            }
        }
Esempio n. 31
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();
                            }
                        }
                    }
                }
            }
        }