Esempio n. 1
1
        public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item)
        {
            if (toolBroken)
                from.SendLocalizedMessage(1044038); // You have worn out your tool

            if (failed)
            {
                if (lostMaterial)
                    return 1044043; // You failed to create the item, and some of your materials are lost.
                else
                    return 1044157; // You failed to create the item, but no materials were lost.
            }
            else
            {
                from.PlaySound(0x41); // glass breaking

                if (quality == 0)
                    return 502785; // You were barely able to make this item.  It's quality is below average.
                else if (makersMark && quality == 2)
                    return 1044156; // You create an exceptional quality item and affix your maker's mark.
                else if (quality == 2)
                    return 1044155; // You create an exceptional quality item.
                else
                    return 1044154; // You create the item.
            }
        }
Esempio n. 2
0
        public QueryMakersMarkGump( bool exceptional, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, bool questItem )
            : base(100, 200)
        {
            from.CloseGump( typeof( QueryMakersMarkGump ) );

            m_Exceptional = exceptional;
            m_From = from;
            m_CraftItem = craftItem;
            m_CraftSystem = craftSystem;
            m_TypeRes = typeRes;
            m_Tool = tool;
            m_QuestItem = questItem;

            AddPage( 0 );

            AddBackground( 0, 0, 220, 170, 5054 );
            AddBackground( 10, 10, 200, 150, 3000 );

            AddHtmlLocalized( 20, 20, 180, 80, 1018317, false, false ); // Do you wish to place your maker's mark on this item?

            AddHtmlLocalized( 55, 100, 140, 25, 1011036, false, false ); // OKAY
            AddButton( 20, 100, 4005, 4007, 2, GumpButtonType.Reply, 0 );

            AddHtmlLocalized( 55, 125, 140, 25, 1011012, false, false ); // CANCEL
            AddButton( 20, 125, 4005, 4007, 1, GumpButtonType.Reply, 0 );
        }
Esempio n. 3
0
		public override double GetChanceAtMin( CraftItem item )
		{
			if( item.ItemType == typeof( HollowPrism ) )
				return 0.5; // 50%

			return 0.0; // 0%
		}
Esempio n. 4
0
		public void OnMade( Mobile m, CraftItem item )
		{
			CraftContext c = GetContext( m );

			if ( c != null )
				c.OnMade( item );
		}
Esempio n. 5
0
        public QueryMakersMarkGump(int quality, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool)
            : base(100, 200)
        {
            from.CloseGump(typeof(QueryMakersMarkGump));

            this.m_Quality = quality;
            this.m_From = from;
            this.m_CraftItem = craftItem;
            this.m_CraftSystem = craftSystem;
            this.m_TypeRes = typeRes;
            this.m_Tool = tool;

            this.AddPage(0);

            this.AddBackground(0, 0, 220, 170, 5054);
            this.AddBackground(10, 10, 200, 150, 3000);

            this.AddHtmlLocalized(20, 20, 180, 80, 1018317, false, false); // Do you wish to place your maker's mark on this item?

            this.AddHtmlLocalized(55, 100, 140, 25, 1011011, false, false); // CONTINUE
            this.AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);

            this.AddHtmlLocalized(55, 125, 140, 25, 1011012, false, false); // CANCEL
            this.AddButton(20, 125, 4005, 4007, 0, GumpButtonType.Reply, 0);
        }
Esempio n. 6
0
 public MakeNumberCraftPrompt(Mobile from, CraftSystem system, CraftItem item, BaseTool tool)
 {
     m_From = from;
     m_CraftSystem = system;
     m_CraftItem = item;
     m_Tool = tool;
 }
        public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item)
        {
            if (toolBroken)
                from.SendLocalizedMessage(1044038); // You have worn out your tool

            if (!typeofSpellScroll.IsAssignableFrom(item.ItemType)) //  not a scroll
            {
                if (failed)
                {
                    if (lostMaterial)
                        return 1044043; // You failed to create the item, and some of your materials are lost.
                    else
                        return 1044157; // You failed to create the item, but no materials were lost.
                }
                else
                {
                    if (quality == 0)
                        return 502785; // You were barely able to make this item.  It's quality is below average.
                    else if (makersMark && quality == 2)
                        return 1044156; // You create an exceptional quality item and affix your maker's mark.
                    else if (quality == 2)
                        return 1044155; // You create an exceptional quality item.
                    else
                        return 1044154; // You create the item.
                }
            }
            else
            {
                if (failed)
                    return 501630; // You fail to inscribe the scroll, and the scroll is ruined.
                else
                    return 501629; // You inscribe the spell and put the scroll in your backpack.
            }
        }
		public override double GetChanceAtMin( CraftItem item )
		{
			if ( item.NameNumber == 1044258 || item.NameNumber == 1046445 ) // potion keg and faction trap removal kit
				return 0.5; // 50%

			return 0.0; // 0%
		}
		public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
		{
			if ( toolBroken )
				from.SendLocalizedMessage( 1044038 );

			if ( failed )
			{
				if ( lostMaterial )
					return 1044043;
				else
					return 1044157;
			}
			else
			{
				from.PlaySound( 0x1c6 );

				if ( quality == 0 )
					return 502785;
				else if ( makersMark && quality == 2 )
					return 1044156;
				else if ( quality == 2 )
					return 1044155;
				else
					return 1044154;
			}
		}
Esempio n. 10
0
		public override int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
		{
			double magery = from.Skills.Magery.Value - 100;
			
			if ( magery < 0 )
				magery = 0;
					
			int count = (int) Math.Round( magery * Utility.RandomDouble() / 5 );
			
			if ( count > 2 )
				count = 2;
				
			if ( Utility.RandomDouble() < 0.5 )
				count = 0;
			else
				BaseRunicTool.ApplyAttributesTo( this, false, 0, count, 70, 80 );
				
			Attributes.SpellDamage = 25;
			Attributes.LowerManaCost = 10;
			Attributes.CastSpeed = 1;
			Attributes.CastRecovery = 1;
			
			if ( makersMark )
				Crafter = from;
				
			return quality;
		}
Esempio n. 11
0
        public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item)
        {
            if (toolBroken)
                from.SendLocalizedMessage(1044038); // You have worn out your tool

            if (failed)
            {
                if (IsPotion(item.ItemType))
                {
                    from.AddToBackpack(new Bottle());
                    return 500287; // You fail to create a useful potion.
                }
                else
                {
                    return 1044043; // You failed to create the item, and some of your materials are lost.
                }
            }
            else
            {
                from.PlaySound(0x240); // Sound of a filling bottle

                if (IsPotion(item.ItemType))
                {
                    if (quality == -1)
                        return 1048136; // You create the potion and pour it into a keg.
                    else
                        return 500279; // You pour the potion into a bottle...
                }
                else
                {
                    return 1044154; // You create the item.
                }
            }
        }
Esempio n. 12
0
		public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
		{
			if ( toolBroken )
				from.SendLocalizedMessage( 1044038 ); // You have worn out your tool

            // erl: handle special dyes differently

			if( item.ItemType == typeof( SpecialDyeTub ) || item.ItemType == typeof( SpecialDye ) )
			{
				if( failed )
					from.SendMessage("You fail to mix the dye correctly.");

				return 0;
			}

			if ( failed )
			{
				from.AddToBackpack( new Bottle() );

				return 500287; // You fail to create a useful potion.
			}
			else
			{
				from.PlaySound( 0x240 ); // Sound of a filling bottle

				if ( quality == -1 )
					return 1048136; // You create the potion and pour it into a keg.
				else
					return 500279; // You pour the potion into a bottle...
			}
		}
Esempio n. 13
0
        public AutoCraftTimer(Mobile from, CraftSystem system, CraftItem item, BaseTool tool, int amount, TimeSpan delay, TimeSpan interval)
            : base(delay, interval)
        {
            m_From = from;
            m_CraftSystem = system;
            m_CraftItem = item;
            m_Tool = tool;
            m_Amount = amount;
            m_Ticks = 0;
            m_Success = 0;

            CraftContext context = m_CraftSystem.GetContext(m_From);

            if (context != null)
            {
                CraftSubResCol res = (m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes);
                int resIndex = (m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                    m_TypeRes = res.GetAt(resIndex).ItemType;
            }

            m_AutoCraftTable[from] = this;

            this.Start();
        }
Esempio n. 14
0
        public override bool OnCraft( bool exceptional, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
        {
            if ( exceptional )
                ArmorAttributes.MageArmor = 1;

            return base.OnCraft( exceptional, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue );
        }
Esempio n. 15
0
		public override bool RetainsColorFrom( CraftItem item, Type type )
		{
			if ( type != typeof( Cloth ) && type != typeof( UncutCloth ) )
				return false;

			return true;
		}
Esempio n. 16
0
 public static int GetDelay(CraftItem toCraft)
 {
     if (toCraft != null)
         return toCraft.Resources.GetAt(0).Amount+1;
     else
         return 2;
 }
Esempio n. 17
0
        public static void Craft( Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem )
        {
            if ( from.Backpack == null )
            {
                from.EndAction( typeof( CraftSystem ) );
                return;
            }

            Timer.DelayCall( TimeSpan.FromSeconds( craftSystem.Delay ), new TimerCallback(
                delegate
                {
                    if ( from.Backpack.GetAmount( typeof( Bottle ) ) < 1 || from.Backpack.GetAmount( typeof( PlantClippings ) ) < 1 )
                    {
                        from.EndAction( typeof( CraftSystem ) );

                        // You don't have the components needed to make that.
                        from.SendGump( new CraftGump( from, craftSystem, tool, 1044253 ) );
                    }
                    else if ( ShouldChooseHue( from ) )
                    {
                        from.SendLocalizedMessage( 1074794 ); // Target the material to use:
                        from.Target = new ClippingsTarget( craftSystem, typeRes, tool, craftItem );
                    }
                    else
                    {
                        from.EndAction( typeof( CraftSystem ) );
                        DoCraft( from, craftSystem, typeRes, tool, craftItem, from.Backpack.FindItemByType<PlantClippings>() );
                    }
                }
            ) );
        }
Esempio n. 18
0
        public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
        {
            /*if ( toolBroken )
                from.SendLocalizedMessage( 1044038 ); // You have worn out your tool*/

            if ( failed )
            {
                //from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "Text."));
                from.SendAsciiMessage("Thy trembling hand results in an unusable map.");
                return 0;
                if ( lostMaterial )
                    return 1044043; // You failed to create the item, and some of your materials are lost.
                else
                    return 1044157; // You failed to create the item, but no materials were lost.
            }
            else
            {
                from.SendAsciiMessage("With great care, thou dost make a chart of the geography.");
                //from.SendAsciiMessage("You create the item and put it in your backpack.");
                return 0;
                if ( quality == 0 )
                    return 502785; // You were barely able to make this item.  It's quality is below average.
                else if ( makersMark && quality == 2 )
                    return 1044156; // You create an exceptional quality item and affix your maker's mark.
                else if ( quality == 2 )
                    return 1044155; // You create an exceptional quality item.
                else
                    return 1044154; // You create the item.
            }
        }
Esempio n. 19
0
		public override double GetChanceAtMin( CraftItem item )
		{
			if ( item.NameNumber == 1044258 ) // potion keg
				return 0.5; // 50%

			return 0.0; // 0%
		}
Esempio n. 20
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            this.ItemID = 0x14F0;
            this.Faction = Faction.Find(from);

            return 1;
        }
Esempio n. 21
0
        public override bool RetainsColorFrom(CraftItem item, Type type)
        {
            //Taran: Only color furnitures and containers
            if (item.ItemType.IsDefined(typeof(FurnitureAttribute), false) || item.ItemType == typeof(BaseContainer))
                return true;

            return false;
        }
Esempio n. 22
0
        public CraftGumpItem( Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool )
            : base(40, 40)
        {
            m_From = from;
            m_CraftSystem = craftSystem;
            m_CraftItem = craftItem;
            m_Tool = tool;

            from.CloseGump( typeof( CraftGump ) );
            from.CloseGump( typeof( CraftGumpItem ) );

            AddPage( 0 );
            AddBackground( 0, 0, 530, 417, 5054 );
            AddImageTiled( 10, 10, 510, 22, 2624 );
            AddImageTiled( 10, 37, 150, 148, 2624 );
            AddImageTiled( 165, 37, 355, 90, 2624 );
            AddImageTiled( 10, 190, 155, 22, 2624 );
            AddImageTiled( 10, 217, 150, 53, 2624 );
            AddImageTiled( 165, 132, 355, 80, 2624 );
            AddImageTiled( 10, 275, 155, 22, 2624 );
            AddImageTiled( 10, 302, 150, 53, 2624 );
            AddImageTiled( 165, 217, 355, 80, 2624 );
            AddImageTiled( 10, 360, 155, 22, 2624 );
            AddImageTiled( 165, 302, 355, 80, 2624 );
            AddImageTiled( 10, 387, 510, 22, 2624 );
            AddAlphaRegion( 10, 10, 510, 399 );

            AddHtmlLocalized( 170, 40, 150, 20, 1044053, LabelColor, false, false ); // ITEM
            AddHtmlLocalized( 10, 192, 150, 22, 1044054, LabelColor, false, false ); // <CENTER>SKILLS</CENTER>
            AddHtmlLocalized( 10, 277, 150, 22, 1044055, LabelColor, false, false ); // <CENTER>MATERIALS</CENTER>
            AddHtmlLocalized( 10, 362, 150, 22, 1044056, LabelColor, false, false ); // <CENTER>OTHER</CENTER>

            if ( craftSystem.GumpTitleNumber > 0 )
                AddHtmlLocalized( 10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false );
            else
                AddHtml( 10, 12, 510, 20, craftSystem.GumpTitleString, false, false );

            AddButton( 15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 50, 390, 150, 18, 1044150, LabelColor, false, false ); // BACK

            AddButton( 270, 387, 4005, 4007, 1, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 305, 390, 150, 18, 1044151, LabelColor, false, false ); // MAKE NOW

            if ( craftItem.NameNumber > 0 )
                AddHtmlLocalized( 330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false );
            else
                AddLabel( 330, 40, LabelHue, craftItem.NameString );

            if ( craftItem.UseAllRes )
                AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1048176, LabelColor, false, false ); // Makes as many as possible at once

            DrawItem();
            DrawSkill();
            DrawRessource();

            if( craftItem.RequiresSE )
                AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1063363, LabelColor, false, false ); //* Requires the "Samurai Empire" expansion
        }
Esempio n. 23
0
		public virtual int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
		{
			if ( makersMark )
				Crafter = from;

			m_Quality = (RuneQuality)quality;

			return quality;
		}
Esempio n. 24
0
		public void OnMade( CraftItem item )
		{
			m_Items.Remove( item );

			if ( m_Items.Count == 10 )
				m_Items.RemoveAt( 9 );

			m_Items.Insert( 0, item );
		}
Esempio n. 25
0
		public CustomCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, IBaseTool tool, int quality )
		{
			m_From = from;
			m_CraftItem = craftItem;
			m_CraftSystem = craftSystem;
			m_TypeRes = typeRes;
			m_Tool = tool;
			m_Quality = quality;
		}
Esempio n. 26
0
		public override int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
		{
			Quality = (ClothingQuality)quality;

			if( Quality == ClothingQuality.Exceptional )
				DistributeBonuses( (tool is BaseRunicTool ? 6 : (Core.SE ? 15 : 14)) );	//BLAME OSI. (We can't confirm it's an OSI bug yet.)

			return base.OnCraft( quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue );
		}
Esempio n. 27
0
		public CustomCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, bool exceptional )
		{
			m_From = from;
			m_CraftItem = craftItem;
			m_CraftSystem = craftSystem;
			m_TypeRes = typeRes;
			m_Tool = tool;
			m_Exceptional = exceptional;
		}
Esempio n. 28
0
		public override double GetChanceAtMin( CraftItem item )
		{
			// erl: Added for fullbookcases
			if( item.ItemType == typeof( FullBookcase ) ||
				item.ItemType == typeof( FullBookcase2 ) ||
				item.ItemType == typeof( FullBookcase3 ) )
				return 0.3;

			return 0.5; // 50%
		}
Esempio n. 29
0
		public Recipe( int id, CraftSystem system, CraftItem item )
		{
			m_ID = id;
			m_System = system;
			m_CraftItem = item;

			if ( m_Recipes.ContainsKey( id ) )
				throw new Exception( "Attempting to create recipe with preexisting ID." );

			m_Recipes.Add( id, this );
			m_LargestRecipeID = Math.Max( id, m_LargestRecipeID );
		}
Esempio n. 30
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            int charges = 5 + quality + (int)(from.Skills[SkillName.Inscribe].Value / 30);

            if (charges > 10)
            {
                charges = 10;
            }

            MaxCharges = (Core.SE ? charges * 2 : charges);

            return quality;
        }
Esempio n. 31
0
        public CraftGumpItem(Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool) : base(40, 40)
        {
            m_From        = from;
            m_CraftSystem = craftSystem;
            m_CraftItem   = craftItem;
            m_Tool        = tool;

            from.CloseGump(typeof(CraftGump));
            from.CloseGump(typeof(CraftGumpItem));

            AddPage(0);
            AddBackground(0, 0, 530, 417, 5054);
            AddImageTiled(10, 10, 510, 22, 2624);
            AddImageTiled(10, 37, 150, 148, 2624);
            AddImageTiled(165, 37, 355, 90, 2624);
            AddImageTiled(10, 190, 155, 22, 2624);
            AddImageTiled(10, 217, 150, 53, 2624);
            AddImageTiled(165, 132, 355, 80, 2624);
            AddImageTiled(10, 275, 155, 22, 2624);
            AddImageTiled(10, 302, 150, 53, 2624);
            AddImageTiled(165, 217, 355, 80, 2624);
            AddImageTiled(10, 360, 155, 22, 2624);
            AddImageTiled(165, 302, 355, 80, 2624);
            AddImageTiled(10, 387, 510, 22, 2624);
            AddAlphaRegion(10, 10, 510, 399);

            AddHtml(170, 40, 150, 20, "<h3><basefont color=#FFFFFF>Objet<basefont></h3>", false, false);
            AddHtml(10, 192, 150, 22, "<h3><basefont color=#FFFFFF><center>Compétences</center><basefont></h3>", false, false);
            AddHtml(10, 277, 150, 22, "<h3><basefont color=#FFFFFF><center>Matériaux</center><basefont></h3>", false, false);
            AddHtml(10, 362, 150, 22, "<h3><basefont color=#FFFFFF><center>Autre</center><basefont></h3>", false, false);

            if (craftSystem.GumpTitleNumber > 0)
            {
                AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false);
            }
            else
            {
                AddHtml(10, 12, 510, 20, "<h3><basefont color=#FFFFFF><center>" + craftSystem.GumpTitleString + "</center><basefont></h3>", false, false);
            }

            AddButton(15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0);
            AddHtml(50, 390, 150, 20, "<h3><basefont color=#FFFFFF>Retour<basefont></h3>", false, false);

            bool needsRecipe = (craftItem.Recipe != null && from is PlayerMobile && !((PlayerMobile)from).HasRecipe(craftItem.Recipe));

            if (needsRecipe)
            {
                AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page, 0);
                AddHtml(305, 390, 150, 20, "<h3><basefont color=#FFFFFF>Fabriquer<basefont></h3>", false, false);
            }
            else
            {
                AddButton(270, 387, 4005, 4007, 1, GumpButtonType.Reply, 0);
                AddHtml(305, 390, 150, 20, "<h3><basefont color=#FFFFFF>Fabriquer<basefont></h3>", false, false);
            }

            if (craftItem.NameNumber > 0)
            {
                AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false);
            }
            else
            {
                AddHtml(330, 40, 150, 20, "<h3><basefont color=#FFFFFF><center>" + craftItem.NameString + "</center><basefont></h3>", false, false);
            }

            if (craftItem.UseAllRes)
            {
                AddHtml(170, 302 + (m_OtherCount++ *20), 300, 20, "<h3><basefont color=#FFFFFF><center>Fabriquer le plus possible</center><basefont></h3>", false, false);
            }

            DrawItem();
            DrawSkill();
            DrawResource();

            if (needsRecipe)
            {
                //AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1073620, RedLabelColor, false, false ); // You have not learned this recipe.
                AddHtml(170, 302 + (m_OtherCount++ *20), 300, 20, "<h3><basefont color=#FFFFFF><center>Vous n'avez pas la recette</center><basefont></h3>", false, false);
            }
        }
Esempio n. 32
0
        public void SetForceSuccess(int index, int success)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.ForceSuccessChance = success;
        }
Esempio n. 33
0
        /// <summary>
        /// Add a callback Action to allow mutating the crafted item. Handy when you have a single Item Type but you want to create variations of it.
        /// </summary>
        /// <param name="index"></param>
        /// <param name="action"></param>
        public void SetMutateAction(int index, Action <Mobile, Item, ITool> action)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.MutateAction = action;
        }
Esempio n. 34
0
        public void AddCraftAction(int index, Action <Mobile, CraftItem, ITool> action)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.TryCraft = action;
        }
Esempio n. 35
0
 public ExplosionTrapCraft(Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, ITool tool, int quality)
     : base(from, craftItem, craftSystem, typeRes, tool, quality)
 {
 }
Esempio n. 36
0
        public void SetNeedWater(int index, bool needWater)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.NeedWater = needWater;
        }
Esempio n. 37
0
        public void SetRequiresBasketWeaving(int index)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.RequiresBasketWeaving = true;
        }
Esempio n. 38
0
        public void SetUseSubRes2(int index, bool val)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.UseSubRes2 = val;
        }
Esempio n. 39
0
        public void SetRequiresMechanicalLife(int index)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.RequiresMechanicalLife = true;
        }
Esempio n. 40
0
        public void ForceExceptional(int index)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.ForceExceptional = true;
        }
Esempio n. 41
0
        public void AddRecipe(int index, int id)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.AddRecipe(id, this);
        }
Esempio n. 42
0
        public void SetMinSkillOffset(int index, double skillOffset)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.MinSkillOffset = skillOffset;
        }
Esempio n. 43
0
 public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item)
 {
     if (toolBroken)
     {
         from.SendLocalizedMessage(1044038);                 // You have worn out your tool
     }
     if (!typeofSpellScroll.IsAssignableFrom(item.ItemType)) //  not a scroll
     {
         if (failed)
         {
             if (lostMaterial)
             {
                 return(1044043); // You failed to create the item, and some of your materials are lost.
             }
             else
             {
                 return(1044157); // You failed to create the item, but no materials were lost.
             }
         }
         else
         {
             if (quality == 0)
             {
                 return(502785); // You were barely able to make this item.  It's quality is below average.
             }
             else if (makersMark && quality == 2)
             {
                 return(1044156); // You create an exceptional quality item and affix your maker's mark.
             }
             else if (quality == 2)
             {
                 return(1044155); // You create an exceptional quality item.
             }
             else
             {
                 return(1044154); // You create the item.
             }
         }
     }
     else
     {
         if (failed)
         {
             return(501630); // You fail to inscribe the scroll, and the scroll is ruined.
         }
         else
         {
             return(501629); // You inscribe the spell and put the scroll in your backpack.
         }
     }
 }
Esempio n. 44
0
 public override double GetChanceAtMin(CraftItem item)
 {
     return(0.0); // 0%
 }
Esempio n. 45
0
        public void SetDisplayID(int index, int id)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.DisplayID = id;
        }
Esempio n. 46
0
 public PoisonTrapCraft(Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality) : base(from, craftItem, craftSystem, typeRes, tool, quality)
 {
 }
Esempio n. 47
0
        public void SetData(int index, object data)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.Data = data;
        }
Esempio n. 48
0
        public void SetNeedHeat(int index, bool needHeat)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.NeedHeat = needHeat;
        }
Esempio n. 49
0
        public void SetRequireResTarget(int index)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.RequiresResTarget = true;
        }
Esempio n. 50
0
        public void SetBeverageType(int index, BeverageType requiredBeverage)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.RequiredBeverage = requiredBeverage;
        }
Esempio n. 51
0
 public abstract int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item);
Esempio n. 52
0
        public void AddResCallback(int index, Func <Mobile, ConsumeType, int> func)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.ConsumeResCallback = func;
        }
Esempio n. 53
0
        public void SetNeededThemePack(int index, ThemePack pack)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.RequiredThemePack = pack;
        }
Esempio n. 54
0
        public void AddRes(int index, Type type, TextDefinition name, int amount, TextDefinition message)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.AddRes(type, name, amount, message);
        }
Esempio n. 55
0
        public void SetNeedMill(int index, bool needMill)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.NeedMill = needMill;
        }
Esempio n. 56
0
            private RecycleResult Recycle(Mobile from, Item item)
            {
                if (from == null || item == null || m_CraftSystem == null || m_Tool == null)
                {
                    return(RecycleResult.Invalid);
                }

                if (from.Backpack == null)
                {
                    return(RecycleResult.Invalid);
                }

                CraftContext craftContext = m_CraftSystem.GetContext(from);

                if (craftContext == null)
                {
                    return(RecycleResult.Invalid);
                }

                bool recycleEntireBackpack = false;

                if (craftContext.RecycleOption == CraftRecycleOption.RecycleEverything && item == from.Backpack)
                {
                    recycleEntireBackpack = true;
                }

                List <CraftSystem> m_RecycleableCraftSystems = GetRecyclableCraftSystems();

                List <Type> m_ItemTypes = new List <Type>();

                if (recycleEntireBackpack)
                {
                    List <Item> m_BackpackItems = from.Backpack.FindItemsByType <Item>();

                    foreach (Item backpackItem in m_BackpackItems)
                    {
                        if (backpackItem is BaseTool)
                        {
                            continue;
                        }

                        Type itemType = backpackItem.GetType();

                        if (!m_ItemTypes.Contains(itemType))
                        {
                            m_ItemTypes.Add(itemType);
                        }
                    }
                }

                else
                {
                    m_ItemTypes.Add(item.GetType());
                }

                List <int> m_RecycleSounds = new List <int>();

                int deletedCount = 0;

                foreach (Type itemType in m_ItemTypes)
                {
                    foreach (CraftSystem craftSystem in m_RecycleableCraftSystems)
                    {
                        CraftItem craftItem = craftSystem.CraftItems.SearchFor(itemType);

                        if (craftItem == null || craftItem.Resources.Count == 0)
                        {
                            continue;
                        }

                        Dictionary <Type, int> m_ValidRecipeResources = new Dictionary <Type, int>();

                        CraftResCol craftResourceCollection = craftItem.Resources;

                        for (int a = 0; a < craftResourceCollection.Count; a++)
                        {
                            CraftRes craftResource = craftResourceCollection.GetAt(a);

                            if (!IsRecycleResource(craftResource.ItemType))
                            {
                                continue;
                            }

                            if (!m_ValidRecipeResources.ContainsKey(craftResource.ItemType))
                            {
                                m_ValidRecipeResources.Add(craftResource.ItemType, craftResource.Amount);
                            }
                        }

                        if (m_ValidRecipeResources.Count == 0)
                        {
                            continue;
                        }

                        List <Item> m_ItemMatches    = new List <Item>();
                        List <Item> m_ItemsToRecycle = new List <Item>();

                        Item[] m_MatchingItems = from.Backpack.FindItemsByType(itemType);

                        for (int a = 0; a < m_MatchingItems.Length; a++)
                        {
                            Item targetItem = m_MatchingItems[a];

                            if (craftContext.RecycleOption == CraftRecycleOption.RecycleSingle && targetItem == item)
                            {
                                m_ItemMatches.Add(targetItem);
                                continue;
                            }

                            if (craftContext.RecycleOption == CraftRecycleOption.RecycleRegularByType && targetItem.Quality == Quality.Regular && !targetItem.IsMagical)
                            {
                                m_ItemMatches.Add(targetItem);
                                continue;
                            }

                            if (craftContext.RecycleOption == CraftRecycleOption.RecycleExceptionalByType && targetItem.Quality == Quality.Exceptional)
                            {
                                m_ItemMatches.Add(targetItem);
                                continue;
                            }

                            if (craftContext.RecycleOption == CraftRecycleOption.RecycleExceptionalByType && targetItem.IsMagical)
                            {
                                m_ItemMatches.Add(targetItem);
                                continue;
                            }

                            if (craftContext.RecycleOption == CraftRecycleOption.RecycleAnyByType)
                            {
                                m_ItemMatches.Add(targetItem);
                                continue;
                            }

                            if (craftContext.RecycleOption == CraftRecycleOption.RecycleEverything)
                            {
                                m_ItemMatches.Add(targetItem);
                                continue;
                            }
                        }

                        foreach (Item recycleItem in m_ItemMatches)
                        {
                            if (!recycleItem.Movable)
                            {
                                continue;
                            }
                            if (recycleItem.LootType != LootType.Regular)
                            {
                                continue;
                            }
                            if (recycleItem.DecorativeEquipment)
                            {
                                continue;
                            }
                            if (recycleItem.TierLevel > 0 && recycleItem.Aspect != AspectEnum.None)
                            {
                                continue;
                            }
                            if (recycleItem is BaseContainer && recycleItem.TotalItems > 0)
                            {
                                continue;
                            }

                            m_ItemsToRecycle.Add(recycleItem);
                        }

                        if (m_ItemsToRecycle.Count == 0)
                        {
                            continue;
                        }

                        Queue m_Queue = new Queue();

                        foreach (Item recycleItem in m_ItemsToRecycle)
                        {
                            m_Queue.Enqueue(recycleItem);
                        }

                        while (m_Queue.Count > 0)
                        {
                            Item recycleItem = (Item)m_Queue.Dequeue();

                            bool deleteItem = false;

                            foreach (KeyValuePair <Type, int> pair in m_ValidRecipeResources)
                            {
                                double salvageScalar = .5;

                                if (recycleItem.ItemGroup != ItemGroupType.Crafted)
                                {
                                    salvageScalar = .25;
                                }

                                Type resourceType        = pair.Key;
                                int  totalResourceAmount = (int)(Math.Floor((double)pair.Value * (double)recycleItem.Amount * salvageScalar));

                                if (totalResourceAmount < 1)
                                {
                                    continue;
                                }

                                //Ingot
                                if (resourceType == typeof(IronIngot))
                                {
                                    if (!m_RecycleSounds.Contains(0x2A))
                                    {
                                        m_RecycleSounds.Add(0x2A);
                                    }

                                    if (!m_RecycleSounds.Contains(0x240))
                                    {
                                        m_RecycleSounds.Add(0x240);
                                    }

                                    if (recycleItem.Resource != CraftResource.Iron)
                                    {
                                        resourceType = CraftResources.GetCraftResourceType(recycleItem.Resource);

                                        if (resourceType == null)
                                        {
                                            resourceType = typeof(IronIngot);
                                        }
                                    }
                                }

                                //Leather
                                if (resourceType == typeof(Leather))
                                {
                                    if (!m_RecycleSounds.Contains(0x3E3))
                                    {
                                        m_RecycleSounds.Add(0x3E3);
                                    }

                                    if (recycleItem.Resource != CraftResource.RegularLeather)
                                    {
                                        resourceType = CraftResources.GetCraftResourceType(recycleItem.Resource);

                                        if (resourceType == null)
                                        {
                                            resourceType = typeof(Leather);
                                        }
                                    }
                                }

                                //Wood
                                if (resourceType == typeof(Board))
                                {
                                    if (!m_RecycleSounds.Contains(0x23D))
                                    {
                                        m_RecycleSounds.Add(0x23D);
                                    }

                                    if (recycleItem.Resource != CraftResource.RegularWood)
                                    {
                                        resourceType = CraftResources.GetCraftResourceType(recycleItem.Resource);

                                        if (resourceType == null)
                                        {
                                            resourceType = typeof(Board);
                                        }
                                    }
                                }

                                Item newResource = (Item)Activator.CreateInstance(resourceType);

                                if (newResource == null)
                                {
                                    continue;
                                }

                                //Cloth
                                if (resourceType == typeof(Cloth))
                                {
                                    if (!m_RecycleSounds.Contains(0x248))
                                    {
                                        m_RecycleSounds.Add(0x248);
                                    }

                                    newResource.Hue = recycleItem.Hue;
                                }

                                deleteItem = true;
                                deletedCount++;

                                newResource.Amount = totalResourceAmount;
                                from.AddToBackpack(newResource);
                            }

                            int arcaneEssenceValue = recycleItem.GetArcaneEssenceValue();

                            if (arcaneEssenceValue > 0)
                            {
                                ArcaneEssence arcaneEssenceItem = new ArcaneEssence(arcaneEssenceValue);
                                from.AddToBackpack(arcaneEssenceItem);
                            }

                            if (deleteItem)
                            {
                                recycleItem.Delete();
                            }
                        }
                    }
                }

                if (deletedCount > 0)
                {
                    foreach (int sound in m_RecycleSounds)
                    {
                        from.PlaySound(sound);
                    }

                    if (deletedCount > 1)
                    {
                        return(RecycleResult.SuccessMultiple);
                    }

                    else
                    {
                        return(RecycleResult.Success);
                    }
                }

                else
                {
                    if (recycleEntireBackpack)
                    {
                        return(RecycleResult.InvalidEntireBackpack);
                    }

                    else
                    {
                        return(RecycleResult.Invalid);
                    }
                }
            }
Esempio n. 57
0
        public void AddSkill(int index, SkillName skillToMake, double minSkill, double maxSkill)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.AddSkill(skillToMake, minSkill, maxSkill);
        }
Esempio n. 58
0
        public void AddCreateItem(int index, Func <Mobile, CraftItem, ITool, Item> func)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.CreateItem = func;
        }
Esempio n. 59
0
 public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item)
 {
     if (toolBroken)
     {
         from.SendLocalizedMessage(1044038); // You have worn out your tool
     }
     if (failed)
     {
         if (lostMaterial)
         {
             return(1044043); // You failed to create the item, and some of your materials are lost.
         }
         else
         {
             return(1044157); // You failed to create the item, but no materials were lost.
         }
     }
     else
     {
         if (quality == 0)
         {
             return(502785); // You were barely able to make this item.  It's quality is below average.
         }
         else if (makersMark && quality == 2)
         {
             return(1044156); // You create an exceptional quality item and affix your maker's mark.
         }
         else if (quality == 2)
         {
             return(1044155); // You create an exceptional quality item.
         }
         else
         {
             return(1044154); // You create the item.
         }
     }
 }
Esempio n. 60
0
        public void SetNeedOven(int index, bool needOven)
        {
            CraftItem craftItem = m_CraftItems.GetAt(index);

            craftItem.NeedOven = needOven;
        }