public override void AddNameProperty(ObjectPropertyList list) { if (m_Label != null && m_Label.Length > 0) { list.Add(1049519, m_Label); // a bottle of ~1_DRINK_NAME~ } else { list.Add(1049519, String.Format("#{0}", DistillationSystem.GetLabel(m_Liquor, m_IsStrong))); // a bottle of ~1_DRINK_NAME~ } }
public override void AddNameProperty(ObjectPropertyList list) { if (!string.IsNullOrEmpty(m_Label)) { list.Add(1049519, m_Label); // a bottle of ~1_DRINK_NAME~ } else { list.Add(1049519, string.Format("#{0}", DistillationSystem.GetLabel(m_Liquor, m_IsStrong))); // a bottle of ~1_DRINK_NAME~ } }
public override void GetProperties(ObjectPropertyList list) { base.GetProperties(list); if (m_Liquor != Liquor.None) { list.Add(1150454, String.Format("#{0}", DistillationSystem.GetLabel(m_Liquor, m_IsStrong))); // Liquor Type: ~1_TYPE~ } if (m_Distiller != null) { list.Add(1150679, m_Distiller.Name); // Distiller: ~1_NAME~ } list.Add(GetQuantityDescription()); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is LiquorBarrel) { LiquorBarrel barrel = targeted as LiquorBarrel; if (barrel.IsChildOf(from.Backpack)) { if (barrel.IsMature) { from.SendLocalizedMessage(1150811); // This liquor barrel already contains liquor. } else if (!barrel.IsEmpty) { from.SendLocalizedMessage(1150802); // You realize that the liquor is on the process of maturation so you leave it alone. } else { double perc = m_Context.MakeStrong ? 2 : 1; if (HasTotal(from, perc) && barrel != null) { double cooking = from.Skills[SkillName.Cooking].Value; double alchemy = from.Skills[SkillName.Alchemy].Value / 2; int resist = 0; for (int i = 0; i < m_Context.SelectedYeast.Length; i++) { Yeast yeast = m_Context.SelectedYeast[i]; if (yeast != null) { resist += yeast.BacterialResistance; } } int chance = (int)((cooking + alchemy + (resist * 12)) / 2.5); if (chance > Utility.Random(100)) { ConsumeTotal(from, perc); m_Context.ClearYeasts(); from.SendLocalizedMessage(1150772); // You succeed at your distillation attempt. Mobile marker = m_Context.Mark ? from : null; from.PlaySound(0x2D6); barrel.BeginDistillation(m_Def.Liquor, m_Def.MaturationDuration, m_Context.Label, m_Context.MakeStrong, marker); } else { from.PlaySound(0x2D6); ConsumeTotal(from, perc / 2); from.SendLocalizedMessage(1150745); // You have failed your distillation attempt and ingredients have been lost. } } else { from.SendLocalizedMessage(1150747); // You don't have enough ingredients. } } } else { from.SendLocalizedMessage(1054107); // This item must be in your backpack. } } else { from.SendMessage("That is not a liquor barrel."); } DistillationSystem.SendDelayedGump(from); }
public DistillationGump(Mobile from) : base(35, 35) { from.CloseGump(typeof(DistillationGump)); m_Context = DistillationSystem.GetContext(from); Group group = m_Context.LastGroup; Liquor liquor = m_Context.LastLiquor; if (liquor == Liquor.None) { liquor = DistillationSystem.GetFirstLiquor(group); } m_Def = DistillationSystem.GetDefinition(liquor, group); if (m_Def == null) { return; } if (m_Def.Liquor != liquor) { liquor = m_Def.Liquor; } AddBackground(0, 0, 500, 500, 5054); AddImageTiled(10, 10, 480, 30, 2624); AddImageTiled(10, 50, 230, 120, 2624); AddImageTiled(10, 180, 230, 200, 2624); AddImageTiled(250, 50, 240, 200, 2624); AddImageTiled(250, 260, 240, 120, 2624); AddImageTiled(10, 390, 480, 60, 2624); AddImageTiled(10, 460, 480, 30, 2624); AddAlphaRegion(10, 10, 480, 480); AddHtmlLocalized(10, 16, 510, 20, 1150682, LabelColor, false, false); // <center>DISTILLERY MENU</center> AddHtmlLocalized(10, 55, 230, 20, 1150683, LabelColor, false, false); // <center>Select the group</center> AddButton(15, 80, 4005, 4007, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(55, 80, 200, 20, DistillationSystem.GetLabel(Group.WheatBased), LabelColor, false, false); // WHEAT BASED AddButton(15, 106, 4005, 4007, 2, GumpButtonType.Reply, 0); AddHtmlLocalized(55, 106, 200, 20, DistillationSystem.GetLabel(Group.WaterBased), LabelColor, false, false); // WATER BASED AddButton(15, 132, 4005, 4007, 3, GumpButtonType.Reply, 0); AddHtmlLocalized(55, 132, 200, 20, DistillationSystem.GetLabel(Group.Other), LabelColor, false, false); // OTHER AddHtmlLocalized(10, 184, 230, 20, 1150684, LabelColor, false, false); // <center>Select the liquor type</center> int y = 210; for (int i = 0; i < DistillationSystem.CraftDefs.Count; i++) { CraftDefinition def = DistillationSystem.CraftDefs[i]; if (def.Group == group) { AddButton(15, y, 4005, 4007, 1000 + i, GumpButtonType.Reply, 0); AddHtmlLocalized(55, y, 200, 20, DistillationSystem.GetLabel(def.Liquor, false), LabelColor, false, false); y += 26; } } AddHtmlLocalized(250, 54, 240, 20, 1150735, String.Format("#{0}", DistillationSystem.GetLabel(liquor, false)), LabelColor, false, false); // <center>Ingredients of ~1_NAME~</center> y = 80; for (int i = 0; i < m_Def.Ingredients.Length; i++) { Type type = m_Def.Ingredients[i]; int amt = m_Def.Amounts[i]; bool strong = m_Context.MakeStrong; if (i == 0 && type == typeof(Yeast)) { for (int j = 0; j < amt; j++) { Yeast yeast = m_Context.SelectedYeast[j]; AddHtmlLocalized(295, y, 200, 20, yeast == null ? 1150778 : 1150779, "#1150453", LabelColor, false, false); // Yeast: ~1_VAL~ AddButton(255, y, 4005, 4007, 2000 + j, GumpButtonType.Reply, 0); y += 26; } continue; } else { int total = strong ? amt * 2 : amt; int amount = DistillationTarget.GetAmount(from, type, liquor); if (amount > total) { amount = total; } AddHtmlLocalized(295, y, 200, 20, 1150733, String.Format("#{0}\t{1}", m_Def.Labels[i], String.Format("{0}/{1}", amount.ToString(), total.ToString())), LabelColor, false, false); // ~1_NAME~ : ~2_NUMBER~ } y += 26; } AddHtmlLocalized(250, 264, 240, 20, 1150770, LabelColor, false, false); // <center>Distillery Options</center> AddButton(255, 290, 4005, 4007, 4, GumpButtonType.Reply, 0); AddHtmlLocalized(295, 290, 200, 20, m_Context.MakeStrong ? 1150730 : 1150729, LabelColor, false, false); // Double Distillation - Standard Distillation AddButton(255, 316, 4005, 4007, 5, GumpButtonType.Reply, 0); AddHtmlLocalized(295, 320, 200, 20, m_Context.Mark ? 1150731 : 1150732, LabelColor, false, false); // Mark Distiller Name - Do Not Mark AddButton(15, 395, 4005, 4007, 6, GumpButtonType.Reply, 0); AddHtmlLocalized(55, 395, 200, 20, 1150733, String.Format("Label\t{0}", m_Context.Label == null ? "None" : m_Context.Label), LabelColor, false, false); // ~1_NAME~ : ~2_NUMBER~ AddButton(15, 465, 4005, 4007, 7, GumpButtonType.Reply, 0); AddHtmlLocalized(55, 465, 200, 20, 1150771, LabelColor, false, false); // Execute Distillation AddButton(455, 465, 4017, 4019, 0, GumpButtonType.Reply, 0); AddHtmlLocalized(400, 465, 100, 20, 1060675, LabelColor, false, false); // CLOSE }