当前位置: 首页>>代码示例>>C#>>正文


C# HarvestDefinition.SendMessageTo方法代码示例

本文整理汇总了C#中Server.Engines.Harvest.HarvestDefinition.SendMessageTo方法的典型用法代码示例。如果您正苦于以下问题:C# HarvestDefinition.SendMessageTo方法的具体用法?C# HarvestDefinition.SendMessageTo怎么用?C# HarvestDefinition.SendMessageTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.Engines.Harvest.HarvestDefinition的用法示例。


在下文中一共展示了HarvestDefinition.SendMessageTo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例3: FinishHarvesting


//.........这里部分代码省略.........

			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 );
		}
开发者ID:greeduomacro,项目名称:annox,代码行数:101,代码来源:HarvestSystem.cs

示例4: SendPackFullTo

		public virtual void SendPackFullTo( Mobile from, Item item, HarvestDefinition def, HarvestResource resource )
		{
			def.SendMessageTo( from, def.PackFullMessage );
		}
开发者ID:greeduomacro,项目名称:annox,代码行数:4,代码来源:HarvestSystem.cs

示例5: 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 && !(this is Fishing) )
            {
                Regions.GuardedRegion reg = Region.Find(loc, map).GetRegion(typeof(Regions.GuardedRegion)) as Regions.GuardedRegion;

                if (reg != null && !reg.Disabled)
                    available = false;
            }

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

            return available;
        }
开发者ID:greeduomacro,项目名称:divinity,代码行数:18,代码来源:HarvestSystem.cs

示例6: FinishHarvesting


//.........这里部分代码省略.........
            }
            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
                    {
                        if ( item.Stackable )
                        {
                            if ( map == Map.Felucca && bank.Current >= 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.SendMessageTo( from, def.ToolBrokeMessage );
                            }
                        }
                    }
                }
            }

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

            OnHarvestFinished( from, tool, def, vein, bank, resource, toHarvest );
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:101,代码来源:HarvestSystem.cs

示例7: FinishHarvesting

        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);
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:98,代码来源:Fishing.cs

示例8: FinishHarvesting


//.........这里部分代码省略.........
			Type type = null;

            //Gain the skill
            from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill);

            //hacky All harvest now has 15 percent, if you can mine them.
			if ( skillBase >= resource.ReqSkill && 0.15 < Utility.RandomDouble())
			{
				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
					{
                        //bool spawnNew = false;
						//The whole harvest system is kludgy and I'm sure this is just adding to it.
						if ( item.Stackable )
						{
							int amount = GetOreAmount(vein);
							int racialAmount = (int)Math.Ceiling( amount * 1.1 );

							bool eligableForRacialBonus = ( def.RaceBonus && from.Race == Race.Human );

							if( eligableForRacialBonus && bank.Current >= racialAmount )
								item.Amount = racialAmount;
							else if( bank.Current >= amount )
								item.Amount = amount;
							else
								item.Amount = bank.Current;
								
							//if ( bank.Current <= item.Amount)
								//spawnNew = true;
								
						}

                        bank.Consume(def, item.Amount, from);

                        //Maka
                        //if (spawnNew)
                        //    bank.Vein = def.GetVeinAt(from.Map, from.Location.X, from.Location.Y);

						if ( Give( from, item, /*def.PlaceAtFeetIfFull*/true ) ) //Is there something we dont want to place at the feet
						{
							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 );
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:101,代码来源:HarvestSystem.cs

示例9: FinishHarvesting


//.........这里部分代码省略.........

                    Container pack = from.Backpack;
                    if (pack == null)
                    {
                        from.SendMessage("Why don't you have a pack?");
                        trsource.Delete();
                        return;
                    }
                    Item tap = pack.FindItemByType(typeof(BarrelTap));

                    if (trsource.ResourceType == TreeResourceType.SapJuice && tap == null)
                    {
                        from.SendMessage("You need a barrel tap to sap this tree.");
                        trsource.Delete();
                        return;
                    }
                    if (trsource.ResourceType == TreeResourceType.SapJuice)
                        trsource.Amount = 1;

                    bank.Consume(trsource.Amount, from);

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

                        toolWithUses.ShowUsesRemaining = true;

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

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

                    if (trsource.ResourceType != TreeResourceType.SapJuice || pack.ConsumeTotal(typeof(EmptyJar), 1))
                    {
                        if (trsource.ResourceType == TreeResourceType.SapJuice && 0.12 >= Utility.RandomDouble())
                        {
                            from.SendMessage("Your tap broke in the process, and is now gone.");
                            tap.Delete();
                        }

                        if (Give(from, trsource, def.PlaceAtFeetIfFull))
                        {
                            SendSuccessTo(from, trsource, resource);
                            gave = true;
                        }
                        else
                        {
                            SendPackFullTo(from, trsource, def, resource);
                            trsource.Delete();
                            return;
                        }
                    }
                    else
                    {
                        from.SendMessage("You don't have an empty jar to hold the sap, so it was lost!");
                        trsource.Delete();
                        return;
                    }
                }
                else
                    trsource.Delete();
开发者ID:greeduomacro,项目名称:RuneUO,代码行数:67,代码来源:TreeHarvest.cs


注:本文中的Server.Engines.Harvest.HarvestDefinition.SendMessageTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。