protected void Target(Mobile from, object targeted) { if (!IsChildOf(from.Backpack)) { // You must have the object in your backpack to use it. from.SendLocalizedMessage(1042010); } else if (!(targeted is PlantPigment)) { // You may only mix this with another non-saturated plant pigment. from.SendLocalizedMessage(1112124); } else { PlantPigment pigment = targeted as PlantPigment; if (!pigment.IsChildOf(from.Backpack)) { // The item must be in your backpack to use it. from.SendLocalizedMessage(1060640); } else { PlantPigment mixed = Mix(from, m_PlantHue, pigment.PlantHue); if (mixed != null) { Consume(); pigment.Consume(); from.AddToBackpack(mixed); } } } }
protected override void OnTarget(Mobile from, object targeted) { if (!(targeted is PlantClippings) || !((PlantClippings)targeted).IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1046439); // That is not a valid target. from.SendLocalizedMessage(1074794); // Target the material to use: from.Target = new ClippingsTarget(m_CraftSystem, m_TypeRes, m_Tool, m_CraftItem); } else { from.EndAction(typeof(CraftSystem)); PlantClippings clippings = targeted as PlantClippings; if (from.Backpack == null || from.Backpack.GetAmount(typeof(Bottle)) < 1) { // You don't have any empty bottles. from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, 1044558)); } else { PlantPigment.DoCraft(from, m_CraftSystem, m_TypeRes, m_Tool, m_CraftItem, clippings); } } }
protected override void OnTarget(Mobile from, object targeted) { if (!(targeted is PlantPigment) || !((PlantPigment)targeted).IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1046439); // That is not a valid target. from.SendLocalizedMessage(1074794); // Target the material to use: from.Target = new PigmentsTarget(m_CraftSystem, m_TypeRes, m_Tool, m_CraftItem); } else { from.EndAction(typeof(CraftSystem)); PlantPigment pigment = targeted as PlantPigment; if (from.Backpack == null || from.Backpack.GetAmount(typeof(ColorFixative)) < 1) { // You don't have the components needed to make that. from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, 1044253)); } else { NaturalDye.DoCraft(from, m_CraftSystem, m_TypeRes, m_Tool, m_CraftItem, pigment); } } }
public override void OnAfterDuped(Item newItem) { PlantPigment newPigment = newItem as PlantPigment; if (newPigment != null) { newPigment.PlantHue = PlantHue; } }
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 InternalTarget(PlantPigment item) : base(2, false, TargetFlags.None) { m_Item = item; }
public InternalTarget(PlantPigment item) : base(2, false, TargetFlags.None) { this.m_Item = item; }
public static void DoCraft( Mobile from, CraftSystem system, Type typeRes, BaseTool tool, CraftItem craftItem, PlantPigment pigments ) { CraftContext context = system.GetContext( from ); if ( context != null ) context.OnMade( craftItem ); bool allRequiredSkills = true; double chance = craftItem.GetSuccessChance( from, typeRes, system, true, ref allRequiredSkills ); if ( chance > 0.0 ) chance += craftItem.GetTalismanBonus( from, system ); if ( allRequiredSkills ) { pigments.Consume(); if ( chance < Utility.RandomDouble() ) { from.SendGump( new CraftGump( from, system, tool, 1044043 ) ); // You failed to create the item, and some of your materials are lost. } else { from.Backpack.ConsumeTotal( typeof( ColorFixative ), 1 ); bool toolBroken = false; tool.UsesRemaining--; if ( tool.UsesRemaining < 1 ) toolBroken = true; if ( toolBroken ) { tool.Delete(); from.SendLocalizedMessage( 1044038 ); // You have worn out your tool! from.SendLocalizedMessage( 1044154 ); // You create the item. } else { // You create the item. from.SendGump( new CraftGump( from, system, tool, 1044154 ) ); } from.AddToBackpack( new NaturalDye( pigments.PlantHue ) ); } } else { // You don't have the required skills to attempt this item. from.SendGump( new CraftGump( from, system, tool, 1044153 ) ); } }
public static void DoCraft(Mobile from, CraftSystem system, Type typeRes, BaseTool tool, CraftItem craftItem, PlantPigment pigments) { CraftContext context = system.GetContext(from); if (context != null) { context.OnMade(craftItem); } bool allRequiredSkills = true; double chance = craftItem.GetSuccessChance(from, typeRes, system, true, ref allRequiredSkills); if (chance > 0.0) { chance += craftItem.GetTalismanBonus(from, system); } if (allRequiredSkills) { pigments.Consume(); if (chance < Utility.RandomDouble()) { from.SendGump(new CraftGump(from, system, tool, 1044043)); // You failed to create the item, and some of your materials are lost. } else { from.Backpack.ConsumeTotal(typeof(ColorFixative), 1); bool toolBroken = false; tool.UsesRemaining--; if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); from.SendLocalizedMessage(1044038); // You have worn out your tool! from.SendLocalizedMessage(1044154); // You create the item. } else { // You create the item. from.SendGump(new CraftGump(from, system, tool, 1044154)); } from.AddToBackpack(new NaturalDye(pigments.PlantHue)); } } else { // You don't have the required skills to attempt this item. from.SendGump(new CraftGump(from, system, tool, 1044153)); } }