當前位置: 首頁>>代碼示例>>C#>>正文


C# Harvest.HarvestDefinition類代碼示例

本文整理匯總了C#中Server.Engines.Harvest.HarvestDefinition的典型用法代碼示例。如果您正苦於以下問題:C# HarvestDefinition類的具體用法?C# HarvestDefinition怎麽用?C# HarvestDefinition使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HarvestDefinition類屬於Server.Engines.Harvest命名空間,在下文中一共展示了HarvestDefinition類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Consume

        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;
        }
開發者ID:FreeReign,項目名稱:imaginenation,代碼行數:26,代碼來源:HarvestBank.cs

示例2: HarvestBank

 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;
 }
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:7,代碼來源:HarvestBank.cs

示例3: CheckRange

		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;
		}
開發者ID:greeduomacro,項目名稱:annox,代碼行數:9,代碼來源:HarvestSystem.cs

示例4: Fishing

		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
		}
開發者ID:greeduomacro,項目名稱:UO-Forever,代碼行數:57,代碼來源:Fishing.cs

示例5: HarvestSoundTimer

		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;
		}
開發者ID:Godkong,項目名稱:RunUO,代碼行數:10,代碼來源:HarvestSoundTimer.cs

示例6: HarvestTimer

		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 );
		}
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:10,代碼來源:HarvestTimer.cs

示例7: HarvestBank

        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;
        }
開發者ID:Ravenwolfe,項目名稱:xrunuo,代碼行數:10,代碼來源:HarvestBank.cs

示例8: CheckResources

		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;
		}
開發者ID:greeduomacro,項目名稱:annox,代碼行數:10,代碼來源:HarvestSystem.cs

示例9: GetLock

 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;
 }
開發者ID:mcarriere,項目名稱:ServUO,代碼行數:11,代碼來源:HarvestSystem.cs

示例10: HarvestTimer

        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);
        }
開發者ID:FreeReign,項目名稱:imaginenation,代碼行數:16,代碼來源:HarvestTimer.cs

示例11: Consume

        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;
        }
開發者ID:FreeReign,項目名稱:Rebirth-Repack,代碼行數:20,代碼來源:HarvestBank.cs

示例12: Consume

		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;
		}
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:21,代碼來源:HarvestBank.cs

示例13: OnHarvestFinished

		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;
				}
			}
*/
		}
開發者ID:ITLongwell,項目名稱:aedilis2server,代碼行數:21,代碼來源:NecroReagentGathering.cs

示例14: DoHarvestingEffect

		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 );
		}
開發者ID:greeduomacro,項目名稱:annox,代碼行數:7,代碼來源:HarvestSystem.cs

示例15: Lumberjacking

        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;
//.........這裏部分代碼省略.........
開發者ID:FreeReign,項目名稱:forkuo,代碼行數:101,代碼來源:Lumberjacking.cs


注:本文中的Server.Engines.Harvest.HarvestDefinition類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。