public override int CanCraft(Mobile from, IBaseTool tool, Type itemType)
		{
			if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
			{
				return 1044038; // You have worn out your tool!
			}
			
			if (!BaseTool.CheckTool(tool, from))
			{
				return 1048146; // If you have a tool equipped, you must use that tool.
			}
			
			if (!(from is PlayerMobile && ((PlayerMobile)from).Glassblowing && from.Skills[SkillName.Alchemy].Base >= 100.0))
			{
				return 1044634; // You havent learned glassblowing.
			}
			
			if (!BaseTool.CheckAccessible(tool, from))
			{
				return 1044263; // The tool must be on your person to use.
			}

			bool anvil, forge;

			DefBlacksmithy.CheckAnvilAndForge(from, 2, out anvil, out forge);

			if (forge)
			{
				return 0;
			}

			return 1044628; // You must be near a forge to blow glass.
		}
Exemple #2
0
 public InternalTarget(CraftSystem craftSystem, IBaseTool tool, Type resourceType, CraftResource resource) :  base(2, false, TargetFlags.None)
 {
     m_CraftSystem  = craftSystem;
     m_Tool         = tool;
     m_ResourceType = resourceType;
     m_Resource     = resource;
 }
		public override int CanCraft( Mobile from, IBaseTool tool, Type typeItem )
		{
			if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
				return 1044038; // You have worn out your tool!
			else if ( !BaseTool.CheckAccessible( tool, from ) )
				return 1044263; // The tool must be on your person to use.

			if ( typeItem != null )
			{
				object o = Activator.CreateInstance( typeItem );

				if ( o is SpellScroll )
				{
					SpellScroll scroll = (SpellScroll)o;
					Spellbook book = Spellbook.Find( from, scroll.SpellID );

					bool hasSpell = ( book != null && book.HasSpell( scroll.SpellID ) );

					scroll.Delete();

					return ( hasSpell ? 0 : 1042404 ); // null : You don't have that spell!
				}
				else if ( o is Item )
				{
					((Item)o).Delete();
				}
			}

			return 0;
		}
Exemple #4
0
        public int OnCraft(
            int quality,
            bool makersMark,
            Mobile from,
            CraftSystem craftSystem,
            Type typeRes,
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            if (craftSystem is DefAlchemy)
            {
                Container pack = from.Backpack;

                if (pack != null && m_PotionEffect <= PotionEffect.TotalManaRefresh)
                {
                    List <PotionKeg> kegs = pack.FindItemsByType <PotionKeg>();

                    foreach (
                        PotionKeg keg in kegs.Where(keg => keg != null && keg.Held > 0 && keg.Held < 100 && keg.Type == PotionEffect))
                    {
                        ++keg.Held;

                        Consume();
                        from.AddToBackpack(new Bottle());

                        return(-1);                        // signal placed in keg
                    }
                }
            }

            return(1);
        }
Exemple #5
0
        public override int CanCraft(Mobile from, IBaseTool tool, Type itemType)
        {
            if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
            {
                return(1044038);                // You have worn out your tool!
            }

            if (!BaseTool.CheckTool(tool, from))
            {
                return(1048146);                // If you have a tool equipped, you must use that tool.
            }

            if (!BaseTool.CheckAccessible(tool, from))
            {
                return(1044263);                // The tool must be on your person to use.
            }

            bool anvil, forge;

            CheckAnvilAndForge(from, 2, out anvil, out forge);

            if (anvil && forge)
            {
                return(0);
            }

            return(1044267);            // You must be near an anvil and a forge to smith items.
        }
        public override int CanCraft(Mobile from, IBaseTool tool, Type itemType)
        {
            if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
            {
                return(1044038);                // You have worn out your tool!
            }

            if (!BaseTool.CheckTool(tool, from))
            {
                return(1048146);                // If you have a tool equipped, you must use that tool.
            }

            if (!(from is PlayerMobile && ((PlayerMobile)from).Glassblowing && from.Skills[SkillName.Alchemy].Base >= 100.0))
            {
                return(1044634);                // You havent learned glassblowing.
            }

            if (!BaseTool.CheckAccessible(tool, from))
            {
                return(1044263);                // The tool must be on your person to use.
            }

            bool anvil, forge;

            DefBlacksmithy.CheckAnvilAndForge(from, 2, out anvil, out forge);

            if (forge)
            {
                return(0);
            }

            return(1044628);            // You must be near a forge to blow glass.
        }
        public override int CanCraft(Mobile from, IBaseTool tool, Type typeItem)
        {
            if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
            {
                return(1044038);                // You have worn out your tool!
            }
            else if (!BaseTool.CheckAccessible(tool, from))
            {
                return(1044263);                // The tool must be on your person to use.
            }
            if (typeItem != null)
            {
                object o = Activator.CreateInstance(typeItem);

                if (o is SpellScroll)
                {
                    SpellScroll scroll = (SpellScroll)o;
                    Spellbook   book   = Spellbook.Find(from, scroll.SpellID);

                    bool hasSpell = (book != null && book.HasSpell(scroll.SpellID));

                    scroll.Delete();

                    return(hasSpell ? 0 : 1042404);                        // null : You don't have that spell!
                }
                else if (o is Item)
                {
                    ((Item)o).Delete();
                }
            }

            return(0);
        }
Exemple #8
0
        public int OnCraft(
            int quality,
            bool makersMark,
            Mobile from,
            CraftSystem craftSystem,
            Type typeRes,
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            int charges = 5 + quality + (int)(from.Skills[SkillName.Inscribe].Value / 30);

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

            MaxCharges = charges;

            if (makersMark)
            {
                Crafter = from;
            }

            m_Quality = (BookQuality)(quality - 1);

            return(quality);
        }
		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;
		}
		public override int CanCraft( Mobile from, IBaseTool tool, Type itemType )
		{
			if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
				return 1044038; // You have worn out your tool!
			else if ( !BaseTool.CheckAccessible( tool, from ) )
				return 1044263; // The tool must be on your person to use.

			return 0;
		}
Exemple #11
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;
 }
 public override int CanCraft(Mobile from, IBaseTool tool, Type itemType)
 {
     if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
     {
         return(1044038);                // You have worn out your tool!
     }
     else if (!BaseTool.CheckAccessible(tool, from))
     {
         return(1044263);                // The tool must be on your person to use.
     }
     return(0);
 }
Exemple #13
0
        public void CreateItem(Mobile from, Type type, Type typeRes, IBaseTool tool, CraftItem realCraftItem)
        {
            // Verify if the type is in the list of the craftable item
            CraftItem craftItem = m_CraftItems.SearchFor(type);

            if (craftItem != null)
            {
                // The item is in the list, try to create it
                // Test code: items like sextant parts can be crafted either directly from ingots, or from different parts
                realCraftItem.Craft(from, this, typeRes, tool);
                //craftItem.Craft( from, this, typeRes, tool );
            }
        }
Exemple #14
0
		public static void Do( Mobile from, CraftSystem craftSystem, IBaseTool 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.
			}
		}
Exemple #15
0
		public override int OnCraft(
			int quality,
			bool makersMark,
			Mobile from,
			CraftSystem craftSystem,
			Type typeRes,
			IBaseTool tool,
			CraftItem craftItem,
			int resHue)
		{
			Quality = (ClothingQuality)quality;

			return base.OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue);
		}
Exemple #16
0
        public override int OnCraft(
            int quality,
            bool makersMark,
            Mobile from,
            CraftSystem craftSystem,
            Type typeRes,
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            Quality = (ClothingQuality)quality;

            return(base.OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue));
        }
Exemple #17
0
        public static void Do(Mobile from, CraftSystem craftSystem, IBaseTool 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.
            }
        }
Exemple #18
0
            private void Failure(int message)
            {
                Mobile    from = m_TrapCraft.From;
                IBaseTool tool = m_TrapCraft.Tool;

                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, m_TrapCraft.CraftSystem, tool, message));
                }
                else if (message > 0)
                {
                    from.SendLocalizedMessage(message);
                }
            }
		public virtual int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, IBaseTool tool, CraftItem craftItem, int resHue )
		{
			Type resourceType = typeRes;

			if ( resourceType == null )
				resourceType = craftItem.Resources.GetAt( 0 ).ItemType;

			Resource = CraftResources.GetFromType( resourceType );

			CraftContext context = craftSystem.GetContext( from );

			if ( context != null && context.DoNotColor )
				Hue = 0;

			return quality;
		}
/*
		public static int AdjustedSilverCost( int initialCost, Faction faction )
		{
			return (int)(initialCost * (1.0 - 0.05 * faction.OwnedTowns));
		}
*/
		public FactionImbueGump( int quality, Item item, Mobile from, CraftSystem craftSystem, IBaseTool tool, object notice, int availableSilver, Faction faction, FactionItemDefinition def ) : base( 100, 200 )
		{
			m_Item = item;
			m_Mobile = from;
			m_Faction = faction;
			m_CraftSystem = craftSystem;
			m_Tool = tool;
			m_Notice = notice;
			m_Quality = quality;
			m_Definition = def;

			AddPage( 0 );

			AddBackground( 0, 0, 320, 270, 5054 );
			AddBackground( 10, 10, 300, 250, 3000 );

			AddHtmlLocalized( 20, 20, 210, 25, 1011569, false, false ); // Imbue with Faction properties?


			AddHtmlLocalized( 20, 60, 170, 25, 1018302, false, false ); // Item quality:
			AddHtmlLocalized( 175, 60, 100, 25, 1018305 - m_Quality, false, false ); //	Exceptional, Average, Low

			AddHtmlLocalized( 20, 80, 170, 25, 1011572, false, false ); // Item Cost :

			//AddLabel( 175, 80, 0x34, AdjustedSilverCost(def.SilverCost, faction).ToString( "N0" ) ); // NOTE: Added 'N0'
			AddLabel( 175, 80, 0x34, def.SilverCost.ToString( "N0" ) ); // NOTE: Added 'N0'

			AddHtmlLocalized( 20, 100, 170, 25, 1011573, false, false ); // Your Silver :
			AddLabel( 175, 100, 0x34, availableSilver.ToString( "N0" ) ); // NOTE: Added 'N0'


			AddRadio( 20, 140, 210, 211, true, 1 );
			AddLabel( 55, 140, m_Faction.Definition.HuePrimary - 1, "*****" );
			AddHtmlLocalized( 150, 140, 150, 25, 1011570, false, false ); // Primary Color

			AddRadio( 20, 160, 210, 211, false, 2 );
			AddLabel( 55, 160, m_Faction.Definition.HueSecondary - 1, "*****" );
			AddHtmlLocalized( 150, 160, 150, 25, 1011571, false, false ); // Secondary Color


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

			AddHtmlLocalized( 55, 230, 200, 25, 1011012, false, false ); // CANCEL
			AddButton( 20, 230, 4005, 4007, 0, GumpButtonType.Reply, 0 );
		}
/*
 *              public static int AdjustedSilverCost( int initialCost, Faction faction )
 *              {
 *                      return (int)(initialCost * (1.0 - 0.05 * faction.OwnedTowns));
 *              }
 */
        public FactionImbueGump(int quality, Item item, Mobile from, CraftSystem craftSystem, IBaseTool tool, object notice, int availableSilver, Faction faction, FactionItemDefinition def) : base(100, 200)
        {
            m_Item        = item;
            m_Mobile      = from;
            m_Faction     = faction;
            m_CraftSystem = craftSystem;
            m_Tool        = tool;
            m_Notice      = notice;
            m_Quality     = quality;
            m_Definition  = def;

            AddPage(0);

            AddBackground(0, 0, 320, 270, 5054);
            AddBackground(10, 10, 300, 250, 3000);

            AddHtmlLocalized(20, 20, 210, 25, 1011569, false, false);               // Imbue with Faction properties?


            AddHtmlLocalized(20, 60, 170, 25, 1018302, false, false);               // Item quality:
            AddHtmlLocalized(175, 60, 100, 25, 1018305 - m_Quality, false, false);  //	Exceptional, Average, Low

            AddHtmlLocalized(20, 80, 170, 25, 1011572, false, false);               // Item Cost :

            //AddLabel( 175, 80, 0x34, AdjustedSilverCost(def.SilverCost, faction).ToString( "N0" ) ); // NOTE: Added 'N0'
            AddLabel(175, 80, 0x34, def.SilverCost.ToString("N0"));                 // NOTE: Added 'N0'

            AddHtmlLocalized(20, 100, 170, 25, 1011573, false, false);              // Your Silver :
            AddLabel(175, 100, 0x34, availableSilver.ToString("N0"));               // NOTE: Added 'N0'


            AddRadio(20, 140, 210, 211, true, 1);
            AddLabel(55, 140, m_Faction.Definition.HuePrimary - 1, "*****");
            AddHtmlLocalized(150, 140, 150, 25, 1011570, false, false);               // Primary Color

            AddRadio(20, 160, 210, 211, false, 2);
            AddLabel(55, 160, m_Faction.Definition.HueSecondary - 1, "*****");
            AddHtmlLocalized(150, 160, 150, 25, 1011571, false, false);               // Secondary Color


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

            AddHtmlLocalized(55, 230, 200, 25, 1011012, false, false);               // CANCEL
            AddButton(20, 230, 4005, 4007, 0, GumpButtonType.Reply, 0);
        }
Exemple #22
0
        public override int CanCraft(
            Mobile m,
            //Compatibility with UOF fix
            IBaseTool tool,
            Type itemType)
        {
            if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
            {
                return(1044038);                // You have worn out your tool!
            }

            if (!BaseTool.CheckAccessible(tool, m))
            {
                return(1044263);                // The tool must be on your person to use.
            }

            return(base.CanCraft(m, tool, itemType));
        }
		public override int CanCraft(
			Mobile m,
			//Compatibility with UOF fix
			IBaseTool tool,
			Type itemType)
		{
			if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
			{
				return 1044038; // You have worn out your tool!
			}

			if (!BaseTool.CheckAccessible(tool, m))
			{
				return 1044263; // The tool must be on your person to use.
			}

			return base.CanCraft(m, tool, itemType);
		}
		public virtual int OnCraft(
			int quality,
			bool makersMark,
			Mobile m,
			CraftSystem craftSystem,
			Type typeRes,
			//Compatibility with UOF fix
			IBaseTool tool,
			CraftItem craftItem,
			int resHue)
		{
			if (makersMark)
			{
				Crafter = m;
			}

			return quality;
		}
Exemple #25
0
        public virtual int OnCraft(
            int quality,
            bool makersMark,
            Mobile m,
            CraftSystem craftSystem,
            Type typeRes,
            //Compatibility with UOF fix
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            if (makersMark)
            {
                Crafter = m;
            }

            return(quality);
        }
Exemple #26
0
        public int OnCraft(
            int quality,
            bool makersMark,
            Mobile from,
            CraftSystem craftSystem,
            Type typeRes,
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            ToolQuality = (ToolQuality)quality;

            if (makersMark)
            {
                Crafter = from;
            }

            return(quality);
        }
Exemple #27
0
        public int OnCraft(
            int quality,
            bool makersMark,
            Mobile from,
            CraftSystem craftSystem,
            Type typeRes,
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            Quality = (InstrumentQuality)quality;

            if (from.EraML)
            {
                Type resourceType = typeRes;

                if (resourceType == null)
                {
                    resourceType = craftItem.Resources.GetAt(0).ItemType;
                }

                Resource = CraftResources.GetFromType(resourceType);

                CraftContext context = craftSystem.GetContext(from);

                if (context != null && context.DoNotColor)
                {
                    Hue = 0;
                }
            }
            else
            {
                Resource = DefaultResource;
            }

            if (makersMark)
            {
                Crafter = from;
            }

            return(quality);
        }
Exemple #28
0
        public virtual int OnCraft(
            int quality,
            bool makersMark,
            Mobile from,
            CraftSystem craftSystem,
            Type typeRes,
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            int magery = from.Skills.Magery.BaseFixedPoint;

            if (makersMark)
            {
                Crafter = from;
            }

            m_Quality = (BookQuality)(quality - 1);

            if (craftItem.Recipe != null && craftItem.Recipe.ID == 1001)             //Full spellbook
            {
                Content = ulong.MaxValue;

                bool   allRequiredSkills = true;
                double chance            = craftItem.GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);
                double excepChance       = craftItem.GetExceptionalChance(craftSystem, chance, from);

                double blessChance = excepChance / 3.0;
                if (blessChance < 0.025 && from.Skills[SkillName.Inscribe].Value >= 100.0)
                {
                    blessChance = 0.025;
                }

                if (Crafter != null && m_Quality == BookQuality.Exceptional && blessChance > Utility.RandomDouble())
                {
                    LootType = LootType.Blessed;
                }
            }

            return(quality);
        }
		public override int CanCraft(Mobile from, IBaseTool tool, Type itemType)
		{
			if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
			{
				return 1044038; // You have worn out your tool!
			}
			
			if (!BaseTool.CheckAccessible(tool, from))
			{
				return 1044263; // The tool must be on your person to use.
			}
			
			if (itemType != null &&
					 (itemType.IsSubclassOf(typeof(BaseFactionTrapDeed)) || itemType == typeof(FactionTrapRemovalKit)) &&
					 Faction.Find(from) == null)
			{
				return 1044573; // You have to be in a faction to do that.
			}

			return 0;
		}
Exemple #30
0
        public override int CanCraft(Mobile from, IBaseTool tool, Type itemType)
        {
            if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
            {
                return(1044038);                // You have worn out your tool!
            }

            if (!BaseTool.CheckAccessible(tool, from))
            {
                return(1044263);                // The tool must be on your person to use.
            }

            if (itemType != null &&
                (itemType.IsSubclassOf(typeof(BaseFactionTrapDeed)) || itemType == typeof(FactionTrapRemovalKit)) &&
                Faction.Find(from) == null)
            {
                return(1044573);                // You have to be in a faction to do that.
            }

            return(0);
        }
Exemple #31
0
        public static void BeginTarget(Mobile from, CraftSystem craftSystem, IBaseTool tool)
        {
            CraftContext context = craftSystem.GetContext(from);

            if (context == null)
            {
                return;
            }

            int            lastRes = context.LastResourceIndex;
            CraftSubResCol subRes  = craftSystem.CraftSubRes;

            if (lastRes >= 0 && lastRes < subRes.Count)
            {
                CraftSubRes res = subRes.GetAt(lastRes);

                if (from.Skills[craftSystem.MainSkill].Value < res.RequiredSkill)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, res.Message));
                }
                else
                {
                    CraftResource resource = CraftResources.GetFromType(res.ItemType);

                    if (resource != CraftResource.None)
                    {
                        from.Target = new InternalTarget(craftSystem, tool, res.ItemType, resource);
                        from.SendLocalizedMessage(1061004);                           // Target an item to enhance with the properties of your selected material.
                    }
                    else
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, 1061010));                             // You must select a special material in order to enhance an item with its properties.
                    }
                }
            }
            else
            {
                from.SendGump(new CraftGump(from, craftSystem, tool, 1061010));                     // You must select a special material in order to enhance an item with its properties.
            }
        }
Exemple #32
0
        public virtual int OnCraft(
            int quality,
            bool makersMark,
            Mobile m,
            CraftSystem craftSystem,
            Type typeRes,
            //Compatibility with UOF fix
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            if (makersMark)
            {
                Crafter = m;
            }

            if (craftSystem is Pyrotechnics && craftItem != null)
            {
                CraftContext context = craftSystem.GetContext(m);

                if (context != null && !context.DoNotColor)
                {
                    Hue = resHue;
                }

                CraftRes[] fuses = new CraftRes[craftItem.Resources.Count];
                fuses.SetAll(i => craftItem.Resources.GetAt(i));
                fuses = fuses.Where(res => res.ItemType.IsEqualOrChildOf <FireworkFuse>()).ToArray();

                double fuseDelay = FuseDelay.TotalSeconds * fuses.Sum(r => r.Amount);

                if (fuseDelay > 0)
                {
                    FuseDelay = TimeSpan.FromSeconds(fuseDelay);
                }
            }

            return(quality);
        }
Exemple #33
0
        public override int OnCraft(
            int quality,
            bool makersMark,
            Mobile m,
            CraftSystem craftSystem,
            Type typeRes,
            //Compatibility with UOF fix
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            if (craftSystem is Pyrotechnics && craftItem != null)
            {
                Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;

                if (resourceType != null)
                {
                    Resource = CraftResources.GetFromType(resourceType);
                }
            }

            return(base.OnCraft(quality, makersMark, m, craftSystem, typeRes, tool, craftItem, resHue));
        }
Exemple #34
0
		public override int CanCraft(Mobile from, IBaseTool tool, Type itemType)
		{
			if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
			{
				return 1044038; // You have worn out your tool!
			}
			
			if (!BaseTool.CheckTool(tool, from))
			{
				return 1048146; // If you have a tool equipped, you must use that tool.
			}
			
			if (!(from is PlayerMobile && ((PlayerMobile)from).Masonry && from.Skills[SkillName.Carpentry].Base >= 100.0))
			{
				return 1044633; // You havent learned stonecraft.
			}
			
			if (!BaseTool.CheckAccessible(tool, from))
			{
				return 1044263; // The tool must be on your person to use.
			}

			return 0;
		}
Exemple #35
0
        public override int OnCraft(
            int quality,
            bool makersMark,
            Mobile m,
            CraftSystem craftSystem,
            Type typeRes,
            //Compatibility with UOF fix
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            if (craftSystem is Pyrotechnics && craftItem != null)
            {
                CraftRes[] stars = new CraftRes[craftItem.Resources.Count];
                stars.SetAll(i => craftItem.Resources.GetAt(i));
                stars = stars.Where(res => res.ItemType.IsEqualOrChildOf <BaseFireworkStar>()).ToArray();

                if (stars.Length > 0)
                {
                    StarsRangeMin = 1 + stars.Sum(s => s.Amount);
                    StarsRangeMax = StarsRangeMin * 2;

                    LaunchHeightMin = Math.Max(50, Math.Min(100, StarsRangeMin * 5));
                    LaunchHeightMax = Math.Max(50, Math.Min(100, StarsRangeMax * 5));

                    StarHues.AddRange(BaseFireworkStar.GetEffectHues(typeRes ?? stars[0].ItemType));

                    if (stars.Length > 1)
                    {
                        StarHues.AddRange(stars.Skip(1).SelectMany(s => BaseFireworkStar.GetEffectHues(s.ItemType)));
                    }
                }
            }

            return(base.OnCraft(quality, makersMark, m, craftSystem, typeRes, tool, craftItem, resHue));
        }
		public QueryMakersMarkGump( int quality, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, IBaseTool tool ) : base( 100, 200 )
		{
			from.CloseGump( typeof( QueryMakersMarkGump ) );

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

			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, 1011011, false, false ); // CONTINUE
			AddButton( 20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0 );

			AddHtmlLocalized( 55, 125, 140, 25, 1011012, false, false ); // CANCEL
			AddButton( 20, 125, 4005, 4007, 0, GumpButtonType.Reply, 0 );
		}
Exemple #37
0
        public override int CanCraft(Mobile from, IBaseTool tool, Type itemType)
        {
            if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
            {
                return(1044038);                // You have worn out your tool!
            }

            if (!BaseTool.CheckTool(tool, from))
            {
                return(1048146);                // If you have a tool equipped, you must use that tool.
            }

            if (!(from is PlayerMobile && ((PlayerMobile)from).Masonry && from.Skills[SkillName.Carpentry].Base >= 100.0))
            {
                return(1044633);                // You havent learned stonecraft.
            }

            if (!BaseTool.CheckAccessible(tool, from))
            {
                return(1044263);                // The tool must be on your person to use.
            }

            return(0);
        }
Exemple #38
0
        public QueryMakersMarkGump(int quality, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, IBaseTool tool) : base(100, 200)
        {
            from.CloseGump(typeof(QueryMakersMarkGump));

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

            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, 1011011, false, false);              // CONTINUE
            AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);

            AddHtmlLocalized(55, 125, 140, 25, 1011012, false, false);               // CANCEL
            AddButton(20, 125, 4005, 4007, 0, GumpButtonType.Reply, 0);
        }
Exemple #39
0
 public CraftGump(Mobile from, CraftSystem craftSystem, IBaseTool tool, object notice)
     : this(from, craftSystem, tool, notice, CraftPage.None)
 {
 }
		public abstract int CanCraft( Mobile from, IBaseTool tool, Type itemType );
		public virtual int OnCraft(
			int quality,
			bool makersMark,
			Mobile m,
			CraftSystem craftSystem,
			Type typeRes,
			//Compatibility with UOF fix
			IBaseTool tool,
			CraftItem craftItem,
			int resHue)
		{
			if (makersMark)
			{
				Crafter = m;
			}

			if (craftSystem is Pyrotechnics && craftItem != null)
			{
				CraftContext context = craftSystem.GetContext(m);

				if (context != null && !context.DoNotColor)
				{
					Hue = resHue;
				}

				CraftRes[] fuses = new CraftRes[craftItem.Resources.Count];
				fuses.SetAll(i => craftItem.Resources.GetAt(i));
				fuses = fuses.Where(res => res.ItemType.IsEqualOrChildOf<FireworkFuse>()).ToArray();

				double fuseDelay = FuseDelay.TotalSeconds * fuses.Sum(r => r.Amount);

				if (fuseDelay > 0)
				{
					FuseDelay = TimeSpan.FromSeconds(fuseDelay);
				}
			}

			return quality;
		}
Exemple #42
0
 public static bool CheckTool(IBaseTool tool, Mobile m)
 {
     return(CheckTool(tool as Item, m));
 }
Exemple #43
0
 public static bool CheckAccessible(IBaseTool tool, Mobile m)
 {
     return(CheckAccessible(tool as Item, m));
 }
Exemple #44
0
		public virtual int OnCraft(
			int quality,
			bool makersMark,
			Mobile from,
			CraftSystem craftSystem,
			Type typeRes,
			IBaseTool tool,
			CraftItem craftItem,
			int resHue)
		{
			int magery = from.Skills.Magery.BaseFixedPoint;

			if (makersMark)
			{
				Crafter = from;
			}

			m_Quality = (BookQuality)(quality - 1);

			if (craftItem.Recipe != null && craftItem.Recipe.ID == 1001) //Full spellbook
			{
				Content = ulong.MaxValue;

				bool allRequiredSkills = true;
				double chance = craftItem.GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);
				double excepChance = craftItem.GetExceptionalChance(craftSystem, chance, from);

				double blessChance = excepChance / 3.0;
				if (blessChance < 0.025 && from.Skills[SkillName.Inscribe].Value >= 100.0)
				{
					blessChance = 0.025;
				}

				if (Crafter != null && m_Quality == BookQuality.Exceptional && blessChance > Utility.RandomDouble())
				{
					LootType = LootType.Blessed;
				}
			}

			return quality;
		}
		public override int OnCraft(
			int quality,
			bool makersMark,
			Mobile m,
			CraftSystem craftSystem,
			Type typeRes,
			//Compatibility with UOF fix
			IBaseTool tool,
			CraftItem craftItem,
			int resHue)
		{
			if (craftSystem is Pyrotechnics && craftItem != null)
			{
				Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;

				if (resourceType != null)
				{
					Resource = CraftResources.GetFromType(resourceType);
				}
			}

			return base.OnCraft(quality, makersMark, m, craftSystem, typeRes, tool, craftItem, resHue);
		}
Exemple #46
0
        public virtual int OnCraft(
            int quality,
            bool makersMark,
            Mobile from,
            CraftSystem craftSystem,
            Type typeRes,
            IBaseTool tool,
            CraftItem craftItem,
            int resHue)
        {
            Quality = (WeaponQuality) quality;

            if (makersMark)
            {
                Crafter = from;
            }

            PlayerConstructed = true;

            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            Resource = CraftResources.GetFromType(resourceType);

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }

            if (tool is BaseRunicTool)
            {
                CraftResource thisResource = CraftResources.GetFromType(resourceType);

                if (thisResource == ((BaseRunicTool) tool).Resource)
                {
                    Identified = true;
                    /*
					Resource = thisResource;

					CraftContext context = craftSystem.GetContext( from );

					if ( context != null && context.DoNotColor )
						Hue = 0;
*/
                    switch (thisResource)
                    {
                        case CraftResource.DullCopper:
                        {
                            Identified = true;
                            DurabilityLevel = WeaponDurabilityLevel.Durable;
                            AccuracyLevel = WeaponAccuracyLevel.Accurate;
                            break;
                        }
                        case CraftResource.ShadowIron:
                        {
                            Identified = true;
                            DurabilityLevel = WeaponDurabilityLevel.Durable;
                            DamageLevel = WeaponDamageLevel.Ruin;
                            break;
                        }
                        case CraftResource.Copper:
                        {
                            Identified = true;
                            DurabilityLevel = WeaponDurabilityLevel.Fortified;
                            DamageLevel = WeaponDamageLevel.Ruin;
                            AccuracyLevel = WeaponAccuracyLevel.Surpassingly;
                            break;
                        }
                        case CraftResource.Bronze:
                        {
                            Identified = true;
                            DurabilityLevel = WeaponDurabilityLevel.Fortified;
                            DamageLevel = WeaponDamageLevel.Might;
                            AccuracyLevel = WeaponAccuracyLevel.Surpassingly;
                            break;
                        }
                        case CraftResource.Gold:
                        {
                            Identified = true;
                            DurabilityLevel = WeaponDurabilityLevel.Indestructible;
                            DamageLevel = WeaponDamageLevel.Force;
                            AccuracyLevel = WeaponAccuracyLevel.Eminently;
                            break;
                        }
                        case CraftResource.Agapite:
                        {
                            Identified = true;
                            DurabilityLevel = WeaponDurabilityLevel.Indestructible;
                            DamageLevel = WeaponDamageLevel.Power;
                            AccuracyLevel = WeaponAccuracyLevel.Eminently;
                            break;
                        }
                        case CraftResource.Verite:
                        {
                            Identified = true;
                            DurabilityLevel = WeaponDurabilityLevel.Indestructible;
                            DamageLevel = WeaponDamageLevel.Power;
                            AccuracyLevel = WeaponAccuracyLevel.Exceedingly;
                            break;
                        }
                        case CraftResource.Valorite:
                        {
                            Identified = true;
                            DurabilityLevel = WeaponDurabilityLevel.Indestructible;
                            DamageLevel = WeaponDamageLevel.Vanq;
                            AccuracyLevel = WeaponAccuracyLevel.Supremely;
                            break;
                        }
                    }
                }
            }

            var region1 = from.Region as CustomRegion;

            if (region1 != null && region1.CraftRegion() && m_EthicState == null)
            {

                if (Quality == WeaponQuality.Exceptional)
                {                   

                    // Only care about types of wood higher than plain and upper bound it in case of additions
                    // Special woods start at 301 and go to 307
                    if (Resource > (CraftResource)301 && Resource <= (CraftResource)307)
                    {
                        var durabilityRoll = Utility.RandomDouble();
                        var damageRoll = Utility.RandomDouble();
                        var accuracyRoll = Utility.RandomDouble();                        

                        double modifierChance = 0.06;
                        bool addedModifier = false;

                        var woodQuality = (int)Resource - 300;                       

                        if (modifierChance > durabilityRoll)
                        {
                            var rolledDurability = Utility.Random(1, woodQuality - 1);
                            if (Enum.IsDefined(typeof(WeaponDurabilityLevel), rolledDurability))
                            {
                                DurabilityLevel = (WeaponDurabilityLevel)rolledDurability;                                
                                addedModifier = true;
                            }
                        }
                        if (modifierChance > damageRoll)
                        {
                            var rolledDamage = Utility.Random(1, woodQuality - 1);
                            if (Enum.IsDefined(typeof(WeaponDamageLevel), rolledDamage))
                            {
                                DamageLevel = (WeaponDamageLevel)rolledDamage;                               
                                addedModifier = true;
                            }
                        }
                        if (modifierChance > accuracyRoll)
                        {
                            var rolledAccuracy = Utility.Random(1, woodQuality - 1);

                            if (Enum.IsDefined(typeof(WeaponAccuracyLevel), rolledAccuracy))
                            {
                                AccuracyLevel = (WeaponAccuracyLevel)rolledAccuracy;                                
                                addedModifier = true;
                            }
                        }

                        if (addedModifier)
                        {
                            from.SendMessage("Your material and skill have added magical properties to this weapon.");                            
                        }                        
                    }                       
			    }
                

                if (Type == WeaponType.Ranged)
                {
                    double skillBaseFletching = from.Skills[SkillName.Fletching].Base;
                    double factor = (skillBaseFletching / 100.0) * 0.02;
                    if (factor >= Utility.RandomDouble())
                    {
                        from.SendMessage("You have successfully crafted a slayer weapon.");
                        Slayer = (SlayerName) Utility.Random(27) + 1;
                    }
                }
                if (Type == WeaponType.Staff)
                {
                    double skillBaseCarpentry = from.Skills[SkillName.Carpentry].Base;
                    double factor = (skillBaseCarpentry / 100.0) * 0.02;
                    if (factor >= Utility.RandomDouble())
                    {
                        from.SendMessage("You have successfully crafted a slayer weapon.");
                        Slayer = (SlayerName) Utility.Random(27) + 1;
                    }
                }
                else
                {
                    double skillBaseBS = from.Skills[SkillName.Blacksmith].Base;
                    double factor = (skillBaseBS / 100.0) * 0.02;
                    if (factor >= Utility.RandomDouble())
                    {
                        from.SendMessage("You have successfully crafted a slayer weapon.");
                        Slayer = (SlayerName) Utility.Random(27) + 1;
                    }
                }
            }
            return quality;
        }
		public virtual int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, IBaseTool tool, CraftItem craftItem, int resHue )
		{
			Quality = (ClothingQuality)quality;
			Identified = true;

			if ( makersMark )
				Crafter = from;

			if ( DefaultResource != CraftResource.None )
			{
				Type resourceType = typeRes;

				if ( resourceType == null )
					resourceType = craftItem.Resources.GetAt( 0 ).ItemType;

				Resource = CraftResources.GetFromType( resourceType );
			}
			else
			{
				Hue = resHue;
			}

			PlayerConstructed = true;

			CraftContext context = craftSystem.GetContext( from );

			if ( context != null && context.DoNotColor )
				Hue = 0;

			return quality;
		}
Exemple #48
0
		public static bool CheckTool(IBaseTool tool, Mobile m)
		{
			return CheckTool(tool as Item, m);
		}
Exemple #49
0
		public static bool CheckAccessible(IBaseTool tool, Mobile m)
		{
			return CheckAccessible(tool as Item, m);
		}
Exemple #50
0
		public int OnCraft(
			int quality,
			bool makersMark,
			Mobile from,
			CraftSystem craftSystem,
			Type typeRes,
			IBaseTool tool,
			CraftItem craftItem,
			int resHue)
		{
			ToolQuality = (ToolQuality)quality;

			if (makersMark)
			{
				Crafter = from;
			}

			return quality;
		}
		public int OnCraft(
			int quality,
			bool makersMark,
			Mobile from,
			CraftSystem craftSystem,
			Type typeRes,
			IBaseTool tool,
			CraftItem craftItem,
			int resHue)
		{
			Quality = (InstrumentQuality)quality;

			if (from.EraML)
			{
				Type resourceType = typeRes;

				if (resourceType == null)
				{
					resourceType = craftItem.Resources.GetAt(0).ItemType;
				}

				Resource = CraftResources.GetFromType(resourceType);

				CraftContext context = craftSystem.GetContext(from);

				if (context != null && context.DoNotColor)
				{
					Hue = 0;
				}
			}
			else
			{
				Resource = DefaultResource;
			}

			if (makersMark)
			{
				Crafter = from;
			}

			return quality;
		}
Exemple #52
0
        private CraftGump(Mobile from, CraftSystem craftSystem, IBaseTool tool, object notice, CraftPage page)
            : base(40, 40)
        {
            m_From        = from;
            m_CraftSystem = craftSystem;
            m_Tool        = tool;
            m_Page        = page;

            CraftContext context = craftSystem.GetContext(from);

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

            AddPage(0);

            AddBackground(0, 0, 530, 437, 5054);
            AddImageTiled(10, 10, 510, 22, 2624);
            AddImageTiled(10, 292, 150, 25, 2624);
            AddImageTiled(165, 292, 355, 45, 2624);
            AddImageTiled(10, 342, 510, 85, 2624);
            AddImageTiled(10, 37, 200, 250, 2624);
            AddImageTiled(215, 37, 305, 250, 2624);
            AddAlphaRegion(10, 10, 510, 417);

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

            AddHtmlLocalized(10, 38, 200, 22, 1044010, LabelColor, false, false);             // <CENTER>CATEGORIES</CENTER>
            AddHtmlLocalized(215, 38, 305, 22, 1044011, LabelColor, false, false);            // <CENTER>SELECTIONS</CENTER>
            AddHtmlLocalized(10, 293, 150, 22, 1044012, LabelColor, false, false);            // <CENTER>NOTICES</CENTER>

            AddButton(15, 402, 4017, 4019, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor, false, false);             // EXIT

            AddButton(270, 402, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0);
            AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor, false, false);             // MAKE LAST

            // Mark option
            if (craftSystem.MarkOption)
            {
                AddButton(270, 362, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0);
                AddHtmlLocalized(
                    305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor, false, false);
                // MARK ITEM
            }
            // ****************************************

            // Resmelt option
            if (craftSystem.Resmelt)
            {
                AddButton(15, 342, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0);
                AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor, false, false);                 // SMELT ITEM
            }
            // ****************************************

            // Repair option
            if (craftSystem.Repair)
            {
                AddButton(270, 342, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0);
                AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor, false, false);                 // REPAIR ITEM
            }
            // ****************************************

            // Enhance option
            if (craftSystem.CanEnhance)
            {
                AddButton(270, 382, 4005, 4007, GetButtonID(6, 8), GumpButtonType.Reply, 0);
                AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor, false, false);                 // ENHANCE ITEM
            }
            // ****************************************

            if (notice is int && (int)notice > 0)
            {
                AddHtmlLocalized(170, 295, 350, 40, (int)notice, LabelColor, false, false);
            }
            else if (notice is string)
            {
                AddHtml(170, 295, 350, 40, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice), false, false);
            }

            // If the system has more than one resource
            if (craftSystem.CraftSubRes.Init)
            {
                string nameString = craftSystem.CraftSubRes.NameString;
                int    nameNumber = craftSystem.CraftSubRes.NameNumber;

                int resIndex = (context == null ? -1 : context.LastResourceIndex);

                Type resourceType = craftSystem.CraftSubRes.ResType;

                if (resIndex > -1)
                {
                    CraftSubRes subResource = craftSystem.CraftSubRes.GetAt(resIndex);

                    nameString   = subResource.NameString;
                    nameNumber   = subResource.NameNumber;
                    resourceType = subResource.ItemType;
                }

                int resourceCount = 0;

                if (from.Backpack != null)
                {
                    Item[] items = from.Backpack.FindItemsByType(resourceType, true);

                    resourceCount += items.Sum(t => t.Amount);
                }

                AddButton(15, 362, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0);

                if (nameNumber > 0)
                {
                    AddHtmlLocalized(
                        50, 365, 250, 18, nameNumber, resourceCount.ToString(CultureInfo.InvariantCulture), LabelColor, false, false);
                }
                else
                {
                    AddLabel(50, 362, LabelHue, String.Format("{0} ({1} Available)", nameString, resourceCount));
                }
            }
            // ****************************************

            // For dragon scales
            if (craftSystem.CraftSubRes2.Init)
            {
                string nameString = craftSystem.CraftSubRes2.NameString;
                int    nameNumber = craftSystem.CraftSubRes2.NameNumber;

                int resIndex = (context == null ? -1 : context.LastResourceIndex2);

                Type resourceType = craftSystem.CraftSubRes2.ResType;

                if (resIndex > -1)
                {
                    CraftSubRes subResource = craftSystem.CraftSubRes2.GetAt(resIndex);

                    nameString   = subResource.NameString;
                    nameNumber   = subResource.NameNumber;
                    resourceType = subResource.ItemType;
                }

                int resourceCount = 0;

                if (from.Backpack != null)
                {
                    Item[] items = from.Backpack.FindItemsByType(resourceType, true);

                    resourceCount += items.Sum(t => t.Amount);
                }

                AddButton(15, 382, 4005, 4007, GetButtonID(6, 7), GumpButtonType.Reply, 0);

                if (nameNumber > 0)
                {
                    AddHtmlLocalized(
                        50, 385, 250, 18, nameNumber, resourceCount.ToString(CultureInfo.InvariantCulture), LabelColor, false, false);
                }
                else
                {
                    AddLabel(50, 385, LabelHue, String.Format("{0} ({1} Available)", nameString, resourceCount));
                }
            }
            // ****************************************

            CreateGroupList();

            switch (page)
            {
            case CraftPage.PickResource:
                CreateResList(false, from);
                break;

            case CraftPage.PickResource2:
                CreateResList(true, from);
                break;

            default:
            {
                if (context != null && context.LastGroupIndex > -1)
                {
                    CreateItemList(context.LastGroupIndex);
                }
            }
            break;
            }
        }
Exemple #53
0
		private CraftGump(Mobile from, CraftSystem craftSystem, IBaseTool tool, object notice, CraftPage page)
			: base(40, 40)
		{
			m_From = from;
			m_CraftSystem = craftSystem;
			m_Tool = tool;
			m_Page = page;

			CraftContext context = craftSystem.GetContext(from);

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

			AddPage(0);

			AddBackground(0, 0, 530, 437, 5054);
			AddImageTiled(10, 10, 510, 22, 2624);
			AddImageTiled(10, 292, 150, 25, 2624);
			AddImageTiled(165, 292, 355, 45, 2624);
			AddImageTiled(10, 342, 510, 85, 2624);
			AddImageTiled(10, 37, 200, 250, 2624);
			AddImageTiled(215, 37, 305, 250, 2624);
			AddAlphaRegion(10, 10, 510, 417);

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

			AddHtmlLocalized(10, 38, 200, 22, 1044010, LabelColor, false, false); // <CENTER>CATEGORIES</CENTER>
			AddHtmlLocalized(215, 38, 305, 22, 1044011, LabelColor, false, false); // <CENTER>SELECTIONS</CENTER>
			AddHtmlLocalized(10, 293, 150, 22, 1044012, LabelColor, false, false); // <CENTER>NOTICES</CENTER>

			AddButton(15, 402, 4017, 4019, 0, GumpButtonType.Reply, 0);
			AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor, false, false); // EXIT

			AddButton(270, 402, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0);
			AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor, false, false); // MAKE LAST

			// Mark option
			if (craftSystem.MarkOption)
			{
				AddButton(270, 362, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0);
				AddHtmlLocalized(
					305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor, false, false);
				// MARK ITEM
			}
			// ****************************************

			// Resmelt option
			if (craftSystem.Resmelt)
			{
				AddButton(15, 342, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0);
				AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor, false, false); // SMELT ITEM
			}
			// ****************************************

			// Repair option
			if (craftSystem.Repair)
			{
				AddButton(270, 342, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0);
				AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor, false, false); // REPAIR ITEM
			}
			// ****************************************

			// Enhance option
			if (craftSystem.CanEnhance)
			{
				AddButton(270, 382, 4005, 4007, GetButtonID(6, 8), GumpButtonType.Reply, 0);
				AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor, false, false); // ENHANCE ITEM
			}
			// ****************************************

			if (notice is int && (int)notice > 0)
			{
				AddHtmlLocalized(170, 295, 350, 40, (int)notice, LabelColor, false, false);
			}
			else if (notice is string)
			{
				AddHtml(170, 295, 350, 40, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice), false, false);
			}

			// If the system has more than one resource
			if (craftSystem.CraftSubRes.Init)
			{
				string nameString = craftSystem.CraftSubRes.NameString;
				int nameNumber = craftSystem.CraftSubRes.NameNumber;

				int resIndex = (context == null ? -1 : context.LastResourceIndex);

				Type resourceType = craftSystem.CraftSubRes.ResType;

				if (resIndex > -1)
				{
					CraftSubRes subResource = craftSystem.CraftSubRes.GetAt(resIndex);

					nameString = subResource.NameString;
					nameNumber = subResource.NameNumber;
					resourceType = subResource.ItemType;
				}

				int resourceCount = 0;

				if (from.Backpack != null)
				{
					Item[] items = from.Backpack.FindItemsByType(resourceType, true);

					resourceCount += items.Sum(t => t.Amount);
				}

				AddButton(15, 362, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0);

				if (nameNumber > 0)
				{
					AddHtmlLocalized(
						50, 365, 250, 18, nameNumber, resourceCount.ToString(CultureInfo.InvariantCulture), LabelColor, false, false);
				}
				else
				{
					AddLabel(50, 362, LabelHue, String.Format("{0} ({1} Available)", nameString, resourceCount));
				}
			}
			// ****************************************

			// For dragon scales
			if (craftSystem.CraftSubRes2.Init)
			{
				string nameString = craftSystem.CraftSubRes2.NameString;
				int nameNumber = craftSystem.CraftSubRes2.NameNumber;

				int resIndex = (context == null ? -1 : context.LastResourceIndex2);

				Type resourceType = craftSystem.CraftSubRes2.ResType;

				if (resIndex > -1)
				{
					CraftSubRes subResource = craftSystem.CraftSubRes2.GetAt(resIndex);

					nameString = subResource.NameString;
					nameNumber = subResource.NameNumber;
					resourceType = subResource.ItemType;
				}

				int resourceCount = 0;

				if (from.Backpack != null)
				{
					Item[] items = from.Backpack.FindItemsByType(resourceType, true);

					resourceCount += items.Sum(t => t.Amount);
				}

				AddButton(15, 382, 4005, 4007, GetButtonID(6, 7), GumpButtonType.Reply, 0);

				if (nameNumber > 0)
				{
					AddHtmlLocalized(
						50, 385, 250, 18, nameNumber, resourceCount.ToString(CultureInfo.InvariantCulture), LabelColor, false, false);
				}
				else
				{
					AddLabel(50, 385, LabelHue, String.Format("{0} ({1} Available)", nameString, resourceCount));
				}
			}
			// ****************************************

			CreateGroupList();

			switch (page)
			{
				case CraftPage.PickResource:
					CreateResList(false, from);
					break;
				case CraftPage.PickResource2:
					CreateResList(true, from);
					break;
				default:
					{
						if (context != null && context.LastGroupIndex > -1)
						{
							CreateItemList(context.LastGroupIndex);
						}
					}
					break;
			}
		}
Exemple #54
0
		public CraftGump(Mobile from, CraftSystem craftSystem, IBaseTool tool, object notice)
			: this(from, craftSystem, tool, notice, CraftPage.None)
		{ }
		public override int CanCraft(Mobile from, IBaseTool tool, Type itemType)
		{
			if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
			{
				return 1044038; // You have worn out your tool!
			}

			if (!BaseTool.CheckTool(tool, from))
			{
				return 1048146; // If you have a tool equipped, you must use that tool.
			}

			if (!BaseTool.CheckAccessible(tool, from))
			{
				return 1044263; // The tool must be on your person to use.
			}

			bool anvil, forge;
			CheckAnvilAndForge(from, 2, out anvil, out forge);

			if (anvil && forge)
			{
				return 0;
			}

			return 1044267; // You must be near an anvil and a forge to smith items.
		}
		public ExplosionTrapCraft(
			Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, IBaseTool tool, int quality)
			: base(from, craftItem, craftSystem, typeRes, tool, quality)
		{ }
		public override int OnCraft(
			int quality,
			bool makersMark,
			Mobile m,
			CraftSystem craftSystem,
			Type typeRes,
			//Compatibility with UOF fix
			IBaseTool tool,
			CraftItem craftItem,
			int resHue)
		{
			if (craftSystem is Pyrotechnics && craftItem != null)
			{
				CraftRes[] stars = new CraftRes[craftItem.Resources.Count];
				stars.SetAll(i => craftItem.Resources.GetAt(i));
				stars = stars.Where(res => res.ItemType.IsEqualOrChildOf<BaseFireworkStar>()).ToArray();
				
				if (stars.Length > 0)
				{
					StarsRangeMin = 1 + stars.Sum(s => s.Amount);
					StarsRangeMax = StarsRangeMin * 2;

					LaunchHeightMin = Math.Max(50, Math.Min(100, StarsRangeMin * 5));
					LaunchHeightMax = Math.Max(50, Math.Min(100, StarsRangeMax * 5));

					StarHues.AddRange(BaseFireworkStar.GetEffectHues(typeRes ?? stars[0].ItemType));

					if (stars.Length > 1)
					{
						StarHues.AddRange(stars.Skip(1).SelectMany(s => BaseFireworkStar.GetEffectHues(s.ItemType)));
					}
				}
			}

			return base.OnCraft(quality, makersMark, m, craftSystem, typeRes, tool, craftItem, resHue);
		}
Exemple #58
0
 public static void Do(Mobile from, CraftSystem craftSystem, IBaseTool tool)
 {
     from.Target = new InternalTarget(craftSystem, tool);
     from.SendLocalizedMessage(1044276); // Target an item to repair.
 }
        public CraftGumpItem(Mobile from, CraftSystem craftSystem, CraftItem craftItem, IBaseTool 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);               //gray border
            AddImageTiled(10, 10, 510, 22, 2624);
            //AddImageTiled( 10, 37, 150, 148, 2624 );
            AddImageTiled(10, 37, 150, 90, 2624);
            AddImageTiled(165, 37, 355, 90, 2624);
            //AddImageTiled( 10, 190, 155, 22, 2624 );
            AddImageTiled(10, 132, 150, 22, 2624);
            //AddImageTiled( 10, 217, 150, 53, 2624 ); //(removed)
            AddImageTiled(165, 132, 355, 80, 2624);
            //AddImageTiled( 10, 275, 155, 22, 2624 );
            AddImageTiled(10, 217, 150, 22, 2624);
            //AddImageTiled( 10, 302, 150, 53, 2624 ); //(removed)
            AddImageTiled(165, 217, 355, 80, 2624);
            //AddImageTiled( 10, 360, 155, 22, 2624 );
            AddImageTiled(10, 302, 150, 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, 134, 150, 22, 1044054, LabelColor, false, false);               // <CENTER>SKILLS</CENTER>
            AddHtmlLocalized(10, 219, 150, 22, 1044055, LabelColor, false, false);               // <CENTER>MATERIALS</CENTER>
            AddHtmlLocalized(10, 304, 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

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

            if (needsRecipe)
            {
                AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page, 0);
                AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor, false, false);                   // MAKE NOW
            }
            else
            {
                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();
            DrawResource();

            /*
             * if( craftItem.RequiresSE )
             *      AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1063363, LabelColor, false, false ); //* Requires the "Samurai Empire" expansion
             * */

            if (craftItem.RequiredExpansion != Expansion.None)
            {
                bool supportsEx = (from.NetState != null && from.NetState.SupportsExpansion(craftItem.RequiredExpansion) && from.Expansion >= craftItem.RequiredExpansion);
                TextDefinition.AddHtmlText(this, 170, 302 + (m_OtherCount++ *20), 310, 18, RequiredExpansionMessage(craftItem.RequiredExpansion), false, false, supportsEx ? LabelColor : RedLabelColor, supportsEx ? LabelHue : RedLabelHue);
            }

            if (needsRecipe)
            {
                AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1073620, RedLabelColor, false, false);                    // You have not learned this recipe.
            }
        }
Exemple #60
0
 public InternalTarget(CraftSystem craftSystem, IBaseTool tool)
     : base(2, false, TargetFlags.None)
 {
     m_CraftSystem = craftSystem;
     m_Tool = tool;
 }