Exemplo n.º 1
0
 public DistillationTarget(Mobile from, DistillationContext context, CraftDefinition def)
     : base(-1, false, TargetFlags.None)
 {
     m_Context = context;
     m_Def     = def;
     BeginTimeout(from, TimeSpan.FromSeconds(30));
 }
Exemplo n.º 2
0
        public static CraftDefinition GetDefinition(Liquor liquor, Group group)
        {
            for (var index = 0; index < m_CraftDefs.Count; index++)
            {
                CraftDefinition def = m_CraftDefs[index];

                if (def.Liquor == liquor && def.Group == group)
                {
                    return(def);
                }
            }

            return(GetFirstDefForGroup(group));
        }
Exemplo n.º 3
0
        public static CraftDefinition GetFirstDefForGroup(Group group)
        {
            for (var index = 0; index < m_CraftDefs.Count; index++)
            {
                CraftDefinition def = m_CraftDefs[index];

                if (def.Group == group)
                {
                    return(def);
                }
            }

            return(null);
        }
Exemplo n.º 4
0
        public static Liquor GetFirstLiquor(Group group)
        {
            for (var index = 0; index < m_CraftDefs.Count; index++)
            {
                CraftDefinition def = m_CraftDefs[index];

                if (def.Group == group)
                {
                    return(def.Liquor);
                }
            }

            return(Liquor.Whiskey);
        }
Exemplo n.º 5
0
        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
        }
Exemplo n.º 6
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            case 0: return;

            case 1:     // Select Wheat Based
                m_Context.LastGroup = Group.WheatBased;
                break;

            case 2:     // Select Water Based
                m_Context.LastGroup = Group.WaterBased;
                break;

            case 3:     // Select Other
                m_Context.LastGroup = Group.Other;
                break;

            case 4:     // Distillation Strength
                if (m_Context.MakeStrong)
                {
                    m_Context.MakeStrong = false;
                }
                else
                {
                    m_Context.MakeStrong = true;
                }
                break;

            case 5:     // Mark Option
                if (m_Context.Mark)
                {
                    m_Context.Mark = false;
                }
                else
                {
                    m_Context.Mark = true;
                }
                break;

            case 6:                                 // Label
                from.Prompt = new LabelPrompt(m_Context);
                from.SendLocalizedMessage(1150734); // Please enter the text with which you wish to label the liquor that you will distill. You many enter up to 15 characters. Leave the text area blank to remove any existing text.
                return;

            case 7:                                 // Execute Distillation
                from.Target = new DistillationTarget(from, m_Context, m_Def);
                from.SendLocalizedMessage(1150810); // Target an empty liquor barrel in your backpack. If you don't have one already, you can use the Carpentry skill to make one.
                return;

            default:
            {
                if (info.ButtonID < 2000)         // Select Liquor Type
                {
                    int sel = info.ButtonID - 1000;
                    if (sel >= 0 && sel < DistillationSystem.CraftDefs.Count)
                    {
                        CraftDefinition def = DistillationSystem.CraftDefs[sel];
                        m_Context.LastLiquor = def.Liquor;
                    }
                }
                else                                          // Select Yeast
                {
                    int sel = info.ButtonID - 2000;

                    if (m_Def.Ingredients[0] == typeof(Yeast) && m_Def.Amounts.Length > 0)
                    {
                        int amt = m_Def.Amounts[0];

                        if (sel >= 0 && sel < amt)
                        {
                            from.Target = new YeastSelectionTarget(m_Context, sel);
                            from.SendLocalizedMessage(1150437);         // Target the yeast in your backpack that you wish to toggle distillation item status on.  Hit <ESC> to cancel.
                            return;
                        }
                    }
                }
            }
            break;
            }

            from.SendGump(new DistillationGump(from));
        }
Exemplo n.º 7
0
 public DistillationTarget(Mobile from, DistillationContext context, CraftDefinition def)
     : base(-1, false, TargetFlags.None)
 {
     m_Context = context;
     m_Def = def;
     BeginTimeout(from, TimeSpan.FromSeconds(30));
 }
Exemplo n.º 8
0
        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
        }