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


C# CraftSystem.CanCraft方法代码示例

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


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

示例1: Do

	    public static void Do( Mobile from, CraftSystem craftSystem, BaseTool tool )
		{
			int num = craftSystem.CanCraft( from, tool, null );

            if (num > 0 && num != 1044267)
                from.SendGump(new CraftGump(from, craftSystem, tool, num));
			else
			{
				from.Target = new InternalTarget( craftSystem, tool );
				from.SendLocalizedMessage( 1044273 ); // Target an item to recycle.
			}
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:12,代码来源:Resmelt.cs

示例2: Do

        public static void Do( Mobile from, CraftSystem craftSystem, BaseTool tool )
        {
            string num = craftSystem.CanCraft( from, tool, null );

            if ( num != "" )
            {
                from.SendGump( new CraftGump( from, craftSystem, tool, num ) );
            }
            else
            {
                from.Target = new InternalTarget( craftSystem, tool );
                from.SendAsciiMessage( "Target an item to recycle." );
            }
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:14,代码来源:Resmelt.cs

示例3: PublicOnTarget

        public static void PublicOnTarget( Mobile from, object targeted, CraftSystem m_CraftSystem, BaseTool m_Tool )
        {
            int num = m_CraftSystem.CanCraft( from, m_Tool, null );

            if ( num > 0 )
            {
                from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, num ) );
            }
            else
            {
                bool success = false;
                bool isStoreBought = false;

                if ( targeted is BaseArmor )
                {
                    success = PublicResmelt( from, (BaseArmor)targeted, ((BaseArmor)targeted).Resource, m_CraftSystem );
                    isStoreBought = false;
                }
                else if ( targeted is BaseWeapon )
                {
                    success = PublicResmelt( from, (BaseWeapon)targeted, ((BaseWeapon)targeted).Resource, m_CraftSystem );
                    isStoreBought = false;
                }
                else if ( targeted is DragonBardingDeed )
                {
                    success = PublicResmelt( from, (DragonBardingDeed)targeted, ((DragonBardingDeed)targeted).Resource, m_CraftSystem );
                    isStoreBought = false;
                }
                else if ( targeted is BaseJewel )
                {
                    success = SmeltJewelry( from, (BaseJewel)targeted );
                    isStoreBought = false;
                }

                if ( success )
                    from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, isStoreBought ? 500418 : 1044270 ) ); // You melt the item down into ingots.
                else
                    from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, 1044272 ) ); // You can't melt that down into ingots.
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:40,代码来源:Resmelt.cs

示例4: Craft

        public void Craft( Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool )
        {
            if ( from.BeginAction( typeof( CraftSystem ) ) )
            {
                int flags = from.NetState == null ? 0 : from.NetState.Flags;

                if( !RequiresSE || (flags & 0x10) != 0 )// SE 2D = 0x1F SE 3D = 0x11F
                {
                bool allRequiredSkills = true;
                double chance = GetSuccessChance( from, typeRes, craftSystem, false, ref allRequiredSkills );

                if ( allRequiredSkills && chance >= 0.0 )
                {
                    string badCraft = craftSystem.CanCraft( from, tool, m_Type );

                    if ( badCraft == "" )
                    {
                        int resHue = 0;
                        int maxAmount = 0;
                        object message = null;

                        if ( ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message ) )
                        {
                            message = null;

                            if ( ConsumeAttributes( from, ref message, false ) )
                            {
                                CraftContext context = craftSystem.GetContext( from );

                                if ( context != null )
                                    context.OnMade( this );

                                int iMin = craftSystem.MinCraftEffect;
                                int iMax = ( craftSystem.MaxCraftEffect - iMin ) + 1;
                                int iRandom = Utility.Random( iMax );
                                iRandom += iMin + 1;
                                new InternalTimer( from, craftSystem, this, typeRes, tool, iRandom ).Start();
                            }
                            else
                            {
                                from.EndAction( typeof( CraftSystem ) );
                                from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
                            }
                        }
                        else
                        {
                            from.EndAction( typeof( CraftSystem ) );
                            from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
                        }
                    }
                    else
                    {
                        from.EndAction( typeof( CraftSystem ) );
                        from.SendGump( new CraftGump( from, craftSystem, tool, badCraft ) );
                    }
                }
                else
                {
                    from.EndAction( typeof( CraftSystem ) );
                    from.SendGump( new CraftGump( from, craftSystem, tool, 1044153 ) ); // You don't have the required skills to attempt this item.
                }

                }
                else
                {
                    from.EndAction( typeof( CraftSystem ) );
                    from.SendGump( new CraftGump( from, craftSystem, tool, 1063307 ) ); //The "Samurai Empire" expansion is required to attempt this item.
                }
            }
            else
            {
                from.SendAsciiMessage( "You must wait to perform another action." );
            }
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:74,代码来源:CraftItem.cs

示例5: CompleteCraft

		public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft, bool showGumps)
		{
			int badCraft = craftSystem.CanCraft(from, tool, m_Type);

            if (badCraft > 0)
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
                else
                    from.SendLocalizedMessage(badCraft);

                return;
            }

		    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
		    {
		        if (tool.CraftSystem == DefBlacksmithy.CraftSystem)
		        {
		            if (from.FindItemOnLayer(Layer.OneHanded) != tool)
		            {
		                from.SendGump(new CraftGump(from, craftSystem, tool, string.Format("You must have your smith hammer equipped!")));
		                return;
		            }
		        }
		        else
		        {
		            if (!tool.IsChildOf(from.Backpack))
		            {
		                from.SendGump(new CraftGump(from, craftSystem, tool, string.Format("You must have your tool in your backpack!")));
		                return;
		            }
		        }
		    }
		    else
		    {
		        from.SendLocalizedMessage(badCraft);
		        return;
		    }


		    object checkMessage = null;
			int checkResHue = 0, checkMaxAmount = 0;
			
			// Not enough resource to craft it
			if ( !ConsumeRes( from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage ) )
			{
                if (!tool.Deleted && tool.UsesRemaining > 0)
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                else if (checkMessage is int && (int)checkMessage > 0)
                    from.SendLocalizedMessage((int)checkMessage);
                else if (checkMessage is string)
                    from.SendMessage((string)checkMessage);

				return;
			}
			if (!ConsumeAttributes(from, ref checkMessage, false))
			{
				if (!tool.Deleted && tool.UsesRemaining > 0)
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
				else if (checkMessage is int && (int)checkMessage > 0)
					from.SendLocalizedMessage((int)checkMessage);
				else if (checkMessage is string)
					from.SendMessage((string)checkMessage);

				return;
			}

			bool toolBroken = false;

			int ignored = 1;
			int endquality = 1;

			bool allRequiredSkills = true;

			if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills))
			{
				// Resource
				int resHue = 0;
				int maxAmount = 0;

				object message = null;

				// Not enough resource to craft it
				if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message))
				{
					if (!tool.Deleted && tool.UsesRemaining > 0)
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
					else if (message is int && (int)message > 0)
						from.SendLocalizedMessage((int)message);
					else if (message is string)
						from.SendMessage((string)message);

					return;
				}
			    if (!ConsumeAttributes(from, ref message, true))
			    {
			        if (!tool.Deleted && tool.UsesRemaining > 0)
			            from.SendGump(new CraftGump(from, craftSystem, tool, message));
			        else if (message is int && (int)message > 0)
			            from.SendLocalizedMessage((int)message);
//.........这里部分代码省略.........
开发者ID:FreeReign,项目名称:imaginenation,代码行数:101,代码来源:CraftItem.cs

示例6: Craft

		public void Craft(Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool)
		{
			if (from.BeginAction(typeof(CraftSystem)))
			{
				if (RequiredExpansion == Expansion.None ||
					(from.NetState != null && from.NetState.SupportsExpansion(RequiredExpansion)))
				{
					bool allRequiredSkills = true;
					double chance = GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);

					if (allRequiredSkills && chance >= 0.0)
					{
                        if (Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe(Recipe))
                        {
                            if (!RequiresBasketWeaving || (from is PlayerMobile && ((PlayerMobile)from).BasketWeaving))
                            {
                                if (!RequiresMechanicalLife || (from is PlayerMobile && ((PlayerMobile)from).MechanicalLife))
                                {
                                    int badCraft = craftSystem.CanCraft(from, tool, m_Type);

                                    if (badCraft <= 0)
                                    {
                                        if (RequiresResTarget && NeedsResTarget(from, craftSystem))
                                        {
                                            from.Target = new ChooseResTarget(from, this, craftSystem, typeRes, tool);
                                            from.SendMessage("Choose the resource you would like to use.");
                                            return;
                                        }

                                        int resHue = 0;
                                        int maxAmount = 0;
                                        object message = null;

                                        if (ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message))
                                        {
                                            message = null;

                                            if (ConsumeAttributes(from, ref message, false))
                                            {
                                                CraftContext context = craftSystem.GetContext(from);

                                                if (context != null)
                                                {
                                                    context.OnMade(this);
                                                }

                                                int iMin = craftSystem.MinCraftEffect;
                                                int iMax = (craftSystem.MaxCraftEffect - iMin) + 1;
                                                int iRandom = Utility.Random(iMax);
                                                iRandom += iMin + 1;
                                                new InternalTimer(from, craftSystem, this, typeRes, tool, iRandom).Start();
                                                return;
                                            }
                                            else
                                            {
                                                from.EndAction(typeof(CraftSystem));
                                                from.SendGump(new CraftGump(from, craftSystem, tool, message));
                                            }
                                        }
                                        else
                                        {
                                            from.EndAction(typeof(CraftSystem));
                                            from.SendGump(new CraftGump(from, craftSystem, tool, message));
                                        }
                                    }
                                    else
                                    {
                                        from.EndAction(typeof(CraftSystem));
                                        from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
                                    }
                                }
                                else
                                {
                                    from.EndAction(typeof(CraftSystem));
                                    from.SendGump(new CraftGump(from, craftSystem, tool, 1113034)); // You haven't read the Mechanical Life Manual. Talking to Sutek might help!
                                }
                            }
                            else
                            {
                                from.EndAction(typeof(CraftSystem));
                                from.SendGump(new CraftGump(from, craftSystem, tool, 1112253)); // You haven't learned basket weaving. Perhaps studying a book would help!
                            }
                        }
                        else
                        {
                            from.EndAction(typeof(CraftSystem));
                            from.SendGump(new CraftGump(from, craftSystem, tool, 1072847)); // You must learn that recipe from a scroll.
                        }
					}
					else
					{
						from.EndAction(typeof(CraftSystem));
						from.SendGump(new CraftGump(from, craftSystem, tool, 1044153));
						// You don't have the required skills to attempt this item.
					}
				}
				else
				{
					from.EndAction(typeof(CraftSystem));
					from.SendGump(new CraftGump(from, craftSystem, tool, RequiredExpansionMessage(RequiredExpansion)));
//.........这里部分代码省略.........
开发者ID:Crome696,项目名称:ServUO,代码行数:101,代码来源:CraftItem.cs

示例7: CompleteCraft

		public void CompleteCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft )
		{
			int badCraft = craftSystem.CanCraft( from, tool, m_Type );

			if ( badCraft > 0 )
			{
				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, badCraft ) );
				else
					from.SendLocalizedMessage( badCraft );

				return;
			}

			int checkResHue = 0, checkMaxAmount = 0;
			object checkMessage = null;

			// Not enough resource to craft it
			if ( !ConsumeRes( from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage ) )
			{
				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, checkMessage ) );
				else if ( checkMessage is int && (int)checkMessage > 0 )
					from.SendLocalizedMessage( (int)checkMessage );
				else if ( checkMessage is string )
					from.SendMessage( (string)checkMessage );

				return;
			}
			else if ( !ConsumeAttributes( from, ref checkMessage, false ) )
			{
				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, checkMessage ) );
				else if ( checkMessage is int && (int)checkMessage > 0 )
					from.SendLocalizedMessage( (int)checkMessage );
				else if ( checkMessage is string )
					from.SendMessage( (string)checkMessage );

				return;
			}

			bool toolBroken = false;

			int ignored = 1;
			int endquality = 1;

			bool allRequiredSkills = true;

			if ( CheckSkills( from, typeRes, craftSystem, ref ignored, ref allRequiredSkills ) )
			{
				// Resource
				int resHue = 0;
				int maxAmount = 0;

				object message = null;

				// Not enough resource to craft it
				if ( !ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message ) )
				{
					if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
						from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
					else if ( message is int && (int)message > 0 )
						from.SendLocalizedMessage( (int)message );
					else if ( message is string )
						from.SendMessage( (string)message );

					return;
				}
				else if ( !ConsumeAttributes( from, ref message, true ) )
				{
					if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
						from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
					else if ( message is int && (int)message > 0 )
						from.SendLocalizedMessage( (int)message );
					else if ( message is string )
						from.SendMessage( (string)message );

					return;
				}

				tool.UsesRemaining--;

				if ( craftSystem is DefBlacksmithy )
				{
					AncientSmithyHammer hammer = from.FindItemOnLayer( Layer.OneHanded ) as AncientSmithyHammer;
					if ( hammer != null && hammer != tool )
					{
						hammer.UsesRemaining--;
						if ( hammer.UsesRemaining < 1 )
							hammer.Delete();
					}
				}

				if ( tool.UsesRemaining < 1 )
					toolBroken = true;

				if ( toolBroken )
					tool.Delete();

				int num = 0;
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:101,代码来源:CraftItem.cs

示例8: Craft

		public void Craft( Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool )
		{
			if ( from.BeginAction( typeof( CraftSystem ) ) )
			{
				if( RequiredExpansion == Expansion.None || ( from.NetState != null && from.NetState.SupportsExpansion( RequiredExpansion ) ) )
				{
					bool allRequiredSkills = true;
					double chance = GetSuccessChance( from, typeRes, craftSystem, false, ref allRequiredSkills );

					if ( allRequiredSkills && chance >= 0.0 )
					{
						if( this.Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe( this.Recipe ) )
						{
							int badCraft = craftSystem.CanCraft( from, tool, m_Type );

							if( badCraft <= 0 )
							{
								int resHue = 0;
								int maxAmount = 0;
								object message = null;

								if( ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message ) )
								{
									message = null;

									if( ConsumeAttributes( from, ref message, false ) )
									{
										CraftContext context = craftSystem.GetContext( from );

										if( context != null )
											context.OnMade( this );

										int iMin = craftSystem.MinCraftEffect;
										int iMax = (craftSystem.MaxCraftEffect - iMin) + 1;
										int iRandom = Utility.Random( iMax );
										iRandom += iMin + 1;
										new InternalTimer( from, craftSystem, this, typeRes, tool, iRandom ).Start();
									}
									else
									{
										from.EndAction( typeof( CraftSystem ) );
										from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
									}
								}
								else
								{
									from.EndAction( typeof( CraftSystem ) );
									from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
								}
							}
							else
							{
								from.EndAction( typeof( CraftSystem ) );
								from.SendGump( new CraftGump( from, craftSystem, tool, badCraft ) );
							}
						}
						else
						{
							from.EndAction( typeof( CraftSystem ) );
							from.SendGump( new CraftGump( from, craftSystem, tool, 1072847 ) ); // You must learn that recipe from a scroll.
						}
					}
					else
					{
						from.EndAction( typeof( CraftSystem ) );
						from.SendGump( new CraftGump( from, craftSystem, tool, 1044153 ) ); // You don't have the required skills to attempt this item.
					}
				}
				else
				{
					from.EndAction( typeof( CraftSystem ) );
					from.SendGump( new CraftGump( from, craftSystem, tool, RequiredExpansionMessage( RequiredExpansion ) ) ); //The {0} expansion is required to attempt this item.
				}
			}
			else
			{
				from.SendLocalizedMessage( 500119 ); // You must wait to perform another action
			}
		}
开发者ID:Leodinas,项目名称:uolite,代码行数:79,代码来源:CraftItem.cs

示例9: Invoke

		public static EnhanceResult Invoke( Mobile from, CraftSystem craftSystem, BaseTool tool, Item item, CraftResource resource, Type resType, ref object resMessage )
		{
			if( item == null )
				return EnhanceResult.BadItem;

			if( !item.IsChildOf( from.Backpack ) )
				return EnhanceResult.NotInBackpack;

			if( !(item is BaseArmor) && !(item is BaseWeapon) )
				return EnhanceResult.BadItem;

			if( CraftResources.IsStandard( resource ) )
				return EnhanceResult.BadResource;

			int num = craftSystem.CanCraft( from, tool, item.GetType() );
			
			if ( num > 0 )
			{
				resMessage = num;
				return EnhanceResult.None;
			}

			CraftItem craftItem = craftSystem.CraftItems.SearchFor( item.GetType() );

			if ( craftItem == null || craftItem.Resources.Count == 0 )
				return EnhanceResult.BadItem;

			bool allRequiredSkills = false;
			if( craftItem.GetSuccessChance( from, resType, craftSystem, false, ref allRequiredSkills ) <= 0.0 )
				return EnhanceResult.NoSkill;

			CraftResourceInfo info = CraftResources.GetInfo( resource );

			if( info == null || info.ResourceTypes.Length == 0 )
				return EnhanceResult.BadResource;

			CraftAttributeInfo attributes = info.AttributeInfo;

			if( attributes == null )
				return EnhanceResult.BadResource;

			int resHue = 0, maxAmount = 0;

			if( !craftItem.ConsumeRes( from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref resMessage ) )
				return EnhanceResult.NoResources;

			if( craftSystem is DefBlacksmithy )
			{
				AncientSmithyHammer hammer = from.FindItemOnLayer( Layer.OneHanded ) as AncientSmithyHammer;
				if( hammer != null )
				{
					hammer.UsesRemaining--;
					if( hammer.UsesRemaining < 1 )
						hammer.Delete();
				}
			}

			int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0;
			int dura = 0, dinc = 0;
			int baseChance = 0;

			bool physBonus = false;
			bool fireBonus = false;
			bool coldBonus = false;
			bool nrgyBonus = false;
			bool poisBonus = false;
			bool duraBonus = false;
			bool dincBonus = false;

			double arms = from.Skills[SkillName.ArmsLore].Base;

			if( item is BaseWeapon )
			{
				BaseWeapon weapon = (BaseWeapon)item;

				if( !CraftResources.IsStandard( weapon.Resource ) )
					return EnhanceResult.AlreadyEnhanced;

				if( arms >= 100.1 )
					baseChance = Utility.RandomMinMax( 2, 5 );
				else if( arms >= 80.1 && arms <= 100 )
					baseChance = Utility.RandomMinMax( 8, 14 );
				else if( arms >= 50 && arms <= 80 )
					baseChance = Utility.RandomMinMax( 16, 20 );
				else
					baseChance = 25;
			}
			else
			{
				BaseArmor armor = (BaseArmor)item;

				if( !CraftResources.IsStandard( armor.Resource ) )
					return EnhanceResult.AlreadyEnhanced;

				if( arms >= 100.1 )
					baseChance = Utility.RandomMinMax( 2, 5 );
				else if( arms >= 80.1 && arms <= 100 )
					baseChance = Utility.RandomMinMax( 8, 14 );
				else if( arms >= 50 && arms <= 80 )
					baseChance = Utility.RandomMinMax( 16, 20 );
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:hubroot,代码行数:101,代码来源:Enhance.cs

示例10: CompleteCraft

		public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool)
		{
			int badCraft = craftSystem.CanCraft(from, tool, m_Type);

			if (badCraft > 0)
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
				else
					from.SendLocalizedMessage(badCraft);

				return;
			}

			int checkResHue = 0, checkMaxAmount = 0;
			object checkMessage = null;

			// Not enough resource to craft it
			if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage))
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
				else if (checkMessage is int && (int)checkMessage > 0)
					from.SendLocalizedMessage((int)checkMessage);
				else if (checkMessage is string)
					from.SendMessage((string)checkMessage);

				return;
			}
			else if (!ConsumeAttributes(from, ref checkMessage, false))
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
				else if (checkMessage is int && (int)checkMessage > 0)
					from.SendLocalizedMessage((int)checkMessage);
				else if (checkMessage is string)
					from.SendMessage((string)checkMessage);

				return;
			}

			bool toolBroken = false;
			int ignored = 1;
			int endquality = 1;
			bool allRequiredSkills = true;

			// pla, 01/04/07
			// -----------------------------------------------------------------
			// Additional checks required here to prevent skill gain exploit with special dye tubs.               
			if (craftSystem is DefAlchemy && (ItemType == typeof(SpecialDyeTub) || ItemType == typeof(SpecialDye)))
			{
				// note here that if lighten or darken was chosen, there will always be at least one special tub,
				// as it's set as a resource requirement.
				if (m_NameString == "> Darken the mix" || m_NameString == "> Lighten the mix")
				{
					// darken/lighten requires a special tub
					// Get list of all special tubs
					Item[] sdtubs = ((Container)from.Backpack).FindItemsByType(typeof(SpecialDyeTub), true);
					SpecialDyeTub sdtub;

					if (sdtubs.Length == 0)
					{
						//should be impossible as in reqs
						return;
					}
					else if (sdtubs.Length == 1)
					{
						// in this case we have just one tub.  This means we will leave skill gain and execution to the 
						// standard craft code below.  However, we need to first check if the tub can be lightened/darkened,
						// and if not then return to prevent skill gain with no resource use.
						sdtub = (SpecialDyeTub)sdtubs[0];
						if (sdtub != null)
						{
							if (m_NameString == "> Darken the mix")
							{
								if (!sdtub.CanDarken)
								{
									from.SendMessage("You attempt to darken the mix, but it will go no darker.");
									from.SendGump(new CraftGump(from, craftSystem, tool, 0));
									return;
								}
							}
							else
							{
								if (!sdtub.CanLighten)
								{
									from.SendMessage("You attempt to lighten the mix, but it will go no lighter.");
									from.SendGump(new CraftGump(from, craftSystem, tool, 0));
									return;
								}
							}
						}

					}
					else if (sdtubs.Length > 1)
					{
						// in this case we have more than one possible tub to select so we hand execution over to the target.
						//target also deals with all skill gain and failure/tool use etc.
						int resHue = 0;
						int maxAmount = 0;
//.........这里部分代码省略.........
开发者ID:zerodowned,项目名称:angelisland,代码行数:101,代码来源:CraftItem.cs

示例11: CompleteCraft

		public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft)
		{
			int badCraft = craftSystem.CanCraft(from, tool, m_Type);

			if (badCraft > 0)
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
				else
					from.SendLocalizedMessage(badCraft);

				return;
			}

			int checkResHue = 0, checkMaxAmount = 0;
			object checkMessage = null;

			// Not enough resource to craft it
			if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage))
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
				else if (checkMessage is int && (int)checkMessage > 0)
					from.SendLocalizedMessage((int)checkMessage);
				else if (checkMessage is string)
					from.SendMessage((string)checkMessage);

				return;
			}
			else if (!ConsumeAttributes(from, ref checkMessage, false))
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
				else if (checkMessage is int && (int)checkMessage > 0)
					from.SendLocalizedMessage((int)checkMessage);
				else if (checkMessage is string)
					from.SendMessage((string)checkMessage);

				return;
			}

			bool toolBroken = false;

			int ignored = 1;
			int endquality = 1;

			bool allRequiredSkills = true;

			if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills))
			{
				// Resource
				int resHue = 0;
				int maxAmount = 0;

				object message = null;

				// Not enough resource to craft it
				if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message))
				{
					if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
						from.SendGump(new CraftGump(from, craftSystem, tool, message));
					else if (message is int && (int)message > 0)
						from.SendLocalizedMessage((int)message);
					else if (message is string)
						from.SendMessage((string)message);

					return;
				}
				else if (!ConsumeAttributes(from, ref message, true))
				{
					if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
						from.SendGump(new CraftGump(from, craftSystem, tool, message));
					else if (message is int && (int)message > 0)
						from.SendLocalizedMessage((int)message);
					else if (message is string)
						from.SendMessage((string)message);

					return;
				}

				tool.UsesRemaining--;

				if (craftSystem is DefBlacksmithy)
				{
					AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer;

					if (hammer != null && hammer != tool)
					{
						#region Mondain's Legacy
						if (hammer is HammerOfHephaestus)
						{
							if (hammer.UsesRemaining > 0)
								hammer.UsesRemaining--;

							if (hammer.UsesRemaining < 1)
								from.PlaceInBackpack(hammer);
						}
						else
						{
							hammer.UsesRemaining--;
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:dragonknights-uo,代码行数:101,代码来源:CraftItem.cs

示例12: CompleteCraft

        public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft)
        {
            int badCraft = craftSystem.CanCraft(from, tool, m_Type);

            if (badCraft > 0)
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
                else
                    from.SendLocalizedMessage(badCraft);

                return;
            }

            int checkResHue = 0, checkMaxAmount = 0;
            object checkMessage = null;

            // Not enough resource to craft it
            if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                else if (checkMessage is int && (int)checkMessage > 0)
                    from.SendLocalizedMessage((int)checkMessage);
                else if (checkMessage is string)
                    from.SendMessage((string)checkMessage);

                return;
            }
            else if (!ConsumeAttributes(from, ref checkMessage, false))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                else if (checkMessage is int && (int)checkMessage > 0)
                    from.SendLocalizedMessage((int)checkMessage);
                else if (checkMessage is string)
                    from.SendMessage((string)checkMessage);

                return;
            }

            bool toolBroken = false;

            int ignored = 1;
            int endquality = 1;

            bool allRequiredSkills = true;

            if (CheckSkills(from, craftSystem, ref ignored, ref allRequiredSkills))
            {
                // Resource
                int resHue = 0;
                int maxAmount = 0;

                object message = null;

                // Not enough resource to craft it
                if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    else if (message is int && (int)message > 0)
                        from.SendLocalizedMessage((int)message);
                    else if (message is string)
                        from.SendMessage((string)message);

                    return;
                }
                else if (!ConsumeAttributes(from, ref message, true))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    else if (message is int && (int)message > 0)
                        from.SendLocalizedMessage((int)message);
                    else if (message is string)
                        from.SendMessage((string)message);

                    return;
                }

                tool.UsesRemaining--;

                if (tool.UsesRemaining < 1 && tool.BreakOnDepletion)
                    toolBroken = true;

                if (toolBroken)
                    tool.Delete();

                int num = 0;

                Item item;
                if (customCraft != null)
                {
                    item = customCraft.CompleteCraft(out num);
                }
                else if (typeof(MapItem).IsAssignableFrom(ItemType) && from.Map != Map.Felucca)
                {
                    item = new IndecipherableMap();
                    from.SendLocalizedMessage(1070800); // The map you create becomes mysteriously indecipherable.
                }
//.........这里部分代码省略.........
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:101,代码来源:CraftItem.cs

示例13: CraftItem

        public static void CraftItem( CraftItem item, CraftSystem system, Mobile from, BaseTool tool )
        {
            int num = system.CanCraft( from, tool, item.ItemType );
            CraftContext context = system.GetContext( from );

            if ( context == null )
                return;

            if ( num > 0 )
            {
                context.Making = null;

                from.SendGump( new CraftGump( from, system, tool, num ) );
            }
            else
            {
                context.Making = item;

                Type type = null;

                CraftSubResCol res = ( item.UseSubRes2 ? system.CraftSubRes2 : system.CraftSubRes );
                int resIndex = ( item.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex );

                if ( resIndex >= 0 && resIndex < res.Count )
                    type = res.GetAt( resIndex ).ItemType;

                system.CreateItem( from, item.ItemType, type, tool, item );
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:29,代码来源:CraftGump.cs

示例14: CompleteCraft

        public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft)
        {
            int badCraft = craftSystem.CanCraft(from, tool, m_Type);

            if (badCraft > 0)
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
                else
                    from.SendLocalizedMessage(badCraft);

                return;
            }

            int checkResHue = 0, checkMaxAmount = 0;
            object checkMessage = null;

            // Not enough resource to craft it
            if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                else if (checkMessage is int && (int)checkMessage > 0)
                    from.SendLocalizedMessage((int)checkMessage);
                else if (checkMessage is string)
                    from.SendMessage((string)checkMessage);

                return;
            }
            else if (!ConsumeAttributes(from, ref checkMessage, false))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                else if (checkMessage is int && (int)checkMessage > 0)
                    from.SendLocalizedMessage((int)checkMessage);
                else if (checkMessage is string)
                    from.SendMessage((string)checkMessage);

                return;
            }

            bool toolBroken = false;

            int ignored = 1;
            int endquality = 1;

            bool allRequiredSkills = true;

            if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills))
            {
                // Resource
                int resHue = 0;
                int maxAmount = 0;

                object message = null;

                // Not enough resource to craft it
                if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    else if (message is int && (int)message > 0)
                        from.SendLocalizedMessage((int)message);
                    else if (message is string)
                        from.SendMessage((string)message);

                    return;
                }
                else if (!ConsumeAttributes(from, ref message, true))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    else if (message is int && (int)message > 0)
                        from.SendLocalizedMessage((int)message);
                    else if (message is string)
                        from.SendMessage((string)message);

                    return;
                }

                tool.UsesRemaining--;

                if (craftSystem is DefBlacksmithy)
                {
                    AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer;
                    if (hammer != null && hammer != tool)
                    {
                        #region Mondain's Legacy
                        if (hammer is HammerOfHephaestus)
                        {
                            if (hammer.UsesRemaining > 0)
                                hammer.UsesRemaining--;

                            if (hammer.UsesRemaining < 1)
                                from.PlaceInBackpack(hammer);
                        }
                        else
                        {
                            hammer.UsesRemaining--;

//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:101,代码来源:CraftItem.cs

示例15: CompleteCraft

		public void CompleteCraft(
			int quality,
			bool makersMark,
			Mobile from,
			CraftSystem craftSystem,
			Type typeRes,
			BaseTool tool,
			CustomCraft customCraft)
		{
			int badCraft = craftSystem.CanCraft(from, tool, m_Type);

			if (badCraft > 0)
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
				{
					from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
				}
				else
				{
					from.SendLocalizedMessage(badCraft);
				}

                AutoCraftTimer.EndTimer(from);

				return;
			}

			int checkResHue = 0, checkMaxAmount = 0;
			object checkMessage = null;

			// Not enough resource to craft it
			if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage))
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
				{
					from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
				}
				else if (checkMessage is int && (int)checkMessage > 0)
				{
					from.SendLocalizedMessage((int)checkMessage);
				}
				else if (checkMessage is string)
				{
					from.SendMessage((string)checkMessage);
				}

                AutoCraftTimer.EndTimer(from);

				return;
			}
			else if (!ConsumeAttributes(from, ref checkMessage, false))
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
				{
					from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
				}
				else if (checkMessage is int && (int)checkMessage > 0)
				{
					from.SendLocalizedMessage((int)checkMessage);
				}
				else if (checkMessage is string)
				{
					from.SendMessage((string)checkMessage);
				}

                AutoCraftTimer.EndTimer(from);

				return;
			}

			bool toolBroken = false;

			int ignored = 1;
			int endquality = 1;

			bool allRequiredSkills = true;

			if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills))
			{
				// Resource
				int resHue = 0;
				int maxAmount = 0;

				object message = null;

				// Not enough resource to craft it
				if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message))
				{
					if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
					{
						from.SendGump(new CraftGump(from, craftSystem, tool, message));
					}
					else if (message is int && (int)message > 0)
					{
						from.SendLocalizedMessage((int)message);
					}
					else if (message is string)
					{
						from.SendMessage((string)message);
					}
//.........这里部分代码省略.........
开发者ID:Serado,项目名称:ServUO,代码行数:101,代码来源:CraftItem.cs


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