示例#1
0
        public void Consume(HarvestDefinition def, int amount, Mobile from)
        {
            CheckRespawn();

            if (m_Current == m_Maximum)
            {
                double min = def.MinRespawn.TotalMinutes;
                double max = def.MaxRespawn.TotalMinutes;
                double rnd = Utility.RandomDouble();

                m_Current = m_Maximum - amount;

                double minutes = min + (rnd * (max - min));
                if (def.RaceBonus && from.Race == Race.Elf)	//def.RaceBonus = Core.ML
                    minutes *= .75;	//25% off the time.  

                m_NextRespawn = DateTime.Now + TimeSpan.FromMinutes(minutes);
            }
            else
            {
                m_Current -= amount;
            }

            if (m_Current < 0)
                m_Current = 0;
        }
示例#2
0
 public HarvestBank( HarvestDefinition def, HarvestVein defaultVein )
 {
     m_Maximum = Utility.RandomMinMax( def.MinTotal, def.MaxTotal );
     m_Current = m_Maximum;
     m_DefaultVein = defaultVein;
     m_Vein = m_DefaultVein;
 }
示例#3
0
		public virtual bool CheckRange( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, bool timed )
		{
			bool inRange = ( from.Map == map && from.InRange( loc, def.MaxRange ) );

			if ( !inRange )
				def.SendMessageTo( from, timed ? def.TimedOutOfRangeMessage : def.OutOfRangeMessage );

			return inRange;
		}
示例#4
0
		private Fishing()
		{
			#region Fishing
			var fish = new HarvestDefinition
			{
				// Resource banks are every 8x8 tiles
				BankWidth = 8,
				BankHeight = 8,
				// Every bank holds from 5 to 15 fish
				MinTotal = 5,
				MaxTotal = 15,
				// A resource bank will respawn its content every 15 to 25 minutes
				MinRespawn = TimeSpan.FromMinutes(15.0),
				MaxRespawn = TimeSpan.FromMinutes(25.0),
				// Skill checking is done on the Fishing skill
				Skill = SkillName.Fishing,
				// Set the list of harvestable tiles
				Tiles = m_WaterTiles,
				// Players must be within N tiles to harvest
				RangedTiles = true,
				MaxRange = 3,
				// One fish per harvest action
				ConsumedPerHarvest = 1,
				ConsumedPerFeluccaHarvest = 1,
				// The fishing
				EffectActions = new[] {12},
				EffectSounds = new int[0],
				EffectCounts = new[] {1},
				EffectDelay = TimeSpan.Zero,
				EffectSoundDelay = TimeSpan.FromSeconds(8.0),
				NoResourcesMessage = 503172,
				FailMessage = 503171,
				TimedOutOfRangeMessage = 500976,
				OutOfRangeMessage = 500976,
				PackFullMessage = 503176,
				ToolBrokeMessage = 503174
			};

			var res = new[] {new HarvestResource(Expansion.None, 00.0, 00.0, 120.0, 1043297, typeof(Fish))};

			var veins = new[] {new HarvestVein(Expansion.None, 120.0, 0.0, res[0], null)};

			fish.Resources = res;
			fish.Veins = veins;

			fish.PlaceAtFeetIfFull = true;

			fish.BonusResources = new[]
			{
				new BonusHarvestResource(Expansion.ML, 0, 99.4, null, null), //set to same chance as mining ml gems
				new BonusHarvestResource(Expansion.ML, 80.0, 0.6, 1072597, typeof(WhitePearl))
			};

			Fish = fish;
			Definitions.Add(Fish);
			#endregion
		}
示例#5
0
		public HarvestTimer( Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked ) : base( TimeSpan.Zero, def.EffectDelay )
		{
			m_From = from;
			m_Tool = tool;
			m_System = system;
			m_Definition = def;
			m_ToHarvest = toHarvest;
			m_Locked = locked;
			m_Count = Utility.RandomList( def.EffectCounts );
		}
示例#6
0
		public virtual bool CheckResources( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, bool timed )
		{
			HarvestBank bank = def.GetBank( map, loc.X, loc.Y );
			bool available = ( bank != null && bank.Current >= def.ConsumedPerHarvest );

			if ( !available )
				def.SendMessageTo( from, timed ? def.DoubleHarvestMessage : def.NoResourcesMessage );

			return available;
		}
示例#7
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;
		}
示例#8
0
        public HarvestBank( HarvestDefinition def, HarvestVein defaultVein, double chanceToFallback )
        {
            m_Maximum = Utility.RandomMinMax( def.MinTotal, def.MaxTotal );
            m_Current = m_Maximum;
            m_DefaultVein = defaultVein;
            m_Vein = m_DefaultVein;
            m_ChanceToFallback = chanceToFallback;

            m_Definition = def;
        }
示例#9
0
 public virtual object GetLock(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
 {
     /* Here we prevent multiple harvesting.
     * 
     * Some options:
     *  - 'return tool;' : This will allow the player to harvest more than once concurrently, but only if they use multiple tools. This seems to be as OSI.
     *  - 'return GetType();' : This will disallow multiple harvesting of the same type. That is, we couldn't mine more than once concurrently, but we could be both mining and lumberjacking.
     *  - 'return typeof( HarvestSystem );' : This will completely restrict concurrent harvesting.
     */
     return tool;
 }
示例#10
0
        public HarvestTimer(Mobile from, Item tool, HarvestSystem system, HarvestDefinition def, object toHarvest, object locked)
            : base(TimeSpan.Zero, def.EffectDelay)
        {
            m_From = from;
            m_Tool = tool;
            m_System = system;
            m_Definition = def;
            m_ToHarvest = toHarvest;
            m_Locked = locked;
            //m_Count = Utility.RandomList( def.EffectCounts );
            m_Count = 1 + Utility.Random(1, 5);

            //Update the action
            if (from is PlayerMobile)
                ((PlayerMobile)from).ResetPlayerAction(this);
        }
示例#11
0
        public void Consume( HarvestDefinition def, int amount )
        {
            CheckRespawn();

            if ( m_Current == m_Maximum )
            {
                int min = (int)def.MinRespawn.TotalSeconds;
                int max = (int)def.MaxRespawn.TotalSeconds;

                m_Current = m_Maximum - amount;
                m_NextRespawn = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( min, max ) );
            }
            else
            {
                m_Current -= amount;
            }

            if ( m_Current < 0 )
                m_Current = 0;
        }
示例#12
0
		public void Consume( HarvestDefinition def, int amount )
		{
			CheckRespawn();

			if ( m_Current == m_Maximum )
			{
				double min = def.MinRespawn.TotalMinutes;
				double max = def.MaxRespawn.TotalMinutes;
				double rnd = Utility.RandomDouble();

				m_Current = m_Maximum - amount;
				m_NextRespawn = DateTime.Now + TimeSpan.FromMinutes( min + (rnd * (max - min)) );
			}
			else
			{
				m_Current -= amount;
			}

			if ( m_Current < 0 )
				m_Current = 0;
		}
		public override void OnHarvestFinished( Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested)
		{
/* include this part for rare extras
			// modded by greywolf for random items coming in

			double skillvaluelj = killerguy.Skills[SkillName.Magery].Base;
			int i_itemid = (int)(killerguy.Skills[SkillName.ItemID].Base/10);

			if ((Utility.RandomMinMax( 1, 1500 ) <= (1 + i_itemid)) && (skillvaluelj >= 70.1))
			{
				switch (Utility.RandomMinMax( 0, 10 ))
				{
					case 1 : default:  from.AddToBackpack(new Kindling()); from.SendMessage ("you find something wedged in the tree, a weird peice of wood ");break;
					case 2 : from.AddToBackpack(new BarkFragment()); from.SendMessage ("you find something wedged in the tree, a peice of bark ");break;
					case 3 : from.AddToBackpack(new LuminescentFungi()); from.SendMessage ("you find something wedged in the tree, some fungi ");break;
					case 4 : from.AddToBackpack(new ParasiticPlant()); from.SendMessage ("you find something wedged in the tree, a weird looking plant");break;
					case 5 : from.AddToBackpack(new DiseasedBark()); from.SendMessage ("you find something wedged in the tree, some weird looking bark ");break;
				}
			}
*/
		}
示例#14
0
		public virtual HarvestResource MutateResource( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, HarvestVein vein, HarvestResource primary, HarvestResource fallback )
		{
			bool racialBonus = (def.RaceBonus && from.Race == Race.Elf );

			if( vein.ChanceToFallback > (Utility.RandomDouble() + (racialBonus ? .20 : 0)) )
				return fallback;

			double skillValue = from.Skills[def.Skill].Value;

			if ( fallback != null && (skillValue < primary.ReqSkill || skillValue < primary.MinSkill) )
				return fallback;

			return primary;
		}
示例#15
0
		public virtual Type MutateType( Type type, Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, HarvestResource resource )
		{
			return from.Region.GetResource( type );
		}
示例#16
0
		public virtual HarvestVein MutateVein( Mobile from, Item tool, HarvestDefinition def, HarvestBank bank, object toHarvest, HarvestVein vein )
		{
			return vein;
		}
示例#17
0
        private Mining()
        {
            HarvestResource[] res;
            HarvestVein[]     veins;

            #region Mining for ore and stone
            HarvestDefinition oreAndStone = this.m_OreAndStone = new HarvestDefinition();

            // Resource banks are every 8x8 tiles
            oreAndStone.BankWidth  = 8;
            oreAndStone.BankHeight = 8;

            // Every bank holds from 10 to 34 ore
            oreAndStone.MinTotal = 10;
            oreAndStone.MaxTotal = 34;

            // A resource bank will respawn its content every 10 to 20 minutes
            oreAndStone.MinRespawn = TimeSpan.FromMinutes(10.0);
            oreAndStone.MaxRespawn = TimeSpan.FromMinutes(20.0);

            // Skill checking is done on the Mining skill
            oreAndStone.Skill = SkillName.Mining;

            // Set the list of harvestable tiles
            oreAndStone.Tiles = m_MountainAndCaveTiles;

            // Players must be within 2 tiles to harvest
            oreAndStone.MaxRange = 2;

            // One ore per harvest action
            oreAndStone.ConsumedPerHarvest        = 1;
            oreAndStone.ConsumedPerFeluccaHarvest = 2;

            // The digging effect
            oreAndStone.EffectActions    = new int[] { Core.SA ? 3 : 11 };
            oreAndStone.EffectSounds     = new int[] { 0x125, 0x126 };
            oreAndStone.EffectCounts     = new int[] { 1 };
            oreAndStone.EffectDelay      = TimeSpan.FromSeconds(1.6);
            oreAndStone.EffectSoundDelay = TimeSpan.FromSeconds(0.9);

            oreAndStone.NoResourcesMessage     = 503040;  // There is no metal here to mine.
            oreAndStone.DoubleHarvestMessage   = 503042;  // Someone has gotten to the metal before you.
            oreAndStone.TimedOutOfRangeMessage = 503041;  // You have moved too far away to continue mining.
            oreAndStone.OutOfRangeMessage      = 500446;  // That is too far away.
            oreAndStone.FailMessage            = 503043;  // You loosen some rocks but fail to find any useable ore.
            oreAndStone.PackFullMessage        = 1010481; // Your backpack is full, so the ore you mined is lost.
            oreAndStone.ToolBrokeMessage       = 1044038; // You have worn out your tool!

            res = new HarvestResource[]
            {
                new HarvestResource(00.0, 00.0, 100.0, 1007072, typeof(IronOre), typeof(Granite)),
                new HarvestResource(65.0, 25.0, 105.0, 1007073, typeof(DullCopperOre), typeof(DullCopperGranite), typeof(DullCopperElemental)),
                new HarvestResource(70.0, 30.0, 110.0, 1007074, typeof(ShadowIronOre), typeof(ShadowIronGranite), typeof(ShadowIronElemental)),
                new HarvestResource(75.0, 35.0, 115.0, 1007075, typeof(CopperOre), typeof(CopperGranite), typeof(CopperElemental)),
                new HarvestResource(80.0, 40.0, 120.0, 1007076, typeof(BronzeOre), typeof(BronzeGranite), typeof(BronzeElemental)),
                new HarvestResource(85.0, 45.0, 125.0, 1007077, typeof(GoldOre), typeof(GoldGranite), typeof(GoldenElemental)),
                new HarvestResource(90.0, 50.0, 130.0, 1007078, typeof(AgapiteOre), typeof(AgapiteGranite), typeof(AgapiteElemental)),
                new HarvestResource(95.0, 55.0, 135.0, 1007079, typeof(VeriteOre), typeof(VeriteGranite), typeof(VeriteElemental)),
                new HarvestResource(99.0, 59.0, 139.0, 1007080, typeof(ValoriteOre), typeof(ValoriteGranite), typeof(ValoriteElemental))
            };

            veins = new HarvestVein[]
            {
                new HarvestVein(49.6, 0.0, res[0], null),   // Iron
                new HarvestVein(11.2, 0.5, res[1], res[0]), // Dull Copper
                new HarvestVein(09.8, 0.5, res[2], res[0]), // Shadow Iron
                new HarvestVein(08.4, 0.5, res[3], res[0]), // Copper
                new HarvestVein(07.0, 0.5, res[4], res[0]), // Bronze
                new HarvestVein(05.6, 0.5, res[5], res[0]), // Gold
                new HarvestVein(04.2, 0.5, res[6], res[0]), // Agapite
                new HarvestVein(02.8, 0.5, res[7], res[0]), // Verite
                new HarvestVein(01.4, 0.5, res[8], res[0])  // Valorite
            };

            oreAndStone.Resources = res;
            oreAndStone.Veins     = veins;

            if (Core.ML)
            {
                oreAndStone.BonusResources = new BonusHarvestResource[]
                {
                    new BonusHarvestResource(0, 99.2, null, null), //Nothing
                    new BonusHarvestResource(100, .1, 1072562, typeof(BlueDiamond)),
                    new BonusHarvestResource(100, .1, 1072567, typeof(DarkSapphire)),
                    new BonusHarvestResource(100, .1, 1072570, typeof(EcruCitrine)),
                    new BonusHarvestResource(100, .1, 1072564, typeof(FireRuby)),
                    new BonusHarvestResource(100, .1, 1072566, typeof(PerfectEmerald)),
                    new BonusHarvestResource(100, .1, 1072568, typeof(Turquoise)),
                    new BonusHarvestResource(100, .1, 1077180, typeof(SmallPieceofBlackrock)),
                    new BonusHarvestResource(100, .1, 1113344, typeof(CrystallineBlackrock), Map.TerMur)
                };
            }

            oreAndStone.RaceBonus      = Core.ML;
            oreAndStone.RandomizeVeins = Core.ML;

            this.Definitions.Add(oreAndStone);
            #endregion

            #region Mining for sand
            HarvestDefinition sand = this.m_Sand = new HarvestDefinition();

            // Resource banks are every 8x8 tiles
            sand.BankWidth  = 8;
            sand.BankHeight = 8;

            // Every bank holds from 6 to 12 sand
            sand.MinTotal = 6;
            sand.MaxTotal = 13;

            // A resource bank will respawn its content every 10 to 20 minutes
            sand.MinRespawn = TimeSpan.FromMinutes(10.0);
            sand.MaxRespawn = TimeSpan.FromMinutes(20.0);

            // Skill checking is done on the Mining skill
            sand.Skill = SkillName.Mining;

            // Set the list of harvestable tiles
            sand.Tiles = m_SandTiles;

            // Players must be within 2 tiles to harvest
            sand.MaxRange = 2;

            // One sand per harvest action
            sand.ConsumedPerHarvest        = 1;
            sand.ConsumedPerFeluccaHarvest = 2;

            // The digging effect
            sand.EffectActions    = new int[] { Core.SA ? 3 : 11 };
            sand.EffectSounds     = new int[] { 0x125, 0x126 };
            sand.EffectCounts     = new int[] { 6 };
            sand.EffectDelay      = TimeSpan.FromSeconds(1.6);
            sand.EffectSoundDelay = TimeSpan.FromSeconds(0.9);

            sand.NoResourcesMessage     = 1044629; // There is no sand here to mine.
            sand.DoubleHarvestMessage   = 1044629; // There is no sand here to mine.
            sand.TimedOutOfRangeMessage = 503041;  // You have moved too far away to continue mining.
            sand.OutOfRangeMessage      = 500446;  // That is too far away.
            sand.FailMessage            = 1044630; // You dig for a while but fail to find any of sufficient quality for glassblowing.
            sand.PackFullMessage        = 1044632; // Your backpack can't hold the sand, and it is lost!
            sand.ToolBrokeMessage       = 1044038; // You have worn out your tool!

            res = new HarvestResource[]
            {
                new HarvestResource(100.0, 70.0, 100.0, 1044631, typeof(Sand))
            };

            veins = new HarvestVein[]
            {
                new HarvestVein(100.0, 0.0, res[0], null)
            };

            sand.Resources = res;
            sand.Veins     = veins;

            this.Definitions.Add(sand);
            #endregion
        }
示例#18
0
        public override void OnHarvestStarted(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
        {
            base.OnHarvestStarted(from, tool, def, toHarvest);

            from.RevealingAction();
        }
示例#19
0
        public override void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked)
        {
            //Lava fishing needs to have its own set of rules.
            if (IsLavaHarvest(tool, toHarvest))
            {
                from.EndAction(locked);

                if (!CheckHarvest(from, tool))
                {
                    return;
                }

                int     tileID;
                Map     map;
                Point3D loc;

                if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc))
                {
                    OnBadHarvestTarget(from, tool, toHarvest);
                    return;
                }
                else if (!def.Validate(tileID) && !def.ValidateSpecial(tileID))
                {
                    OnBadHarvestTarget(from, tool, toHarvest);
                    return;
                }

                if (!CheckRange(from, tool, def, map, loc, true))
                {
                    return;
                }
                else if (!CheckResources(from, tool, def, map, loc, true))
                {
                    return;
                }
                else if (!CheckHarvest(from, tool, def, toHarvest))
                {
                    return;
                }

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

                if (bank == null)
                {
                    return;
                }

                HarvestVein vein = bank.Vein;

                if (vein == null)
                {
                    return;
                }

                Type type = null;

                HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, vein.PrimaryResource, vein.FallbackResource);

                if (from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill))
                {
                    //Special eye candy item
                    type = GetSpecialLavaItem(from, tool, map, loc, toHarvest);

                    //Special fish
                    if (type == null)
                    {
                        type = FishInfo.GetSpecialItem(from, tool, loc, IsLavaHarvest(tool, tileID));
                    }

                    if (type != null)
                    {
                        Item item = Construct(type, from, tool);

                        if (item == null)
                        {
                            type = null;
                        }
                        else
                        {
                            if (from.AccessLevel == AccessLevel.Player)
                            {
                                bank.Consume(Convert.ToInt32(map != null && map.Rules == MapRules.FeluccaRules ? Math.Ceiling(item.Amount / 2.0) : item.Amount), from);
                            }

                            if (Give(from, item, true))
                            {
                                SendSuccessTo(from, item, null);
                            }
                            else
                            {
                                SendPackFullTo(from, item, def, null);
                                item.Delete();
                            }
                        }
                    }
                }

                if (type == null)
                {
                    def.SendMessageTo(from, def.FailMessage);

                    double skill = (double)from.Skills[SkillName.Fishing].Value / 50;

                    if (0.5 / skill > Utility.RandomDouble())
                    {
                        OnToolUsed(from, tool, false);
                    }
                }
                else
                {
                    OnToolUsed(from, tool, true);
                }

                OnHarvestFinished(from, tool, def, vein, bank, null, null);
            }
            else
            {
                base.FinishHarvesting(from, tool, def, toHarvest, locked);
            }
        }
示例#20
0
 public virtual void OnHarvestFinished(Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested)
 {
 }
示例#21
0
 public virtual bool SpecialHarvest(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc)
 {
     return(false);
 }
示例#22
0
        public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked)
        {
            from.EndAction(locked);

            if (!CheckHarvest(from, tool))
            {
                return;
            }

            if (!GetHarvestDetails(from, tool, toHarvest, out int tileID, out Map map, out Point3D loc))
            {
                OnBadHarvestTarget(from, tool, toHarvest);
                return;
            }

            if (!def.Validate(tileID) && !def.ValidateSpecial(tileID))
            {
                OnBadHarvestTarget(from, tool, toHarvest);
                return;
            }

            if (!CheckRange(from, def, map, loc, true))
            {
                return;
            }
            if (!CheckResources(from, tool, def, map, loc, true))
            {
                return;
            }
            if (!CheckHarvest(from, tool, def, toHarvest))
            {
                return;
            }

            if (SpecialHarvest(from, tool, def, map, loc))
            {
                return;
            }

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

            if (bank == null)
            {
                return;
            }

            HarvestVein vein = bank.Vein;

            if (vein != null)
            {
                vein = MutateVein(from, tool, def, bank, toHarvest, vein);
            }

            if (vein == null)
            {
                return;
            }

            HarvestResource primary  = vein.PrimaryResource;
            HarvestResource fallback = vein.FallbackResource;
            HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, primary, fallback);

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

            Type type = null;

            if (CheckHarvestSkill(map, loc, from, resource, def))
            {
                type = GetResourceType(from, tool, def, map, loc, resource);

                if (type != null)
                {
                    type = MutateType(type, from, tool, def, map, loc, resource);
                }

                if (type != null)
                {
                    Item item = Construct(type, from, tool);

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

                        if (item is BaseGranite)
                        {
                            feluccaAmount = 3;
                        }

                        Caddellite.OnHarvest(from, tool, this, item);

                        //The whole harvest system is kludgy and I'm sure this is just adding to it.
                        if (item.Stackable)
                        {
                            int racialAmount        = (int)Math.Ceiling(amount * 1.1);
                            int feluccaRacialAmount = (int)Math.Ceiling(feluccaAmount * 1.1);

                            bool eligableForRacialBonus = def.RaceBonus && from.Race == Race.Human;
                            bool inFelucca = map == Map.Felucca && !Siege.SiegeShard;

                            if (eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount && 0.1 > Utility.RandomDouble())
                            {
                                item.Amount = feluccaRacialAmount;
                            }
                            else if (inFelucca && bank.Current >= feluccaAmount)
                            {
                                item.Amount = feluccaAmount;
                            }
                            else if (eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble())
                            {
                                item.Amount = racialAmount;
                            }
                            else
                            {
                                item.Amount = amount;
                            }

                            // Void Pool Rewards
                            item.Amount += WoodsmansTalisman.CheckHarvest(from, type, this);
                        }

                        if (from.AccessLevel == AccessLevel.Player)
                        {
                            bank.Consume(amount, from);
                        }

                        if (Give(from, item, def.PlaceAtFeetIfFull))
                        {
                            SendSuccessTo(from, item, resource);
                        }
                        else
                        {
                            SendPackFullTo(from, item, def, resource);
                            item.Delete();
                        }

                        BonusHarvestResource bonus = def.GetBonusResource();
                        Item bonusItem             = null;

                        if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill)
                        {
                            if (bonus.RequiredMap == null || bonus.RequiredMap == from.Map)
                            {
                                bonusItem = Construct(bonus.Type, from, tool);
                                Caddellite.OnHarvest(from, tool, this, bonusItem, false);

                                if (Give(from, bonusItem, true))    //Bonuses always allow placing at feet, even if pack is full irregrdless of def
                                {
                                    bonus.SendSuccessTo(from);
                                }
                                else
                                {
                                    bonusItem.Delete();
                                }
                            }
                        }

                        EventSink.InvokeResourceHarvestSuccess(new ResourceHarvestSuccessEventArgs(from, tool, item, bonusItem, this));
                    }

                    OnToolUsed(from, tool, item != null);
                }

                // Siege rules will take into account axes and polearms used for lumberjacking
                if (tool is IUsesRemaining withUses && (withUses is BaseHarvestTool || withUses is Pickaxe || withUses is SturdyPickaxe || withUses is GargoylesPickaxe || Siege.SiegeShard))
                {
                    withUses.ShowUsesRemaining = true;

                    if (withUses.UsesRemaining > 0)
                    {
                        --withUses.UsesRemaining;
                    }

                    if (withUses.UsesRemaining < 1)
                    {
                        tool.Delete();
                        def.SendMessageTo(from, def.ToolBrokeMessage);
                    }
                }
            }

            if (type == null)
            {
                def.SendMessageTo(from, def.FailMessage);
            }

            OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest);
        }
示例#23
0
 public virtual bool CheckHarvestSkill(Map map, Point3D loc, Mobile from, HarvestResource resource, HarvestDefinition def)
 {
     return(from.Skills[def.Skill].Value >= resource.ReqSkill && from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill));
 }
示例#24
0
        public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked)
        {
            from.EndAction(locked);

            if (!CheckHarvest(from, tool))
            {
                return;
            }

            int     tileID;
            Map     map;
            Point3D loc;

            if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc))
            {
                OnBadHarvestTarget(from, tool, toHarvest);
                return;
            }
            else if (!def.Validate(tileID))
            {
                OnBadHarvestTarget(from, tool, toHarvest);
                return;
            }

            if (!CheckRange(from, tool, def, map, loc, true))
            {
                return;
            }
            else if (!CheckResources(from, tool, def, map, loc, true))
            {
                return;
            }
            else if (!CheckHarvest(from, tool, def, toHarvest))
            {
                return;
            }

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

            if (bank == null)
            {
                return;
            }

            HarvestVein vein = bank.Vein;

            if (vein != null)
            {
                vein = MutateVein(from, tool, def, bank, toHarvest, vein);
            }

            if (vein == null)
            {
                return;
            }

            HarvestResource primary  = vein.PrimaryResource;
            HarvestResource fallback = vein.FallbackResource;
            HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, primary, fallback);

            double skillBase  = from.Skills[def.Skill].Base;
            double skillValue = from.Skills[def.Skill].Value;

            Type type = null;

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

                if (type != null)
                {
                    type = MutateType(type, from, tool, def, map, loc, resource);
                }

                if (type != null)
                {
                    Item item = Construct(type, from);

                    if (item == null)
                    {
                        type = null;
                    }
                    else
                    {
                        if (item.Stackable)
                        {
                            if (map == Map.Felucca && bank.GetCurrentFor(from) >= def.ConsumedPerFeluccaHarvest)
                            {
                                item.Amount = def.ConsumedPerFeluccaHarvest;
                            }
                            else
                            {
                                item.Amount = def.ConsumedPerHarvest;
                            }
                        }

                        bank.Consume(def, item.Amount);

                        if (Give(from, item, def.PlaceAtFeetIfFull))
                        {
                            SendSuccessTo(from, item, resource);
                        }
                        else
                        {
                            SendPackFullTo(from, item, def, resource);
                            item.Delete();
                        }

                        if (tool is IUsesRemaining)
                        {
                            IUsesRemaining toolWithUses = (IUsesRemaining)tool;

                            toolWithUses.ShowUsesRemaining = true;

                            if (toolWithUses.UsesRemaining > 0)
                            {
                                --toolWithUses.UsesRemaining;
                            }

                            if (toolWithUses.UsesRemaining < 1)
                            {
                                tool.Delete();
                                def.SendAsciiMessageTo(from, def.ToolBrokeMessage);
                            }
                        }
                    }
                }
            }

            if (type == null)
            {
                def.SendAsciiMessageTo(from, def.FailMessage);
            }

            OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest);
        }
示例#25
0
        public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked)
        {
            from.EndAction(locked);

            if (!CheckHarvest(from, tool))
            {
                return;
            }

            int     tileID;
            Map     map;
            Point3D loc;

            if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc))
            {
                OnBadHarvestTarget(from, tool, toHarvest);
                return;
            }
            else if (!def.Validate(tileID))
            {
                OnBadHarvestTarget(from, tool, toHarvest);
                return;
            }

            if (!CheckRange(from, tool, def, map, loc, true))
            {
                return;
            }
            else if (!CheckResources(from, tool, def, map, loc, true))
            {
                return;
            }
            else if (!CheckHarvest(from, tool, def, toHarvest))
            {
                return;
            }

            if (SpecialHarvest(from, tool, def, map, loc))
            {
                return;
            }

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

            if (bank == null)
            {
                return;
            }

            HarvestVein vein = bank.Vein;

            if (vein != null)
            {
                vein = MutateVein(from, tool, def, bank, toHarvest, vein);
            }

            if (vein == null)
            {
                return;
            }

            HarvestResource primary  = vein.PrimaryResource;
            HarvestResource fallback = vein.FallbackResource;
            HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, primary, fallback);

            double skillBase  = from.Skills[def.Skill].Base;
            double skillValue = from.Skills[def.Skill].Value;

            Type type = null;

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

                if (type != null)
                {
                    type = MutateType(type, from, tool, def, map, loc, resource);
                }

                if (type != null)
                {
                    Item item = Construct(type, from);

                    if (item == null)
                    {
                        type = null;
                    }
                    else
                    {
                        //The whole harvest system is kludgy and I'm sure this is just adding to it.
                        if (item.Stackable)
                        {
                            int amount        = def.ConsumedPerHarvest;
                            int feluccaAmount = def.ConsumedPerFeluccaHarvest;

                            int racialAmount        = (int)Math.Ceiling(amount * 1.1);
                            int feluccaRacialAmount = (int)Math.Ceiling(feluccaAmount * 1.1);

                            bool eligableForRacialBonus = def.RaceBonus && @from.Race == Race.Human;
                            bool inFelucca = map == Map.Felucca;

                            if (eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount && 0.1 > Utility.RandomDouble())
                            {
                                item.Amount = feluccaRacialAmount;
                            }
                            else if (inFelucca && bank.Current >= feluccaAmount)
                            {
                                item.Amount = feluccaAmount;
                            }
                            else if (eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble())
                            {
                                item.Amount = racialAmount;
                            }
                            else
                            {
                                item.Amount = amount;
                            }
                        }

                        bank.Consume(item.Amount, from);

                        if (Give(from, item, def.PlaceAtFeetIfFull))
                        {
                            SendSuccessTo(from, item, resource);
                        }
                        else
                        {
                            SendPackFullTo(from, item, def, resource);
                            item.Delete();
                        }

                        BonusHarvestResource bonus = def.GetBonusResource();

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

                            if (Give(from, bonusItem, true))                                    //Bonuses always allow placing at feet, even if pack is full irregrdless of def
                            {
                                bonus.SendSuccessTo(from);
                            }
                            else
                            {
                                item.Delete();
                            }
                        }

                        if (tool is IUsesRemaining)
                        {
                            IUsesRemaining toolWithUses = (IUsesRemaining)tool;

                            toolWithUses.ShowUsesRemaining = true;

                            if (toolWithUses.UsesRemaining > 0)
                            {
                                --toolWithUses.UsesRemaining;
                            }

                            if (toolWithUses.UsesRemaining < 1)
                            {
                                tool.Delete();
                                def.SendMessageTo(from, def.ToolBrokeMessage);
                            }
                        }
                    }
                }
            }

            if (type == null)
            {
                def.SendMessageTo(from, def.FailMessage);
            }

            OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest);
        }
示例#26
0
        public static void TargetByResource(TargetByResourceMacroEventArgs e)
        {
            Mobile m    = e.Mobile;
            Item   tool = e.Tool;

            HarvestSystem     system = null;
            HarvestDefinition def    = null;
            object            toHarvest;

            if (tool is IHarvestTool)
            {
                system = ((IHarvestTool)tool).HarvestSystem;
            }

            if (system != null)
            {
                switch (e.ResourceType)
                {
                case 0:     // ore
                    if (system is Mining)
                    {
                        def = ((Mining)system).OreAndStone;
                    }
                    break;

                case 1:     // sand
                    if (system is Mining)
                    {
                        def = ((Mining)system).Sand;
                    }
                    break;

                case 2:     // wood
                    if (system is Lumberjacking)
                    {
                        def = ((Lumberjacking)system).Definition;
                    }
                    break;

                case 3:     // grave
                    if (TryHarvestGrave(m))
                    {
                        return;
                    }
                    break;

                case 4:     // red shrooms
                    if (TryHarvestShrooms(m))
                    {
                        return;
                    }
                    break;
                }

                if (def != null && FindValidTile(m, def, out toHarvest))
                {
                    system.StartHarvesting(m, tool, toHarvest);
                    return;
                }

                system.OnBadHarvestTarget(m, tool, new LandTarget(new Point3D(0, 0, 0), Map.Felucca));
            }
        }
示例#27
0
		public virtual bool CheckHarvest( Mobile from, Item tool, HarvestDefinition def, object toHarvest )
		{
			return CheckTool( from, tool );
		}
示例#28
0
 public override object GetLock(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
 {
     return(this);
 }
示例#29
0
		public virtual void DoHarvestingEffect( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc )
		{
			from.Direction = from.GetDirectionTo( loc );

			if ( !from.Mounted )
				from.Animate( Utility.RandomList( def.EffectActions ), 5, 1, true, false, 0 );
		}
        private Lumberjacking()
        {
            HarvestResource[] res;
            HarvestVein[]     veins;

            #region Lumberjacking
            HarvestDefinition lumber = new HarvestDefinition();

            // Resource banks are every 4x3 tiles
            lumber.BankWidth  = 4;
            lumber.BankHeight = 3;

            // Every bank holds from 20 to 45 logs
            lumber.MinTotal = 20;
            lumber.MaxTotal = 45;

            // A resource bank will respawn its content every 20 to 30 minutes
            lumber.MinRespawn = TimeSpan.FromMinutes(20.0);
            lumber.MaxRespawn = TimeSpan.FromMinutes(30.0);

            // Skill checking is done on the Lumberjacking skill
            lumber.Skill = SkillName.Lumberjacking;

            // Set the list of harvestable tiles
            lumber.Tiles = m_TreeTiles;

            // Players must be within 2 tiles to harvest
            lumber.MaxRange = 2;

            // Ten logs per harvest action
            lumber.ConsumedPerHarvest        = 10;
            lumber.ConsumedPerFeluccaHarvest = 20;

            // The chopping effect
            lumber.EffectActions    = new int[] { 13 };
            lumber.EffectSounds     = new int[] { 0x13E };
            lumber.EffectCounts     = (Core.AOS ? new int[] { 1 } : new int[] { 1, 2, 2, 2, 3 });
            lumber.EffectDelay      = TimeSpan.FromSeconds(1.6);
            lumber.EffectSoundDelay = TimeSpan.FromSeconds(0.9);

            lumber.NoResourcesMessage = 500493; // There's not enough wood here to harvest.
            lumber.FailMessage        = 500495; // You hack at the tree for a while, but fail to produce any useable wood.
            lumber.OutOfRangeMessage  = 500446; // That is too far away.
            lumber.PackFullMessage    = 500497; // You can't place any wood into your backpack!
            lumber.ToolBrokeMessage   = 500499; // You broke your axe.

            if (Core.ML)
            {
                //daat99 OWLTR start - custom harvest
                res = new HarvestResource[]
                {
                    new HarvestResource(00.0, 00.0, 95.0, "You put some Regular logs in your backpack", typeof(Log)),
                    new HarvestResource(20.0, 10.0, 100.0, "You put some Oak logs in your backpack", typeof(OakLog)),
                    new HarvestResource(30.0, 20.0, 105.0, "You put some Ash logs in your backpack", typeof(AshLog)),
                    new HarvestResource(40.0, 30.0, 110.0, "You put some Yew logs in your backpack", typeof(YewLog)),
                    new HarvestResource(50.0, 40.0, 115.0, "You put some Heartwood logs in your backpack", typeof(HeartwoodLog)),
                    new HarvestResource(60.0, 50.0, 120.0, "You put some Bloodwood logs in your backpack", typeof(BloodwoodLog)),
                    new HarvestResource(70.0, 60.0, 125.0, "You put some Frostwood logs in your backpack", typeof(FrostwoodLog)),
                    new HarvestResource(80.0, 70.0, 130.0, "You put some Ebony logs in your backpack", typeof(EbonyLog)),
                    new HarvestResource(90.0, 80.0, 135.0, "You put some Bamboo logs in your backpack", typeof(BambooLog)),
                    new HarvestResource(100.0, 90.0, 140.0, "You put some Purple Heart logs in your backpack", typeof(PurpleHeartLog)),
                    new HarvestResource(110.0, 100.0, 145.0, "You put some Redwood logs in your backpack", typeof(RedwoodLog)),
                    new HarvestResource(119.0, 110.0, 150.0, "You put some Petrified logs in your backpack", typeof(PetrifiedLog)),
                };

                veins = new HarvestVein[]
                {
                    new HarvestVein(34.0, 0.0, res[0], null),    // this line should replace the original line
                    new HarvestVein(11.0, 0.5, res[1], res[0]),  // OakLog
                    new HarvestVein(10.0, 0.5, res[2], res[0]),  // Ash
                    new HarvestVein(09.0, 0.5, res[3], res[0]),  // YewLog
                    new HarvestVein(08.0, 0.5, res[4], res[0]),  // HeartwoodLog
                    new HarvestVein(07.0, 0.5, res[5], res[0]),  // BloodwoodLog
                    new HarvestVein(06.0, 0.5, res[6], res[0]),  // FrostwoodLog
                    new HarvestVein(05.0, 0.5, res[7], res[0]),  // EbonyLog
                    new HarvestVein(04.0, 0.5, res[8], res[0]),  // BambooLog
                    new HarvestVein(03.0, 0.5, res[9], res[0]),  // PurpleHeartLog
                    new HarvestVein(02.0, 0.5, res[10], res[0]), // RedwoodLog
                    new HarvestVein(01.0, 0.5, res[11], res[0]), // PetrifiedLog
                };

                lumber.BonusResources = new BonusHarvestResource[]
                {
                    new BonusHarvestResource(0, 83.9, null, null), //Nothing
                    new BonusHarvestResource(100, 10.0, 1072548, typeof(BarkFragment)),
                    new BonusHarvestResource(100, 03.0, 1072550, typeof(LuminescentFungi)),
                    new BonusHarvestResource(100, 02.0, 1072547, typeof(SwitchItem)),
                    new BonusHarvestResource(100, 01.0, 1072549, typeof(ParasiticPlant)),
                    new BonusHarvestResource(100, 00.1, 1072551, typeof(BrilliantAmber))
                };
            }
            //daat99 OWLTR end - custom harvest
            else
            {
                res = new HarvestResource[]
                {
                    new HarvestResource(00.0, 00.0, 100.0, 500498, typeof(Log))
                };

                veins = new HarvestVein[]
                {
                    new HarvestVein(100.0, 0.0, res[0], null)
                };
            }

            lumber.Resources = res;
            lumber.Veins     = veins;

            lumber.RaceBonus      = Core.ML;
            lumber.RandomizeVeins = Core.ML;

            this.m_Definition = lumber;
            this.Definitions.Add(lumber);
            #endregion
        }
示例#31
0
        public override bool SpecialHarvest(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc)
        {
            PlayerMobile player = from as PlayerMobile;

            Container pack = from.Backpack;

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

                if (qs is CollectorQuest)
                {
                    QuestObjective obj = qs.FindObjective(typeof(FishPearlsObjective));

                    if (obj != null && !obj.Completed)
                    {
                        if (Utility.RandomDouble() < 0.5)
                        {
                            player.SendLocalizedMessage(1055086, "", 0x59); // You pull a shellfish out of the water, and find a rainbow pearl inside of it.

                            obj.CurProgress++;
                        }
                        else
                        {
                            player.SendLocalizedMessage(1055087, "", 0x2C); // You pull a shellfish out of the water, but it doesn't have a rainbow pearl.
                        }

                        return(true);
                    }
                }

                foreach (BaseQuest quest in player.Quests)
                {
                    if (quest is SomethingFishy)
                    {
                        if (Utility.RandomDouble() < 0.1 && (from.Region != null && from.Region.IsPartOf("AbyssEntrance")))
                        {
                            Item red = new RedHerring();
                            pack.AddItem(red);
                            player.SendLocalizedMessage(1095047, "", 0x23); // You pull a shellfish out of the water, but it doesn't have a rainbow pearl.
                            break;
                        }
                        return(true);
                    }

                    if (quest is ScrapingtheBottom)
                    {
                        if (Utility.RandomDouble() < 0.1 && (from.Region != null && from.Region.IsPartOf("AbyssEntrance")))
                        {
                            Item mug = new MudPuppy();
                            pack.AddItem(mug);
                            player.SendLocalizedMessage(1095064, "", 0x23); // You pull a shellfish out of the water, but it doesn't have a rainbow pearl.
                            break;
                        }
                        return(true);
                    }
                }

                #region High Seas Charydbis
                if (Core.HS && tool is FishingPole && CharydbisSpawner.SpawnInstance != null && CharydbisSpawner.SpawnInstance.IsSummoned)
                {
                    if (pack == null)
                    {
                        return(false);
                    }

                    Item             oracle = pack.FindItemByType(typeof(OracleOfTheSea));
                    FishingPole      pole   = tool as FishingPole;
                    CharydbisSpawner sp     = CharydbisSpawner.SpawnInstance;

                    if (oracle != null && sp != null)
                    {
                        if (from.Map != sp.Map)
                        {
                            from.SendLocalizedMessage(1150861); //Charybdis have never been seen in these waters, try somewhere else.
                        }
                        else if (pole.BaitType == typeof(Charydbis) && from.Skills[SkillName.Fishing].Value >= 100)
                        {
                            if (sp.Charydbis == null && !sp.HasSpawned && sp.CurrentLocation.Contains(loc))
                            {
                                Server.Multis.BaseBoat boat = Server.Multis.BaseBoat.FindBoatAt(from, from.Map);
                                sp.SpawnCharydbis(from, loc, sp.Map, boat);
                                sp.HasSpawned = true;
                                pole.OnFishedHarvest(from, true);
                                return(true);
                            }
                            else if (sp.LastLocation.Contains(loc))
                            {
                                from.SendLocalizedMessage(1150862); //The charybdis has moved on from this location, consult Oracle Of The Seas again.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1150858); //You see a few bubbles, but no charybdis.
                        }
                    }
                }
                #endregion
            }

            return(false);
        }
示例#32
0
        public override void OnHarvestStarted(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
        {
            base.OnHarvestStarted(from, tool, def, toHarvest);

            if (Core.ML)
                from.RevealingAction();
        }
 public override void OnHarvestFinished(Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested, Type type)
 {
     if (tool is GargoylesAxe && 0.1 < Utility.RandomDouble())
     {
         HarvestResource res = vein.PrimaryResource;
         Map             map = from.Map;
         if (map == null)
         {
             return;
         }
         BaseCreature spawned = null;
         int          i_Level = 0;
         if (OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.DAAT99_LUMBERJACKING))
         {
             i_Level = CraftResources.GetIndex(CraftResources.GetFromType(type));
         }
         else if (res == resource)
         {
             try
             {
                 i_Level = Array.IndexOf(def.Veins, vein) + 301;
             }
             catch { }
         }
         if (i_Level > 300 && OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.HARVEST_GIVE_TOKENS))
         {
             TokenSystem.GiveTokensToPlayer(from as PlayerMobile, (i_Level - 300) * 10);
         }
         if (i_Level > 301)
         {
             spawned = new Elementals(i_Level);
         }
         else
         {
             spawned = null;
         }
         try
         {
             if (spawned != null)
             {
                 int offset = Utility.Random(8) * 2;
                 for (int i = 0; i < m_Offsets.Length; i += 2)
                 {
                     int x = from.X + m_Offsets[(offset + i) % m_Offsets.Length];
                     int y = from.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
                     if (map.CanSpawnMobile(x, y, from.Z))
                     {
                         spawned.MoveToWorld(new Point3D(x, y, from.Z), map);
                         spawned.Combatant = from;
                         return;
                     }
                     else
                     {
                         int z = map.GetAverageZ(x, y);
                         if (map.CanSpawnMobile(x, y, z))
                         {
                             spawned.MoveToWorld(new Point3D(x, y, z), map);
                             spawned.Combatant = from;
                             return;
                         }
                     }
                 }
                 spawned.MoveToWorld(from.Location, from.Map);
                 spawned.Combatant = from;
             }
         }
         catch
         {
         }
     }
 }
示例#34
0
		public virtual void OnHarvestFinished( Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested )
		{
		}
示例#35
0
        private Lumberjacking()
        {
            HarvestResource[] res;
            HarvestVein[]     veins;

            #region Lumberjacking
            HarvestDefinition lumber = new HarvestDefinition
            {
                // Resource banks are every 4x3 tiles
                BankWidth  = 4,
                BankHeight = 3,

                // Every bank holds from 20 to 45 logs
                MinTotal = 20,
                MaxTotal = 45,

                // A resource bank will respawn its content every 20 to 30 minutes
                MinRespawn = TimeSpan.FromMinutes(20.0),
                MaxRespawn = TimeSpan.FromMinutes(30.0),

                // Skill checking is done on the Lumberjacking skill
                Skill = SkillName.Lumberjacking,

                // Set the list of harvestable tiles
                Tiles = m_TreeTiles,

                // Players must be within 2 tiles to harvest
                MaxRange = 2,

                // Ten logs per harvest action
                ConsumedPerHarvest        = 10,
                ConsumedPerFeluccaHarvest = 20,

                // The chopping effect
                EffectActions    = new[] { 7 },
                EffectSounds     = new[] { 0x13E },
                EffectCounts     = new[] { 1 },
                EffectDelay      = TimeSpan.FromSeconds(1.6),
                EffectSoundDelay = TimeSpan.FromSeconds(0.9),

                NoResourcesMessage = 500493, // There's not enough wood here to harvest.
                FailMessage        = 500495, // You hack at the tree for a while, but fail to produce any useable wood.
                OutOfRangeMessage  = 500446, // That is too far away.
                PackFullMessage    = 500497, // You can't place any wood into your backpack!
                ToolBrokeMessage   = 500499  // You broke your axe.
            };

            res = new[]
            {
                new HarvestResource(00.0, 00.0, 100.0, 1072540, typeof(Log)),
                new HarvestResource(65.0, 25.0, 105.0, 1072541, typeof(OakLog)),
                new HarvestResource(80.0, 40.0, 120.0, 1072542, typeof(AshLog)),
                new HarvestResource(95.0, 55.0, 135.0, 1072543, typeof(YewLog)),
                new HarvestResource(100.0, 60.0, 140.0, 1072544, typeof(HeartwoodLog)),
                new HarvestResource(100.0, 60.0, 140.0, 1072545, typeof(BloodwoodLog)),
                new HarvestResource(100.0, 60.0, 140.0, 1072546, typeof(FrostwoodLog))
            };

            veins = new[]
            {
                new HarvestVein(49.0, 0.0, res[0], null),   // Ordinary Logs
                new HarvestVein(30.0, 0.5, res[1], res[0]), // Oak
                new HarvestVein(10.0, 0.5, res[2], res[0]), // Ash
                new HarvestVein(05.0, 0.5, res[3], res[0]), // Yew
                new HarvestVein(03.0, 0.5, res[4], res[0]), // Heartwood
                new HarvestVein(02.0, 0.5, res[5], res[0]), // Bloodwood
                new HarvestVein(01.0, 0.5, res[6], res[0])  // Frostwood
            };

            lumber.BonusResources = new[]
            {
                new BonusHarvestResource(0, 82.0, null, null), //Nothing
                new BonusHarvestResource(100, 10.0, 1072548, typeof(BarkFragment)),
                new BonusHarvestResource(100, 03.0, 1072550, typeof(LuminescentFungi)),
                new BonusHarvestResource(100, 02.0, 1072547, typeof(SwitchItem)),
                new BonusHarvestResource(100, 01.0, 1072549, typeof(ParasiticPlant)),
                new BonusHarvestResource(100, 01.0, 1072551, typeof(BrilliantAmber)),
                new BonusHarvestResource(100, 01.0, 1113756, typeof(CrystalShards), Map.TerMur)
            };

            lumber.Resources = res;
            lumber.Veins     = veins;

            lumber.RaceBonus      = true;
            lumber.RandomizeVeins = true;

            m_Definition = lumber;
            Definitions.Add(lumber);
            #endregion
        }
示例#36
0
        public override bool SpecialHarvest(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc)
        {
            if (!Core.HS)
            {
                return(base.SpecialHarvest(from, tool, def, map, loc));
            }

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

            if (bank == null)
            {
                return(false);
            }

            bool boat    = Server.Multis.BaseBoat.FindBoatAt(from, from.Map) != null;
            bool dungeon = IsDungeonRegion(from);

            if (!boat && !dungeon)
            {
                return(false);
            }

            if (boat || !NiterDeposit.HasBeenChecked(bank))
            {
                int    luck  = from is PlayerMobile ? ((PlayerMobile)from).RealLuck : from.Luck;
                double bonus = (from.Skills[SkillName.Mining].Value / 9999) + ((double)luck / 150000);

                if (boat)
                {
                    bonus -= (bonus * .33);
                }

                if (dungeon)
                {
                    NiterDeposit.AddBank(bank);
                }

                if (Utility.RandomDouble() < bonus)
                {
                    int size = Utility.RandomMinMax(1, 5);

                    if (luck / 2500 > Utility.RandomDouble())
                    {
                        size++;
                    }

                    NiterDeposit niter = new NiterDeposit(size);

                    if (!dungeon)
                    {
                        niter.MoveToWorld(new Point3D(loc.X, loc.Y, from.Z + 3), from.Map);
                        from.SendLocalizedMessage(1149918, niter.Size.ToString()); //You have uncovered a ~1_SIZE~ deposit of niter! Mine it to obtain saltpeter.
                        NiterDeposit.AddBank(bank);
                        return(true);
                    }
                    else
                    {
                        for (int i = 0; i < 50; i++)
                        {
                            int x = Utility.RandomMinMax(loc.X - 2, loc.X + 2);
                            int y = Utility.RandomMinMax(loc.Y - 2, loc.Y + 2);
                            int z = from.Z;

                            if (from.Map.CanSpawnMobile(x, y, z))
                            {
                                niter.MoveToWorld(new Point3D(x, y, z), from.Map);
                                from.SendLocalizedMessage(1149918, niter.Size.ToString()); //You have uncovered a ~1_SIZE~ deposit of niter! Mine it to obtain saltpeter.
                                return(true);
                            }
                        }
                    }

                    niter.Delete();
                }
            }

            return(false);
        }
示例#37
0
 public virtual HarvestVein MutateVein(Mobile from, Item tool, HarvestDefinition def, HarvestBank bank, object toHarvest, HarvestVein vein)
 {
     return(vein);
 }
示例#38
0
        public DynamicMining()
        {
            #region Mining for ore
            HarvestDefinition ore = m_Ore = new HarvestDefinition();

            // Resource banks are every 8x8 tiles
            ore.BankWidth  = 8;
            ore.BankHeight = 8;

            // Every bank holds from 10 to 34 ore
            ore.MinTotal = 10;
            ore.MaxTotal = 34;

            // A resource bank will respawn its content every 10 to 20 minutes
            ore.MinRespawn = TimeSpan.FromMinutes(10.0);
            ore.MaxRespawn = TimeSpan.FromMinutes(20.0);

            // Skill checking is done on the Mining skill
            ore.Skill = SkillName.Mining;

            // Set the list of harvestable tiles
            ore.Tiles = m_MountainAndCaveTiles;

            // Players must be within 2 tiles to harvest
            ore.MaxRange = 2;

            // One ore per harvest action
            ore.ConsumedPerHarvest        = 1;
            ore.ConsumedPerFeluccaHarvest = 2;

            // The digging effect
            ore.EffectActions    = new int[] { 11 };
            ore.EffectSounds     = new int[] { 0x125, 0x126 };
            ore.EffectCounts     = new int[] { 1 };
            ore.EffectDelay      = TimeSpan.FromSeconds(1.6);
            ore.EffectSoundDelay = TimeSpan.FromSeconds(0.9);

            ore.NoResourcesMessage     = 503040;  // There is no metal here to mine.
            ore.DoubleHarvestMessage   = 503042;  // Someone has gotten to the metal before you.
            ore.TimedOutOfRangeMessage = 503041;  // You have moved too far away to continue mining.
            ore.OutOfRangeMessage      = 500446;  // That is too far away.
            ore.FailMessage            = 503043;  // You loosen some rocks but fail to find any useable ore.
            ore.PackFullMessage        = 1010481; // Your backpack is full, so the ore you mined is lost.
            ore.ToolBrokeMessage       = 1044038; // You have worn out your tool!

            if (Core.ML)
            {
                ore.BonusResources = new BonusHarvestResource[]
                {
                    new BonusHarvestResource(0, 99.4, null, null),                              //Nothing
                    new BonusHarvestResource(100, .1, 1072562, typeof(BlueDiamond)),
                    new BonusHarvestResource(100, .1, 1072567, typeof(DarkSapphire)),
                    new BonusHarvestResource(100, .1, 1072570, typeof(EcruCitrine)),
                    new BonusHarvestResource(100, .1, 1072564, typeof(FireRuby)),
                    new BonusHarvestResource(100, .1, 1072566, typeof(PerfectEmerald)),
                    new BonusHarvestResource(100, .1, 1072568, typeof(Turquoise))
                };
            }

            ore.RaceBonus      = Core.ML;
            ore.RandomizeVeins = Core.ML;

            Definitions.Add(ore);
            #endregion
        }
示例#39
0
        private GoldPanning()
        {
            HarvestResource[] res;
            HarvestVein[]     veins;

            #region GoldPanning
            HarvestDefinition nugget = new HarvestDefinition();

            // Resource banks are every 8x8 tiles
            nugget.BankWidth  = 8;
            nugget.BankHeight = 8;

            // Every bank holds from 5 to 10 nuggets
            nugget.MinTotal = 5;
            nugget.MaxTotal = 10;

            // A resource bank will respawn its content every 10 to 20 minutes
            nugget.MinRespawn = TimeSpan.FromMinutes(10.0);
            nugget.MaxRespawn = TimeSpan.FromMinutes(20.0);

            // Skill checking is done on the Mining skill
            nugget.Skill = SkillName.Mining;

            // Set the list of harvestable tiles
            nugget.Tiles       = m_WaterTiles;
            nugget.RangedTiles = true;

            // Players must be within 2 tiles to harvest
            nugget.MaxRange = 2;

            // One nugget per harvest action
            nugget.ConsumedPerHarvest        = 1;
            nugget.ConsumedPerFeluccaHarvest = 1;

            // The panning
            nugget.EffectActions    = new int[] { 32 };
            nugget.EffectSounds     = new int[0];
            nugget.EffectCounts     = new int[] { 1 };
            nugget.EffectDelay      = TimeSpan.Zero;
            nugget.EffectSoundDelay = TimeSpan.FromSeconds(8.0);

            nugget.NoResourcesMessage     = "There doesn't seem to be any nuggets left here.";     // There doesn't seem to be any nuggets left here.
            nugget.FailMessage            = "You pan for a while, but fail to find any nuggets.";  // You pan for a while, but fail to find any nuggets.
            nugget.TimedOutOfRangeMessage = "You need to be closer to the water for panning!";     // You need to be closer to the water for panning!
            nugget.OutOfRangeMessage      = "You need to be closer to the water for panning!";     // You need to be closer to the water for panning!
            nugget.PackFullMessage        = "You dont have room in your pack for another nugget."; // You dont have room in your pack for another nugget.
            nugget.ToolBrokeMessage       = "You wore out your gold pan.";                         // You wore out your gold pan.

            res = new HarvestResource[]
            {
                new HarvestResource(75.0, 70.0, 125.0, "You put a small gold nugget in your pack.", typeof(SmallGoldNugget)),
                new HarvestResource(90.0, 75.0, 135.0, "You put a medium gold nugget in your pack.", typeof(MediumGoldNugget)),
                new HarvestResource(105.0, 90.0, 145.0, "You put a large gold nugget in your pack.", typeof(LargeGoldNugget))
            };

            veins = new HarvestVein[]
            {
                new HarvestVein(70.0, 0.0, res[0], null),
                new HarvestVein(20.0, 0.5, res[1], res[0]),
                new HarvestVein(10.0, 0.5, res[2], res[0])
            };

            nugget.Resources = res;
            nugget.Veins     = veins;

            if (Core.ML)
            {
                nugget.BonusResources = new BonusHarvestResource[]
                {
                    new BonusHarvestResource(0, 88.0, null, null),                              //Nothing
                    new BonusHarvestResource(100, 2.0, 1072562, typeof(BlueDiamond)),
                    new BonusHarvestResource(100, 2.0, 1072567, typeof(DarkSapphire)),
                    new BonusHarvestResource(100, 2.0, 1072570, typeof(EcruCitrine)),
                    new BonusHarvestResource(100, 2.0, 1072564, typeof(FireRuby)),
                    new BonusHarvestResource(100, 2.0, 1072566, typeof(PerfectEmerald)),
                    new BonusHarvestResource(100, 2.0, 1072568, typeof(Turquoise)),
                    new BonusHarvestResource(100, 2.0, 1026256, typeof(BrilliantAmber)),
                    new BonusHarvestResource(100, 2.0, 1032694, typeof(WhitePearl))
                };
            }

            m_Definition = nugget;
            Definitions.Add(nugget);
            #endregion
        }
示例#40
0
 public virtual void SendPackFullTo(Mobile from, Item item, HarvestDefinition def, HarvestResource resource)
 {
     def.SendMessageTo(from, def.PackFullMessage);
 }
示例#41
0
        public override bool CheckHarvest(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
        {
            if (!base.CheckHarvest(from, tool, def, toHarvest))
                return false;

            if (tool.Parent != from)
            {
                from.SendLocalizedMessage(500487); // The axe must be equipped for any serious wood chopping.
                return false;
            }

            return true;
        }
示例#42
0
 public virtual Type MutateType(Type type, Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, HarvestResource resource)
 {
     return(from.Region.GetResource(type));
 }
示例#43
0
        private Lumberjacking()
        {
            HarvestResource[] res;
            HarvestVein[] veins;

            #region Lumberjacking
            HarvestDefinition lumber = new HarvestDefinition();

            // Resource banks are every 4x3 tiles
            lumber.BankWidth = 4;
            lumber.BankHeight = 3;

            // Every bank holds from 20 to 45 logs
            lumber.MinTotal = 20;
            lumber.MaxTotal = 45;

            // A resource bank will respawn its content every 20 to 30 minutes
            lumber.MinRespawn = TimeSpan.FromMinutes(20.0);
            lumber.MaxRespawn = TimeSpan.FromMinutes(30.0);

            // Skill checking is done on the Lumberjacking skill
            lumber.Skill = SkillName.Lumberjacking;

            // Set the list of harvestable tiles
            lumber.Tiles = m_TreeTiles;

            // Players must be within 2 tiles to harvest
            lumber.MaxRange = 2;

            // Ten logs per harvest action
            lumber.ConsumedPerHarvest = 10;
            lumber.ConsumedPerFeluccaHarvest = 20;

            // The chopping effect
            lumber.EffectActions = new int[] { 13 };
            lumber.EffectSounds = new int[] { 0x13E };
            lumber.EffectCounts = (Core.AOS ? new int[] { 1 } : new int[] { 1, 2, 2, 2, 3 });
            lumber.EffectDelay = TimeSpan.FromSeconds(1.6);
            lumber.EffectSoundDelay = TimeSpan.FromSeconds(0.9);

            lumber.NoResourcesMessage = 500493; // There's not enough wood here to harvest.
            lumber.FailMessage = 500495; // You hack at the tree for a while, but fail to produce any useable wood.
            lumber.OutOfRangeMessage = 500446; // That is too far away.
            lumber.PackFullMessage = 500497; // You can't place any wood into your backpack!
            lumber.ToolBrokeMessage = 500499; // You broke your axe.

            if (Core.ML)
            {
                res = new HarvestResource[]
                {
                    new HarvestResource(00.0, 00.0, 100.0, 1072540, typeof(Log)),
                    new HarvestResource(65.0, 25.0, 105.0, 1072541, typeof(OakLog)),
                    new HarvestResource(80.0, 40.0, 120.0, 1072542, typeof(AshLog)),
                    new HarvestResource(95.0, 55.0, 135.0, 1072543, typeof(YewLog)),
                    new HarvestResource(100.0, 60.0, 140.0, 1072544, typeof(HeartwoodLog)),
                    new HarvestResource(100.0, 60.0, 140.0, 1072545, typeof(BloodwoodLog)),
                    new HarvestResource(100.0, 60.0, 140.0, 1072546, typeof(FrostwoodLog)),
                };

                veins = new HarvestVein[]
                {
                    new HarvestVein(49.0, 0.0, res[0], null), // Ordinary Logs
                    new HarvestVein(30.0, 0.5, res[1], res[0]), // Oak
                    new HarvestVein(10.0, 0.5, res[2], res[0]), // Ash
                    new HarvestVein(05.0, 0.5, res[3], res[0]), // Yew
                    new HarvestVein(03.0, 0.5, res[4], res[0]), // Heartwood
                    new HarvestVein(02.0, 0.5, res[5], res[0]), // Bloodwood
                    new HarvestVein(01.0, 0.5, res[6], res[0]), // Frostwood
                };

                lumber.BonusResources = new BonusHarvestResource[]
                {
                    new BonusHarvestResource(0, 83.9, null, null), //Nothing
                    new BonusHarvestResource(100, 10.0, 1072548, typeof(BarkFragment)),
                    new BonusHarvestResource(100, 03.0, 1072550, typeof(LuminescentFungi)),
                    new BonusHarvestResource(100, 02.0, 1072547, typeof(SwitchItem)),
                    new BonusHarvestResource(100, 01.0, 1072549, typeof(ParasiticPlant)),
                    new BonusHarvestResource(100, 00.1, 1072551, typeof(BrilliantAmber))
                };
            }
            else
            {
                res = new HarvestResource[]
                {
                    new HarvestResource(00.0, 00.0, 100.0, 500498, typeof(Log))
                };

                veins = new HarvestVein[]
                {
                    new HarvestVein(100.0, 0.0, res[0], null)
                };
            }

            lumber.Resources = res;
            lumber.Veins = veins;

            lumber.RaceBonus = Core.ML;
            lumber.RandomizeVeins = Core.ML;

            this.m_Definition = lumber;
            this.Definitions.Add(lumber);
            #endregion
        }
示例#44
0
 public virtual bool CheckHarvest(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
 {
     return(CheckTool(from, tool));
 }
示例#45
0
		public virtual bool SpecialHarvest( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc )
		{
			return false;
		}
示例#46
0
 public virtual void OnConcurrentHarvest(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
 {
 }
示例#47
0
		public virtual void SendPackFullTo( Mobile from, Item item, HarvestDefinition def, HarvestResource resource )
		{
			def.SendMessageTo( from, def.PackFullMessage );
		}
示例#48
0
 public virtual void OnHarvestStarted(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
 {
 }
示例#49
0
		public virtual Type GetResourceType( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, HarvestResource resource )
		{
			if ( resource.Types.Length > 0 )
				return resource.Types[Utility.Random( resource.Types.Length )];

			return null;
		}
示例#50
0
 public override void OnConcurrentHarvest(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
 {
     from.SendLocalizedMessage(500972); // You are already fishing.
 }
示例#51
0
		public virtual bool OnHarvesting( Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked, bool last )
		{
			if ( !CheckHarvest( from, tool ) )
			{
				from.EndAction( locked );
				return false;
			}

			int tileID;
			Map map;
			Point3D loc;

			if ( !GetHarvestDetails( from, tool, toHarvest, out tileID, out map, out loc ) )
			{
				from.EndAction( locked );
				OnBadHarvestTarget( from, tool, toHarvest );
				return false;
			}
			else if ( !def.Validate( tileID ) )
			{
				from.EndAction( locked );
				OnBadHarvestTarget( from, tool, toHarvest );
				return false;
			}
			else if ( !CheckRange( from, tool, def, map, loc, true ) )
			{
				from.EndAction( locked );
				return false;
			}
			else if ( !CheckResources( from, tool, def, map, loc, true ) )
			{
				from.EndAction( locked );
				return false;
			}
			else if ( !CheckHarvest( from, tool, def, toHarvest ) )
			{
				from.EndAction( locked );
				return false;
			}

			DoHarvestingEffect( from, tool, def, map, loc );

			new HarvestSoundTimer( from, tool, this, def, toHarvest, locked, last ).Start();

			return !last;
		}
示例#52
0
		public virtual void OnHarvestStarted( Mobile from, Item tool, HarvestDefinition def, object toHarvest )
		{
		}
示例#53
0
		public virtual void DoHarvestingSound( Mobile from, Item tool, HarvestDefinition def, object toHarvest )
		{
			if ( def.EffectSounds.Length > 0 )
				from.PlaySound( Utility.RandomList( def.EffectSounds ) );
		}
示例#54
0
 public override void OnConcurrentHarvest(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
 {
     from.SendMessage("You are already panning."); // You are already panning.
 }
示例#55
0
        public override bool SpecialHarvest(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc)
        {
            PlayerMobile player = from as PlayerMobile;

            Container pack = from.Backpack;

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

                if (qs is CollectorQuest)
                {
                    QuestObjective obj = qs.FindObjective(typeof(FishPearlsObjective));

                    if (obj != null && !obj.Completed)
                    {
                        if (Utility.RandomDouble() < 0.5)
                        {
                            player.SendLocalizedMessage(1055086, "", 0x59); // You pull a shellfish out of the water, and find a rainbow pearl inside of it.

                            obj.CurProgress++;
                        }
                        else
                        {
                            player.SendLocalizedMessage(1055087, "", 0x2C); // You pull a shellfish out of the water, but it doesn't have a rainbow pearl.
                        }

                        return(true);
                    }
                }

                foreach (BaseQuest quest in player.Quests)
                {
                    if (quest is SomethingFishy)
                    {
                        if (Utility.RandomDouble() < 0.1 && (from.Region != null && from.Region.IsPartOf("AbyssEntrance")))
                        {
                            Item red = new RedHerring();
                            pack.AddItem(red);
                            player.SendLocalizedMessage(1095047, "", 0x23);   // You pull a shellfish out of the water, but it doesn't have a rainbow pearl.
                            break;
                        }
                        return(true);
                    }

                    if (quest is ScrapingtheBottom)
                    {
                        if (Utility.RandomDouble() < 0.1 && (from.Region != null && from.Region.IsPartOf("AbyssEntrance")))
                        {
                            Item mug = new MudPuppy();
                            pack.AddItem(mug);
                            player.SendLocalizedMessage(1095064, "", 0x23);   // You pull a shellfish out of the water, but it doesn't have a rainbow pearl.
                            break;
                        }
                        return(true);
                    }
                }
            }

            return(false);
        }
示例#56
0
        // OWLTR

        // public override void OnHarvestFinished(Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested)
        public override void OnHarvestFinished(Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested, Type type)
        {
            if (tool is GargoylesPickaxe && def == this.m_OreAndStone && 0.1 > Utility.RandomDouble() && HarvestMap.CheckMapOnHarvest(from, harvested, def) == null)
            {
                HarvestResource res = vein.PrimaryResource;

                if (res == resource && res.Types.Length >= 3)
                {
                    try
                    {
                        Map map = from.Map;

                        if (map == null)
                        {
                            return;
                        }

                        //daat99 OWLTR start - gargoyle spawn
                        BaseCreature spawned = null;
                        try
                        {
                            int i_Level = CraftResources.GetIndex(CraftResources.GetFromType(type)) + 1;
                            if (i_Level > 1)
                            {
                                spawned = new Elementals(i_Level);
                            }
                        }
                        catch { }
                        if (spawned == null)
                        {
                            spawned = Activator.CreateInstance(res.Types[2], new object[] { 25 }) as BaseCreature;
                        }
                        ;
                        //daat99 OWLTR end - gargoyle spawn
                        //BaseCreature spawned = Activator.CreateInstance(res.Types[2], new object[] { 25 }) as BaseCreature;

                        if (spawned != null)
                        {
                            int offset = Utility.Random(8) * 2;

                            for (int i = 0; i < m_Offsets.Length; i += 2)
                            {
                                int x = from.X + m_Offsets[(offset + i) % m_Offsets.Length];
                                int y = from.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];

                                if (map.CanSpawnMobile(x, y, from.Z))
                                {
                                    spawned.OnBeforeSpawn(new Point3D(x, y, from.Z), map);
                                    spawned.MoveToWorld(new Point3D(x, y, from.Z), map);
                                    spawned.Combatant = from;
                                    return;
                                }
                                else
                                {
                                    int z = map.GetAverageZ(x, y);

                                    if (Math.Abs(z - from.Z) < 10 && map.CanSpawnMobile(x, y, z))
                                    {
                                        spawned.OnBeforeSpawn(new Point3D(x, y, z), map);
                                        spawned.MoveToWorld(new Point3D(x, y, z), map);
                                        spawned.Combatant = from;
                                        return;
                                    }
                                }
                            }

                            spawned.OnBeforeSpawn(from.Location, from.Map);
                            spawned.MoveToWorld(from.Location, from.Map);
                            spawned.Combatant = from;
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
示例#57
0
		public virtual void OnConcurrentHarvest( Mobile from, Item tool, HarvestDefinition def, object toHarvest )
		{
		}
示例#58
0
        private Fishing()
        {
            HarvestResource[] res;
            HarvestVein[]     veins;

            #region Fishing
            HarvestDefinition fish = new HarvestDefinition();

            // Resource banks are every 8x8 tiles
            fish.BankWidth  = 8;
            fish.BankHeight = 8;

            // Every bank holds from 5 to 15 fish
            fish.MinTotal = 5;
            fish.MaxTotal = 15;

            // A resource bank will respawn its content every 10 to 20 minutes
            fish.MinRespawn = TimeSpan.FromMinutes(10.0);
            fish.MaxRespawn = TimeSpan.FromMinutes(20.0);

            // Skill checking is done on the Fishing skill
            fish.Skill = SkillName.Fishing;

            // Set the list of harvestable tiles
            fish.Tiles       = m_WaterTiles;
            fish.RangedTiles = true;

            // Players must be within 4 tiles to harvest
            fish.MaxRange = 4;

            // One fish per harvest action
            fish.ConsumedPerHarvest        = 1;
            fish.ConsumedPerFeluccaHarvest = 1;

            // The fishing
            fish.EffectActions    = new int[] { 12 };
            fish.EffectSounds     = new int[0];
            fish.EffectCounts     = new int[] { 1 };
            fish.EffectDelay      = TimeSpan.Zero;
            fish.EffectSoundDelay = TimeSpan.FromSeconds(8.0);

            fish.NoResourcesMessage     = 503172; // The fish don't seem to be biting here.
            fish.FailMessage            = 503171; // You fish a while, but fail to catch anything.
            fish.TimedOutOfRangeMessage = 500976; // You need to be closer to the water to fish!
            fish.OutOfRangeMessage      = 500976; // You need to be closer to the water to fish!
            fish.PackFullMessage        = 503176; // You do not have room in your backpack for a fish.
            fish.ToolBrokeMessage       = 503174; // You broke your fishing pole.

            res = new HarvestResource[]
            {
                new HarvestResource(00.0, 00.0, 100.0, 1043297, typeof(Fish))
            };

            veins = new HarvestVein[]
            {
                new HarvestVein(100.0, 0.0, res[0], null)
            };

            fish.Resources = res;
            fish.Veins     = veins;

            if (Core.ML)
            {
                fish.BonusResources = new BonusHarvestResource[]
                {
                    new BonusHarvestResource(0, 99.4, null, null), //set to same chance as mining ml gems
                    new BonusHarvestResource(80.0, .6, 1113764, typeof(DelicateScales)),
                    new BonusHarvestResource(80.0, .6, 1072597, typeof(WhitePearl))
                };
            }

            this.m_Definition = fish;
            this.Definitions.Add(fish);
            #endregion
        }
示例#59
0
		public virtual void FinishHarvesting( Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked )
		{
			from.EndAction( locked );

			if ( !CheckHarvest( from, tool ) )
				return;

			int tileID;
			Map map;
			Point3D loc;

			if ( !GetHarvestDetails( from, tool, toHarvest, out tileID, out map, out loc ) )
			{
				OnBadHarvestTarget( from, tool, toHarvest );
				return;
			}
			else if ( !def.Validate( tileID ) )
			{
				OnBadHarvestTarget( from, tool, toHarvest );
				return;
			}
			
			if ( !CheckRange( from, tool, def, map, loc, true ) )
				return;
			else if ( !CheckResources( from, tool, def, map, loc, true ) )
				return;
			else if ( !CheckHarvest( from, tool, def, toHarvest ) )
				return;

			if ( SpecialHarvest( from, tool, def, map, loc ) )
				return;

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

			if ( bank == null )
				return;

			HarvestVein vein = bank.Vein;

			if ( vein != null )
				vein = MutateVein( from, tool, def, bank, toHarvest, vein );

			if ( vein == null )
				return;

			HarvestResource primary = vein.PrimaryResource;
			HarvestResource fallback = vein.FallbackResource;
			HarvestResource resource = MutateResource( from, tool, def, map, loc, vein, primary, fallback );

			double skillBase = from.Skills[def.Skill].Base;
			double skillValue = from.Skills[def.Skill].Value;

			Type type = null;

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

				if ( type != null )
					type = MutateType( type, from, tool, def, map, loc, resource );

				if ( type != null )
				{
					Item item = Construct( type, from );

					if ( item == null )
					{
						type = null;
					}
					else
					{
						//The whole harvest system is kludgy and I'm sure this is just adding to it.
						if ( item.Stackable )
						{
							int amount = def.ConsumedPerHarvest;
							int feluccaAmount = def.ConsumedPerFeluccaHarvest;

							int racialAmount = (int)Math.Ceiling( amount * 1.1 );
							int feluccaRacialAmount = (int)Math.Ceiling( feluccaAmount * 1.1 );

							bool eligableForRacialBonus = ( def.RaceBonus && from.Race == Race.Human );
							bool inFelucca = (map == Map.Felucca);

							if( eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount )
								item.Amount = feluccaRacialAmount;
							else if( inFelucca && bank.Current >= feluccaAmount )
								item.Amount = feluccaAmount;
							else if( eligableForRacialBonus && bank.Current >= racialAmount )
								item.Amount = racialAmount;
							else
								item.Amount = amount;
						}

						bank.Consume( item.Amount, from );

						if ( Give( from, item, def.PlaceAtFeetIfFull ) )
						{
							SendSuccessTo( from, item, resource );
						}
						else
						{
							SendPackFullTo( from, item, def, resource );
							item.Delete();
						}

						BonusHarvestResource bonus = def.GetBonusResource();

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

							if ( Give( from, bonusItem, true ) )	//Bonuses always allow placing at feet, even if pack is full irregrdless of def
							{
								bonus.SendSuccessTo( from );
							}
							else
							{
                                //28JUL2008 Typo in RC2 - SVN 295: in HarvestSystem.cs *** START ***
                                //item.Delete();
                                bonusItem.Delete();
                                //28JUL2008 Typo in RC2 - SVN 295: in HarvestSystem.cs *** END   ***
							}
						}

						if ( tool is IUsesRemaining )
						{
							IUsesRemaining toolWithUses = (IUsesRemaining)tool;

							toolWithUses.ShowUsesRemaining = true;

							if ( toolWithUses.UsesRemaining > 0 )
								--toolWithUses.UsesRemaining;

							if ( toolWithUses.UsesRemaining < 1 )
							{
								tool.Delete();
								def.SendMessageTo( from, def.ToolBrokeMessage );
							}
						}
					}
				}
			}

			if ( type == null )
				def.SendMessageTo( from, def.FailMessage );

			OnHarvestFinished( from, tool, def, vein, bank, resource, toHarvest );
		}
示例#60
0
 public override void OnHarvestStarted(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
 {
     from.SendSuccessMessage("You start lumberjacking...");
 }