Esempio n. 1
0
 public static void AddContext(Mobile from, DistillationContext context)
 {
     if (from != null)
     {
         m_Contexts[from] = context;
     }
 }
Esempio n. 2
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));
 }
Esempio n. 3
0
		public static DistillationContext GetContext(Mobile from)
		{
			if(from == null)
				return null;
				
			if(!m_Contexts.ContainsKey(from))
				m_Contexts[from] = new DistillationContext();
				
			return m_Contexts[from];
		}
Esempio n. 4
0
        public static DistillationContext GetContext(Mobile from)
        {
            if (from == null)
            {
                return(null);
            }

            if (!m_Contexts.ContainsKey(from))
            {
                m_Contexts[from] = new DistillationContext();
            }

            return(m_Contexts[from]);
        }
Esempio n. 5
0
        public static void OnLoad()
        {
            Persistence.Deserialize(
                FilePath,
                reader =>
            {
                int version = reader.ReadInt();

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Mobile m = reader.ReadMobile();
                    DistillationContext context = new DistillationContext(reader);

                    if (m != null)
                    {
                        DistillationSystem.Contexts[m] = context;
                    }
                }
            });
        }
Esempio n. 6
0
 public YeastSelectionTarget(DistillationContext context, int index)
     : base(-1, false, TargetFlags.None)
 {
     m_Index   = index;
     m_Context = context;
 }
Esempio n. 7
0
 public LabelPrompt(DistillationContext context)
 {
     m_Context = context;
 }
Esempio 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
        }
Esempio n. 9
0
 public YeastSelectionTarget(DistillationContext context, int index)
     : base(-1, false, TargetFlags.None)
 {
     m_Index = index;
     m_Context = context;
 }
Esempio n. 10
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));
 }
Esempio n. 11
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
        }
Esempio n. 12
0
 public LabelPrompt(DistillationContext context)
 {
     m_Context = context;
 }
Esempio n. 13
0
        public static void OnLoad()
        {
            Persistence.Deserialize(
                FilePath,
                reader =>
                {
                    int version = reader.ReadInt();

                    int count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        Mobile m = reader.ReadMobile();
                        DistillationContext context = new DistillationContext(reader);

                        if (m != null)
                            DistillationSystem.Contexts[m] = context;
                    }
                });
        }
Esempio n. 14
0
		public static void AddContext(Mobile from, DistillationContext context)
		{
			if(from != null)
				m_Contexts[from] = context;
		}