public override void AddNameProperty(ObjectPropertyList list) { PlantPigmentHueInfo hueInfo = PlantPigmentHueInfo.GetInfo(this.m_Hue); if (this.Amount > 1) { list.Add(PlantPigmentHueInfo.IsBright(m_Hue) ? 1113277 : 1113276, "{0}\t{1}", this.Amount, "#" + hueInfo.Name); // ~1_COLOR~ Softened Reeds } else { list.Add(hueInfo.IsBright() ? 1112138 : 1112137, "#" + hueInfo.Name); // ~1_COLOR~ natural dye } }
public override void OnDoubleClick(Mobile from) { if (!PlantPigmentHueInfo.IsMixable(PigmentHue)) { from.SendLocalizedMessage(1112125); // This pigment is saturated and cannot be mixed further. } else { from.SendLocalizedMessage(1112123); // Which plant pigment do you wish to mix this with? from.Target = new InternalTarget(this); } }
}// plant pigment public override void AddNameProperty(ObjectPropertyList list) { PlantPigmentHueInfo hueInfo = PlantPigmentHueInfo.GetInfo(this.m_Hue); if (this.Amount > 1) { list.Add(1113273, "{0}\t{1}", this.Amount, "#" + hueInfo.Name); // ~1_COLOR~ dry reeds } else { list.Add(1112133, "#" + hueInfo.Name); // ~1_COLOR~ plant pigment } }
public override int LabelNumber => 1112132;// plant pigment public override void AddNameProperty(ObjectPropertyList list) { PlantPigmentHueInfo info = PlantPigmentHueInfo.GetInfo(m_Hue); int cliloc; if (Amount > 1) { cliloc = info.IsBright() ? 1113271 : 1113270; list.Add(cliloc, String.Format("{0}\t#{1}", Amount.ToString(), info.Name)); } else { cliloc = info.IsBright() ? 1112134 : 1112133; list.Add(cliloc, String.Format("#{0}", info.Name)); } }
protected override void OnTarget(Mobile from, object targeted) { if (this.m_Item.Deleted) { return; } Item item = targeted as Item; if (null != item) { bool valid = (item is IDyable || item is BaseBook || item is BaseClothing || item is BaseJewel || item is BaseStatuette || item is BaseWeapon || item is Runebook || item is Spellbook || item.IsArtifact || BasePigmentsOfTokuno.IsValidItem(item)); if (!valid && item is BaseArmor) { CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource); if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) && ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType) { valid = true; } } if (!valid && FurnitureAttribute.Check(item)) { if (!from.InRange(this.m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. return; } else { BaseHouse house = BaseHouse.FindHouseAt(item); if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item))) { from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it. return; } else if (!house.IsCoOwner(from)) { from.SendLocalizedMessage(501023); // You must be the owner to use this item. return; } else { valid = true; } } } // need to add any bags, chests, boxes, crates not IDyable but dyable by natural dyes if (valid) { item.Hue = PlantPigmentHueInfo.GetInfo(this.m_Item.PigmentHue).Hue; from.PlaySound(0x23E); if (--this.m_Item.UsesRemaining > 0) { this.m_Item.InvalidateProperties(); } else { this.m_Item.Delete(); } return; } } from.SendLocalizedMessage(1042083); // You cannot dye that. }
public PlantPigment(PlantHue hue) : base(0x0F02) { Weight = 1.0; PigmentHue = PlantPigmentHueInfo.HueFromPlantHue(hue); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Item.Deleted) { return; } PlantPigment pigment = targeted as PlantPigment; if (null == pigment) { from.SendLocalizedMessage(1112124); // You may only mix this with another non-saturated plant pigment. return; } if (from.Skills[SkillName.Alchemy].Base < 75.0 && from.Skills[SkillName.Cooking].Base < 75.0) { from.SendLocalizedMessage(1112214); // You lack the alchemy or cooking skills to mix plant pigments. } else if ((PlantPigmentHue.White == pigment.PigmentHue || PlantPigmentHue.Black == pigment.PigmentHue || PlantPigmentHue.White == m_Item.PigmentHue || PlantPigmentHue.Black == m_Item.PigmentHue) && from.Skills[SkillName.Alchemy].Base < 100.0 && from.Skills[SkillName.Cooking].Base < 100.0) { from.SendLocalizedMessage(1112213); // You lack the alchemy or cooking skills to mix so unstable a pigment. } else if (m_Item.PigmentHue == pigment.PigmentHue) { from.SendLocalizedMessage(1112242); // You decide not to waste pigments by mixing two identical colors. } else if ((m_Item.PigmentHue & ~(PlantPigmentHue.Bright | PlantPigmentHue.Dark | PlantPigmentHue.Ice)) == (pigment.PigmentHue & ~(PlantPigmentHue.Bright | PlantPigmentHue.Dark | PlantPigmentHue.Ice))) { from.SendLocalizedMessage(1112243); // You decide not to waste pigments by mixing variations of the same hue. } else if ((PlantPigmentHue.White == m_Item.PigmentHue && PlantPigmentHueInfo.IsBright(pigment.PigmentHue)) || (PlantPigmentHue.White == pigment.PigmentHue && PlantPigmentHueInfo.IsBright(m_Item.PigmentHue))) { from.SendLocalizedMessage(1112241); // This pigment is too diluted to be faded further. } else if (!PlantPigmentHueInfo.IsMixable(pigment.PigmentHue)) { from.SendLocalizedMessage(1112125); // This pigment is saturated and cannot be mixed further. } else { PlantPigmentHue newHue = PlantPigmentHueInfo.Mix(m_Item.PigmentHue, pigment.PigmentHue); if (PlantPigmentHue.None == newHue) { from.SendLocalizedMessage(1112125); // This pigment is saturated and cannot be mixed further. } else { pigment.PigmentHue = newHue; Bottle bottle = new Bottle(); bottle.MoveToWorld(m_Item.Location, m_Item.Map); m_Item.Delete(); from.PlaySound(0x240); } } }
public override void AddNameProperty(ObjectPropertyList list) { PlantPigmentHueInfo hueInfo = PlantPigmentHueInfo.GetInfo(m_Hue); list.Add(1112133, "#" + hueInfo.Name); // ~1_COLOR~ plant clippings }
public override void AddNameProperty(ObjectPropertyList list) { PlantPigmentHueInfo hueInfo = PlantPigmentHueInfo.GetInfo(m_Hue); list.Add(1112137, "#" + hueInfo.Name); // ~1_COLOR~ natural dye }
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); } } }