Exemplo n.º 1
0
        public static void RegisterEntry(string categoryName, int itemID, string name, int price)
        {
            YardGumpCategory category = GetRegisteredCategory(categoryName);

            if (category == null)
            {
                return;
            }

            YardGumpEntry entry = new YardGumpEntry(itemID, name, price);

            category.AddEntry(entry);
        }
Exemplo n.º 2
0
        public void AddEntry(YardGumpEntry entry)
        {
            if (Pages.Count == 0)
            {
                Pages.Add(new Dictionary <int, YardGumpEntry>());
                Pages[0].Add(entry.ItemID, entry);
            }
            else
            {
                if (Pages[Pages.Count - 1].Count >= 24)
                {
                    Pages.Add(new Dictionary <int, YardGumpEntry>());
                }

                Pages[Pages.Count - 1].Add(entry.ItemID, entry);
            }
        }
Exemplo n.º 3
0
        public void AddEntry(YardGumpEntry entry)
        {
            if (Pages.Count == 0)
            {
                Pages.Add(new Dictionary<int, YardGumpEntry>());
                Pages[0].Add(entry.ItemID, entry);
            }
            else
            {
                if (Pages[Pages.Count - 1].Count >= 24)
                {
                    Pages.Add(new Dictionary<int, YardGumpEntry>());
                }

                Pages[Pages.Count - 1].Add(entry.ItemID, entry);
            }
        }
Exemplo n.º 4
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (info.ButtonID == 0)
            {
                return;
            }
            else if (info.ButtonID == (int)Buttons.Settings)
            {
                from.SendGump(new YGSettingsGump(m_Shovel, from));
            }
            else if (info.ButtonID == (int)Buttons.Next)
            {
                if (m_CurrentCategory != null && YardRegistry.Categories[m_CurrentCategory.Name].Pages.Count > m_CurrentPage + 1)
                {
                    from.SendGump(new YardGump(from, m_Shovel, m_CurrentCategory.Name, m_CurrentPage + 1, m_SelectedID, m_ItemPrice));
                }
                else
                {
                    from.SendGump(new YardGump(from, m_Shovel, "", 0, m_SelectedID, m_ItemPrice));
                }
            }
            else if (info.ButtonID == (int)Buttons.Prev)
            {
                if (m_CurrentCategory != null && m_CurrentPage > 0)
                {
                    from.SendGump(new YardGump(from, m_Shovel, m_CurrentCategory.Name, m_CurrentPage - 1, m_SelectedID, m_ItemPrice));
                }
                else
                {
                    from.SendGump(new YardGump(from, m_Shovel, "", 0, m_SelectedID, m_ItemPrice));
                }
            }
            else if (info.ButtonID == (int)Buttons.Place)
            {
                if (m_SelectedID > 0)
                {
                    from.SendMessage("Please choose where to place the item");
                    from.Target = new YardTarget(m_Shovel, from, m_SelectedID, m_ItemPrice, m_CurrentCategory.Name, m_CurrentPage);
                }
            }
            else if (info.ButtonID >= 8851 && info.ButtonID <= 8859)
            {
                //Change categories
                if (m_Categories != null && m_Categories.Length > info.ButtonID - 8851)
                {
                    if (m_CurrentCategory != null)
                    {
                        from.SendGump(new YardGump(from, m_Shovel,
                                                   m_Categories[info.ButtonID - 8851] == m_CurrentCategory.Name ? "" : m_Categories[info.ButtonID - 8851],
                                                   0, m_SelectedID, m_ItemPrice));
                    }
                    else
                    {
                        from.SendGump(new YardGump(from, m_Shovel, m_Categories[info.ButtonID - 8851], 0, m_SelectedID, m_ItemPrice));
                    }
                }
                else
                {
                    from.SendGump(new YardGump(from, m_Shovel, "", 0, m_SelectedID, m_ItemPrice));
                }
            }
            else
            {
                m_SelectedID = info.ButtonID;
                if (m_CurrentCategory != null)
                {
                    YardGumpEntry entry = m_CurrentCategory.GetEntry(m_SelectedID);
                    if (entry != null)
                    {
                        m_ItemPrice = entry.Price;
                    }

                    from.SendGump(new YardGump(from, m_Shovel, m_CurrentCategory.Name, m_CurrentPage, m_SelectedID, m_ItemPrice));
                }
            }
        }
Exemplo n.º 5
0
        public static void RegisterEntry(string categoryName, int itemID, string name, int price)
        {
            YardGumpCategory category = GetRegisteredCategory(categoryName);
            if (category == null)
            {
                return;
            }

            YardGumpEntry entry = new YardGumpEntry(itemID, name, price);

            category.AddEntry(entry);
        }