Exemple #1
0
        public override void AddNameProperty(ObjectPropertyList list)
        {
            PlantHueInfo info = PlantHueInfo.GetInfo(m_PlantHue);

            if (Amount > 1)
            {
                list.Add(info.IsBright() ? 1113272 : 1113274, string.Format("{0}\t#{1}", Amount.ToString(), info.Name)); //~1_AMOUNT~ bright ~2_COLOR~ plant clippings
            }
            else
            {
                list.Add(info.IsBright() ? 1112121 : 1112122, string.Format("#{0}", info.Name)); //bright ~1_COLOR~ plant clippings
            }
        }
Exemple #2
0
        }// Dry Reeds
        public override void AddNameProperty(ObjectPropertyList list)
        {
            PlantHueInfo hueInfo = PlantHueInfo.GetInfo(this.m_PlantHue);

            if (this.Amount > 1)
            {
                list.Add(1113275, "{0}\t{1}", this.Amount, "#" + hueInfo.Name);  // ~1_COLOR~ Softened Reeds
            }
            else
            {
                list.Add(1112289, "#" + hueInfo.Name);  // ~1_COLOR~ dry reeds
            }
        }
        //master constructor
        public SeedListEntry(Item item) : base(item)
        {
            Seed seed = (Seed)item;

            _PlantType = seed.PlantType;
            _PlantHue  = seed.PlantHue;
            _ShowType  = seed.ShowType;

            //TODO: find a way to using the PlantTypeInfo cliloc values
            PlantHueInfo  hueInfo  = PlantHueInfo.GetInfo(seed.PlantHue);
            PlantTypeInfo typeInfo = PlantTypeInfo.GetInfo(seed.PlantType);

            _Name = CliLoc.LocToString(hueInfo.IsBright() ? 1061918 : 1061917, String.Concat("#", hueInfo.Name.ToString(), "\t#", typeInfo.Name.ToString())); // [bright] ~1_COLOR~ ~2_TYPE~ seed
                                                                                                                                                              //_PlantType.ToString();
        }
Exemple #4
0
        public override void AddNameProperty(ObjectPropertyList list)
        {
            PlantHueInfo info = PlantHueInfo.GetInfo(m_PlantHue);
            int          cliloc;

            if (Amount > 1)
            {
                cliloc = info.IsBright() ? 1113273 : 1113275;
                list.Add(cliloc, string.Format("{0}\t#{1}", Amount.ToString(), info.Name));
            }
            else
            {
                cliloc = info.IsBright() ? 1112288 : 1112289;
                list.Add(cliloc, string.Format("#{0}", info.Name));
            }
        }
Exemple #5
0
        public void InvalidatePlantHue()
        {
            PlantHueInfo info = PlantHueInfo.GetInfo(m_PlantHue);

            if (info == null)
            {
                m_PlantHue = PlantHue.Plain;
                Hue        = 0;
            }
            else
            {
                Hue = info.Hue;
            }

            InvalidateProperties();
        }
Exemple #6
0
        public override LocalizedText GetNameProperty()
        {
            PlantHueInfo info = PlantHueInfo.GetInfo(m_PlantHue);

            if (Amount != 1)
            {
                return(new LocalizedText(info.IsBright()
                                                ? 1113322 // ~1_AMOUNT~ bright ~2_COLOR~ softened reeds
                                                : 1113323 // ~1_AMOUNT~ ~2_COLOR~ softened reeds
                                         , String.Format("{0}\t#{1}", Amount, info.Name)));
            }
            else
            {
                return(new LocalizedText(info.IsBright()
                                                ? 1112347 // bright ~1_COLOR~ softened reeds
                                                : 1112346 // ~1_COLOR~ softened reeds
                                         , String.Format("#{0}", info.Name)));
            }
        }
Exemple #7
0
        public override LocalizedText GetNameProperty()
        {
            PlantHueInfo info = PlantHueInfo.GetInfo(m_PlantHue);

            if (Amount != 1)
            {
                return(new LocalizedText(info.IsBright()
                                                ? 1113271 // ~1_AMOUNT~ bright ~2_COLOR~ plant pigments
                                                : 1113270 // ~1_AMOUNT~ ~2_COLOR~ plant pigments
                                         , String.Format("{0}\t#{1}", Amount, info.Name)));
            }
            else
            {
                return(new LocalizedText(info.IsBright()
                                                ? 1112134 // bright ~1_COLOR~ plant pigment
                                                : 1112133 // ~1_COLOR~ plant pigment
                                         , String.Format("#{0}", info.Name)));
            }
        }
Exemple #8
0
        public override LocalizedText GetNameProperty()
        {
            PlantHueInfo info = PlantHueInfo.GetInfo(m_PlantHue);

            if (Amount != 1)
            {
                return(new LocalizedText(info.IsBright()
                                                ? 1113277 // ~1_AMOUNT~ bright ~2_COLOR~ natural dyes
                                                : 1113276 // ~1_AMOUNT~ ~2_COLOR~ natural dyes
                                         , String.Format("{0}\t#{1}", Amount, info.Name)));
            }
            else
            {
                return(new LocalizedText(info.IsBright()
                                                ? 1112138 // bright ~1_COLOR~ natural dye
                                                : 1112137 // ~1_COLOR~ natural dye
                                         , String.Format("#{0}", info.Name)));
            }
        }
Exemple #9
0
        public void InvalidateHue()
        {
            PlantHueInfo info = PlantHueInfo.GetInfo(Hue);

            m_PlantHue = info.PlantHue;
        }
Exemple #10
0
        public override void AddNameProperty(ObjectPropertyList list)
        {
            PlantHueInfo hueInfo = PlantHueInfo.GetInfo(m_PlantHue);

            list.Add(1112289, "#" + hueInfo.Name);  // ~1_COLOR~ dry reeds
        }
Exemple #11
0
            /// <summary>
            /// Adds the page buttons (PlantTypes).
            /// </summary>
            private void AddPages(int MaxPerRow)
            {
                int pageindex   = 1;
                int itemindex   = 0;
                int buttonindex = 1;
                int verticaladd = 0;                 // temporary

                if (m_Box.UnknownStorage.Count > 0)
                {
                    AddButton(37, 55, 2103, 2104, 0, GumpButtonType.Page, pageindex);               // Type button
                    AddHtmlLocalized(50, 50, 110, 20, 1060800, false, false);                       // Plant name: unknown
                    pageindex++;
                }

                PlantTypeInfo pi;

                foreach (SeedInfo si in m_Box.KnownStorage)
                {
                    pi = PlantTypeInfo.GetInfo(si.Type);
                    AddButton(37, 35 + pageindex * 20, 2103, 2104, 0, GumpButtonType.Page, pageindex);               // Type button
                    AddHtmlLocalized(50, 30 + pageindex * 20, 110, 20, pi.Name, false, false);                       // Plant name
                    pageindex++;
                }

                pageindex = 1;                 // reset

                PlantHueInfo ph;

                if (m_Box.UnknownStorage.Count > 0)
                {
                    AddPage(pageindex);
                    //AddItem( 190, 60, 1, 0 ); // Plant picture
                    AddHtmlLocalized(264, 45, 170, 20, 3000575, false, false);                       // Type description: UNKNOWN

                    // Unknown seeds are displayed in a single category
                    foreach (SeedInfo si in m_Box.UnknownStorage)
                    {
                        foreach (SeedHue sh in si.Hues)
                        {
                            ph = PlantHueInfo.GetInfo(sh.Hue);
                            AddButton(170 + verticaladd, 130 + itemindex * 20, 22407, 22406, buttonindex++, GumpButtonType.Reply, 0); // Take button
                            AddLabel(190 + verticaladd, 130 + itemindex * 20, 0x835, sh.Amount.ToString());
                            AddHtmlLocalized(220 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                // Hue description
                            itemindex++;
                            if (itemindex >= MaxPerRow)                                                                               // Start next row
                            {
                                itemindex   = 0;
                                verticaladd = 150;
                            }
                        }
                    }
                    pageindex++;
                }

                foreach (SeedInfo si in m_Box.KnownStorage)
                {
                    pi = PlantTypeInfo.GetInfo(si.Type);
                    AddPage(pageindex);
                    AddItem(187 + pi.OffsetX, 50 + pi.OffsetY, pi.ItemID, 0);                       // Plant picture
                    AddHtmlLocalized(264, 45, 170, 20, pi.Name, false, false);                      // Type description

                    itemindex   = 0;
                    verticaladd = 0;
                    foreach (SeedHue sh in si.Hues)
                    {
                        ph = PlantHueInfo.GetInfo(sh.Hue);
                        AddButton(170 + verticaladd, 130 + itemindex * 20, 22407, 22406, buttonindex++, GumpButtonType.Reply, 0);                           // Take button
                        AddLabel(190 + verticaladd, 130 + itemindex * 20, 0x835, sh.Amount.ToString());

                        if ((int)sh.Hue < 0x8000000)
                        {
                            AddHtmlLocalized(220 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                               // Hue description
                        }
                        else
                        {
                            AddLabel(220 + verticaladd, 130 + itemindex * 20, 0, "bright");
                            AddHtmlLocalized(260 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                               // Hue description
                        }
                        itemindex++;
                        if (itemindex >= MaxPerRow)                          // start next row
                        {
                            itemindex   = 0;
                            verticaladd = 150;
                        }
                    }
                    pageindex++;
                }

                // Check if something was added
                if (pageindex == 1)
                {
                    AddPage(pageindex);
                    AddImage(175, 45, 7012, 2406);
                    AddHtmlLocalized(264, 45, 170, 20, 501038, false, false);                       // Claim List is empty
                }
            }
        public override void AddNameProperty(ObjectPropertyList list)
        {
            PlantHueInfo hueInfo = PlantHueInfo.GetInfo(m_PlantHue);

            list.Add(1112122, "#" + hueInfo.Name);  // ~1_COLOR~ plant clippings
        }
 public override void AddNameProperty(ObjectPropertyList list)
 {
     list.Add(1112346, "#" + PlantHueInfo.GetInfo(m_PlantHue).Name);             // ~1_COLOR~ Softened Reeds
 }
Exemple #14
0
            /// <summary>
            /// Adds the page buttons (PlantTypes).
            /// </summary>
            private void AddPages(int MaxPerRow)
            {
                int pageindex   = 1;
                int itemindex   = 0;
                int buttonindex = 1;
                int verticaladd = 0;                 // temporary

                //#01 début
                if (seedinfo != null && !unknownstorage)               //si un type en mémoire et que ce n'est pas l'unknown
                {
                    PlantTypeInfo pii = null;
                    foreach (SeedInfo si in m_Box.KnownStorage)
                    {
                        if (si.Type == seedinfo.Type)                       //on met sa page en premier dans la liste
                        {
                            pii = PlantTypeInfo.GetInfo(si.Type);
                            AddButton(37, 55, 2103, 2104, 0, GumpButtonType.Page, pageindex);                        // Type button
                            AddHtmlLocalized(50, 50, 110, 20, pii.Name, false, false);                               // Plant name
                            pageindex++;
                        }
                    }
                    if (m_Box.UnknownStorage.Count > 0)                                                    //et donc les unknown en second
                    {
                        AddButton(37, 35 + pageindex * 20, 2103, 2104, 0, GumpButtonType.Page, pageindex); // Type button
                        AddHtmlLocalized(50, 30 + pageindex * 20, 110, 20, 1060800, false, false);         // Plant name: unknown
                        pageindex++;
                    }
                }
                else                //sinon comme d'hab
                {
                    //#01 fin
                    if (m_Box.UnknownStorage.Count > 0)
                    {
                        AddButton(37, 55, 2103, 2104, 0, GumpButtonType.Page, pageindex);                   // Type button
                        AddHtmlLocalized(50, 50, 110, 20, 1060800, false, false);                           // Plant name: unknown
                        pageindex++;
                    }
                }                //#01 fini le else

                PlantTypeInfo pi = null;

                //#01 début
                if (seedinfo != null)                           //toujours si un type en memoire
                {
                    foreach (SeedInfo si in m_Box.KnownStorage) //le reste de la liste SANS celui en mémoire puisqu'il est dejà en premier
                    {
                        if (si.Type != seedinfo.Type)
                        {
                            pi = PlantTypeInfo.GetInfo(si.Type);
                            AddButton(37, 35 + pageindex * 20, 2103, 2104, 0, GumpButtonType.Page, pageindex);                       // Type button
                            AddHtmlLocalized(50, 30 + pageindex * 20, 110, 20, pi.Name, false, false);                               // Plant name
                            pageindex++;
                        }
                    }
                }
                else
                {                //#01 fin
                    foreach (SeedInfo si in m_Box.KnownStorage)
                    {
                        pi = PlantTypeInfo.GetInfo(si.Type);
                        AddButton(37, 35 + pageindex * 20, 2103, 2104, 0, GumpButtonType.Page, pageindex);                   // Type button
                        AddHtmlLocalized(50, 30 + pageindex * 20, 110, 20, pi.Name, false, false);                           // Plant name
                        pageindex++;
                    }
                }                //#01 fini le else

                pageindex = 1;   // reset

                PlantHueInfo ph = null;

                //#01 début

                if (seedinfo != null && !unknownstorage)               //si un type en memoire, sa page est la première,
                //mais si c'est l'unknown, on fait comme d'hab (elle est la premiere)
                {
                    PlantType planttype = seedinfo.Type;

                    foreach (SeedInfo si in m_Box.KnownStorage)
                    {
                        if (si.Type == planttype)
                        {
                            pi = PlantTypeInfo.GetInfo(si.Type);
                            AddPage(1);
                            AddItem(187 + pi.OffsetX, 50 + pi.OffsetY, pi.ItemID, 0);                               // Plant picture
                            AddHtmlLocalized(264, 45, 170, 20, pi.Name, false, false);                              // Type description

                            itemindex   = 0;
                            verticaladd = 0;
                            foreach (SeedHue sh in si.Hues)
                            {
                                ph = PlantHueInfo.GetInfo(sh.Hue);
                                AddButton(170 + verticaladd, 130 + itemindex * 20, 22407, 22406, buttonindex++, GumpButtonType.Reply, 0);                                   // Take button
                                AddLabel(190 + verticaladd, 130 + itemindex * 20, 0x835, sh.Amount.ToString());

                                if ((int)sh.Hue < 0x8000000)
                                {
                                    AddHtmlLocalized(220 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                                       // Hue description
                                }
                                else
                                {
                                    AddLabel(220 + verticaladd, 130 + itemindex * 20, 0, "bright");
                                    AddHtmlLocalized(260 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                                       // Hue description
                                }
                                itemindex++;
                                if (itemindex >= MaxPerRow)                                  // start next row
                                {
                                    itemindex   = 0;
                                    verticaladd = 150;
                                }
                            }
                            pageindex++;
                        }
                    }
                }
                //#01 fin

                if (m_Box.UnknownStorage.Count > 0)
                {
                    AddPage(pageindex);
                    AddItem(190, 60, 1, 0);                                    // Plant picture
                    AddHtmlLocalized(264, 45, 170, 20, 3000575, false, false); // Type description: UNKNOWN

                    // Unknown seeds are displayed in a single category
                    foreach (SeedInfo si in m_Box.UnknownStorage)
                    {
                        foreach (SeedHue sh in si.Hues)
                        {
                            ph = PlantHueInfo.GetInfo(sh.Hue);
                            AddButton(170 + verticaladd, 130 + itemindex * 20, 22407, 22406, buttonindex++, GumpButtonType.Reply, 0); // Take button
                            AddLabel(190 + verticaladd, 130 + itemindex * 20, 0x835, sh.Amount.ToString());
                            AddHtmlLocalized(220 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                // Hue description
                            itemindex++;
                            if (itemindex >= MaxPerRow)                                                                               // Start next row
                            {
                                itemindex   = 0;
                                verticaladd = 150;
                            }
                        }
                    }
                    pageindex++;
                }

                foreach (SeedInfo si in m_Box.KnownStorage)
                {
                    if (seedinfo == null || si.Type != seedinfo.Type)                   //#01
                    {
                        pi = PlantTypeInfo.GetInfo(si.Type);
                        AddPage(pageindex);
                        AddItem(187 + pi.OffsetX, 50 + pi.OffsetY, pi.ItemID, 0);                   // Plant picture
                        AddHtmlLocalized(264, 45, 170, 20, pi.Name, false, false);                  // Type description

                        itemindex   = 0;
                        verticaladd = 0;
                        foreach (SeedHue sh in si.Hues)
                        {
                            ph = PlantHueInfo.GetInfo(sh.Hue);
                            AddButton(170 + verticaladd, 130 + itemindex * 20, 22407, 22406, buttonindex++, GumpButtonType.Reply, 0);                       // Take button
                            AddLabel(190 + verticaladd, 130 + itemindex * 20, 0x835, sh.Amount.ToString());

                            if ((int)sh.Hue < 0x8000000)
                            {
                                AddHtmlLocalized(220 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                           // Hue description
                            }
                            else
                            {
                                AddLabel(220 + verticaladd, 130 + itemindex * 20, 0, "bright");
                                AddHtmlLocalized(260 + verticaladd, 130 + itemindex * 20, 100, 20, ph.Name, false, false);                           // Hue description
                            }
                            itemindex++;
                            if (itemindex >= MaxPerRow)                      // start next row
                            {
                                itemindex   = 0;
                                verticaladd = 150;
                            }
                        }
                        pageindex++;
                    }                    //#01 fin du if
                }

                // Check if something was added
                if (pageindex == 1)
                {
                    AddPage(pageindex);
                    AddImage(175, 45, 7012, 2406);
                    AddHtmlLocalized(264, 45, 170, 20, 501038, false, false);                       // Claim List is empty
                }
            }
Exemple #15
0
		public void CompleteCraft(
			int quality,
			bool makersMark,
			Mobile from,
			CraftSystem craftSystem,
			Type typeRes,
			BaseTool tool,
			CustomCraft customCraft)
		{
			int badCraft = craftSystem.CanCraft(from, tool, m_Type);

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

                AutoCraftTimer.EndTimer(from);

				return;
			}

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

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

                AutoCraftTimer.EndTimer(from);

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

                AutoCraftTimer.EndTimer(from);

				return;
			}

			bool toolBroken = false;

			int ignored = 1;
			int endquality = 1;

			bool allRequiredSkills = true;

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

				object message = null;

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

                    AutoCraftTimer.EndTimer(from);

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

                    AutoCraftTimer.EndTimer(from);

					return;
				}

				tool.UsesRemaining--;

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

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

							if (hammer.UsesRemaining < 1)
							{
								hammer.Delete();
							}
						}
						#endregion
					}
				}

				#region Mondain's Legacy
				if (tool is HammerOfHephaestus)
				{
					if (tool.UsesRemaining < 1)
					{
						tool.UsesRemaining = 0;
					}
				}
				else
				{
					if (tool.UsesRemaining < 1)
					{
						toolBroken = true;
					}

					if (toolBroken)
					{
						tool.Delete();
					}
				}
				#endregion

				int num = 0;

				Item item;
				if (customCraft != null)
				{
					item = customCraft.CompleteCraft(out num);
				}
				else if (typeof(MapItem).IsAssignableFrom(ItemType) && from.Map != Map.Trammel && from.Map != Map.Felucca)
				{
					item = new IndecipherableMap();
					from.SendLocalizedMessage(1070800); // The map you create becomes mysteriously indecipherable.
				}
				else
				{
					item = Activator.CreateInstance(ItemType) as Item;
				}

				if (item != null)
				{
					#region Mondain's Legacy
					if (item is Board)
					{
						Type resourceType = typeRes;

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

						CraftResource thisResource = CraftResources.GetFromType(resourceType);

						switch (thisResource)
						{
							case CraftResource.OakWood:
								item = new OakBoard();
								break;
							case CraftResource.AshWood:
								item = new AshBoard();
								break;
							case CraftResource.YewWood:
								item = new YewBoard();
								break;
							case CraftResource.Heartwood:
								item = new HeartwoodBoard();
								break;
							case CraftResource.Bloodwood:
								item = new BloodwoodBoard();
								break;
							case CraftResource.Frostwood:
								item = new FrostwoodBoard();
								break;
							default:
								item = new Board();
								break;
						}
					}
					#endregion

					if (item is ICraftable)
					{
						endquality = ((ICraftable)item).OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, this, resHue);
					}
					else if (item is Food)
					{
						((Food)item).PlayerConstructed = true;
					}
					else if (item.Hue == 0)
					{
						item.Hue = resHue;
					}

					if (maxAmount > 0)
					{
						if (!item.Stackable && item is IUsesRemaining)
						{
							((IUsesRemaining)item).UsesRemaining *= maxAmount;
						}
						else
						{
							item.Amount = maxAmount;
						}
					}

					#region Plant Pigments
					if (item is PlantPigment && (craftSystem is DefAlchemy || craftSystem is DefCooking))
					{
						((PlantPigment)item).PigmentHue = PlantPigmentHueInfo.HueFromPlantHue(m_PlantHue);
					}

					if (item is NaturalDye && (craftSystem is DefAlchemy || craftSystem is DefCooking))
					{
						((NaturalDye)item).PigmentHue = PlantPigmentHueInfo.GetInfo(m_PlantPigmentHue).PlantPigmentHue;
					}

					if (item is SoftenedReeds && (craftSystem is DefAlchemy || craftSystem is DefCooking))
					{
						((SoftenedReeds)item).PlantHue = PlantHueInfo.GetInfo(m_PlantHue).PlantHue;
					}

					if (item is BaseContainer && (craftSystem is DefBasketweaving))
					{
						(item).Hue = PlantHueInfo.GetInfo(m_PlantHue).Hue;
					}

                    CraftContext context = craftSystem.GetContext(from);

                    if (context.QuestOption == CraftQuestOption.QuestItem)
                    {
                        PlayerMobile px = from as PlayerMobile;

                        if (!QuestHelper.CheckItem(px, item))
                            from.SendLocalizedMessage(1072355, null, 0x23); // That item does not match any of your quest criteria	
                    }
					#endregion

					if (tool.Parent is Container) {
					Container cntnr = (Container) tool.Parent;
                                        cntnr.TryDropItem(from, item, false);
					}
					else {
					from.AddToBackpack(item);
					}

					EventSink.InvokeCraftSuccess(new CraftSuccessEventArgs(from, item, tool));

					if (from.IsStaff())
					{
						CommandLogging.WriteLine(
							from, "Crafting {0} with craft system {1}", CommandLogging.Format(item), craftSystem.GetType().Name);
					}

                    AutoCraftTimer.OnSuccessfulCraft(from);
					//from.PlaySound( 0x57 );
				}

				if (num == 0)
				{
					num = craftSystem.PlayEndingEffect(from, false, true, toolBroken, endquality, makersMark, this);
				}

				bool queryFactionImbue = false;
				int availableSilver = 0;
				FactionItemDefinition def = null;
				Faction faction = null;

				if (item is IFactionItem)
				{
					def = FactionItemDefinition.Identify(item);

					if (def != null)
					{
						faction = Faction.Find(from);

						if (faction != null)
						{
							Town town = Town.FromRegion(from.Region);

							if (town != null && town.Owner == faction)
							{
								Container pack = from.Backpack;

								if (pack != null)
								{
									availableSilver = pack.GetAmount(typeof(Silver));

									if (availableSilver >= def.SilverCost)
									{
										queryFactionImbue = Faction.IsNearType(from, def.VendorType, 12);
									}
								}
							}
						}
					}
				}

				// TODO: Scroll imbuing

				if (queryFactionImbue)
				{
					from.SendGump(new FactionImbueGump(quality, item, from, craftSystem, tool, num, availableSilver, faction, def));
				}
				else if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
				{
					from.SendGump(new CraftGump(from, craftSystem, tool, num));
				}
				else if (num > 0)
				{
					from.SendLocalizedMessage(num);
				}
			}
			else if (!allRequiredSkills)
			{
				if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
				{
					from.SendGump(new CraftGump(from, craftSystem, tool, 1044153));
				}
				else
				{
					from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
				}

                AutoCraftTimer.EndTimer(from);
			}
			else
			{
				ConsumeType consumeType = (UseAllRes ? ConsumeType.Half : ConsumeType.All);
				int resHue = 0;
				int maxAmount = 0;

				object message = null;

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

                    AutoCraftTimer.EndTimer(from);

					return;
				}

				tool.UsesRemaining--;

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

				if (toolBroken)
				{
					tool.Delete();
				}

				// SkillCheck failed.
				int num = craftSystem.PlayEndingEffect(from, true, true, toolBroken, endquality, false, this);

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