Example #1
0
        public NewHousePlacementTarget(HousePlacementEntry[] entries, HousePlacementEntry entry) : base(entry.MultiID, entry.Offset)
        {
            Range = 14;

            m_Entries = entries;
            m_Entry   = entry;
        }
Example #2
0
        private static void FillTable(HousePlacementEntry[] entries)
        {
            for (int i = 0; i < entries.Length; ++i)
            {
                HousePlacementEntry e = entries[i];

                object obj = m_Table[e.m_Type];

                if (obj == null)
                {
                    m_Table[e.m_Type] = e;
                }
                else if (obj is HousePlacementEntry)
                {
                    ArrayList list = new ArrayList();

                    list.Add(obj);
                    list.Add(e);

                    m_Table[e.m_Type] = list;
                }
                else if (obj is ArrayList)
                {
                    ArrayList list = (ArrayList)obj;

                    if (list.Count == 8)
                    {
                        Hashtable table = new Hashtable();

                        for (int j = 0; j < list.Count; ++j)
                        {
                            table[((HousePlacementEntry)list[j]).m_MultiID] = list[j];
                        }

                        table[e.m_MultiID] = e;

                        m_Table[e.m_Type] = table;
                    }
                    else
                    {
                        list.Add(e);
                    }
                }
                else if (obj is Hashtable)
                {
                    ((Hashtable)obj)[e.m_MultiID] = e;
                }
            }
        }
Example #3
0
        public static HousePlacementEntry Find(BaseHouse house)
        {
            object obj = m_Table[house.GetType()];

            if (obj is HousePlacementEntry)
            {
                return((HousePlacementEntry)obj);
            }
            else if (obj is ArrayList)
            {
                ArrayList list = (ArrayList)obj;

                for (int i = 0; i < list.Count; ++i)
                {
                    HousePlacementEntry e = (HousePlacementEntry)list[i];

                    if (e.m_MultiID == house.ItemID)
                    {
                        return(e);
                    }
                }
            }
            else if (obj is Hashtable)
            {
                Hashtable table = (Hashtable)obj;

                obj = table[house.ItemID];

                if (obj is HousePlacementEntry)
                {
                    return((HousePlacementEntry)obj);
                }
            }

            return(null);
        }
Example #4
0
        public HousePlacementListGump(Mobile from, HousePlacementEntry[] entries) : base(50, 50)
        {
            m_From    = from;
            m_Entries = entries;

            from.CloseGump(typeof(HousePlacementCategoryGump));
            from.CloseGump(typeof(HousePlacementListGump));

            AddPage(0);

            AddBackground(0, 0, 520, 420, 5054);

            AddImageTiled(10, 10, 500, 20, 2624);
            AddAlphaRegion(10, 10, 500, 20);

            AddHtmlLocalized(10, 10, 500, 20, 1060239, LabelColor, false, false); // <CENTER>HOUSE PLACEMENT TOOL</CENTER>

            AddImageTiled(10, 40, 500, 20, 2624);
            AddAlphaRegion(10, 40, 500, 20);

            AddHtmlLocalized(50, 40, 225, 20, 1060235, LabelColor, false, false); // House Description
            AddHtmlLocalized(275, 40, 75, 20, 1060236, LabelColor, false, false); // Storage
            AddHtmlLocalized(350, 40, 75, 20, 1060237, LabelColor, false, false); // Lockdowns
            AddHtmlLocalized(425, 40, 75, 20, 1060034, LabelColor, false, false); // Cost

            AddImageTiled(10, 70, 500, 280, 2624);
            AddAlphaRegion(10, 70, 500, 280);

            AddImageTiled(10, 360, 500, 20, 2624);
            AddAlphaRegion(10, 360, 500, 20);

            AddHtmlLocalized(10, 360, 250, 20, 1060645, LabelColor, false, false); // Bank Balance:
            AddLabel(250, 360, LabelHue, Banker.GetBalance(from).ToString());

            AddImageTiled(10, 390, 500, 20, 2624);
            AddAlphaRegion(10, 390, 500, 20);

            AddButton(10, 390, 4017, 4019, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(50, 390, 100, 20, 3000363, LabelColor, false, false); // Close

            for (int i = 0; i < entries.Length; ++i)
            {
                int page  = 1 + (i / 14);
                int index = i % 14;

                if (index == 0)
                {
                    if (page > 1)
                    {
                        AddButton(450, 390, 4005, 4007, 0, GumpButtonType.Page, page);
                        AddHtmlLocalized(400, 390, 100, 20, 3000406, LabelColor, false, false); // Next
                    }

                    AddPage(page);

                    if (page > 1)
                    {
                        AddButton(200, 390, 4014, 4016, 0, GumpButtonType.Page, page - 1);
                        AddHtmlLocalized(250, 390, 100, 20, 3000405, LabelColor, false, false); // Previous
                    }
                }

                HousePlacementEntry entry = entries[i];

                int y = 70 + (index * 20);

                AddButton(10, y, 4005, 4007, 1 + i, GumpButtonType.Reply, 0);
                AddHtmlLocalized(50, y, 225, 20, entry.Description, LabelColor, false, false);
                AddLabel(275, y, LabelHue, entry.Storage.ToString());
                AddLabel(350, y, LabelHue, entry.Lockdowns.ToString());
                AddLabel(425, y, LabelHue, entry.Cost.ToString());
            }
        }