public TopicGump(Mobile GM, Bible bible, int topic) : base(20, 20) { m_GM = GM; m_GM.CloseGump(typeof(TopicGump)); m_Bible = bible; m_Topic = topic; m_Book = (int)(m_Bible.Book); m_Chapter = m_Bible.Chapter; AddPage(0); AddBackground(0, 0, 696, 540, 0x13BE); string str1, str2, str; int[,] verses; int verselength, topiclength, ymax; string verse = ""; verses = TopicReader.GetTopicVerses((Topic)m_Topic); topiclength = verses.GetLength(0); if (topiclength < 17) { ymax = topiclength; } else { ymax = 16; } AddLabel(200, 7, 500, BibleReader.ToTitleCase(TopicReader.GetTopicName((Topic)m_Topic))); AddResetButton(15, 510, 400, "Home"); if (m_Topic > 0) { AddBkwdButton(345, 510, m_Topic - 1, "Prev Topic"); } if (m_Topic < 303) { AddFwdButton(645, 510, m_Topic + 1, "Next Topic"); } for (int y = 0; y < ymax; y++) { try { verse = BibleReader.GetVerse(verses[y, 0], verses[y, 1], verses[y, 2]); verselength = verse.Length < 68 ? verse.Length - 8 : 60; str1 = BibleReader.Books[verses[y, 0]] + " " + verses[y, 1].ToString() + " : "; str2 = verse.Substring(7, verselength) + "..."; str = str1 + str2; AddButton(15, 29 + (y * 24), 5541, 5542, y + 500 + (m_Topic * 1000), GumpButtonType.Reply, 0); AddHtml(50, 30 + (y * 24), 635, 20, Color(str, 0x480), false, false); } catch { break; } } }
public BibleGump(Mobile GM, Bible bible) : base(20, 20) { m_GM = GM; m_GM.CloseGump(typeof(BibleGump)); m_Bible = bible; m_Book = (int)(m_Bible.Book); m_Chapter = m_Bible.Chapter; m_Topic = (int)(m_Bible.BibleTopic); int chapnum = BibleReader.GetNumChapters(m_Book); if (m_Chapter > chapnum) { m_Chapter = chapnum; } int versnum = BibleReader.GetNumVerses(m_Book, m_Chapter); m_FirstVerse = m_Bible.FirstVerse; if (m_FirstVerse > versnum) { m_FirstVerse = versnum; } m_LastVerse = m_Bible.LastVerse; if (m_LastVerse < m_FirstVerse) { m_LastVerse = m_FirstVerse; } if (m_LastVerse > versnum) { m_LastVerse = versnum; } string maxchap = chapnum.ToString(); string max = versnum.ToString(); AddPage(0); AddBackground(0, 0, 696, 540, 0x13BE); AddPage(1); AddAlphaRegion(190, 30, 486, 476); string passName = BibleReader.Books[m_Book] + " " + m_Chapter.ToString() + " : " + m_FirstVerse.ToString(); if (m_FirstVerse < m_LastVerse) { passName += " - " + m_LastVerse.ToString(); } AddLabel(200, 7, 500, passName); string passage = ""; for (int x = m_FirstVerse; x <= m_LastVerse; x++) { passage += BibleReader.GetVerse(m_Book, m_Chapter, x); } AddHtml(200, 40, 466, 456, passage, true, true); AddOKButton(200, 510, 0, "Accept Changes"); AddLabel(15, 30, 0x459, "Book of"); AddImageTiled(15, 50, 160, 20, 0xA40); AddTextEntry(15, 50, 160, 20, 0x769, 0, BibleReader.Books[m_Book]); AddLabel(15, 110, 0x459, "Chapter (Max - " + maxchap + ")"); AddImageTiled(15, 130, 60, 20, 0xA40); AddTextEntry(15, 130, 60, 20, 0x769, 1, m_Chapter.ToString()); AddLabel(15, 190, 0x459, "First Verse (Max - " + max + ")"); AddImageTiled(15, 210, 60, 20, 0xA40); AddTextEntry(15, 210, 60, 20, 0x769, 2, m_FirstVerse.ToString()); AddLabel(15, 270, 0x459, "Last Verse (Max - " + max + ")"); AddImageTiled(15, 290, 60, 20, 0xA40); AddTextEntry(15, 290, 60, 20, 0x769, 3, m_LastVerse.ToString()); AddResetButton(15, 350, 1, "Reset Passage"); AddPageBkwdButton(15, 380, 2, "Index"); AddPageBkwdButton(15, 410, 3, "Concordance"); AddPage(2); int entry = 1; int ymax; AddPageBkwdButton(15, 510, 1, "Back"); for (int x = 0; x < 4; x++) { if (x < 3) { ymax = 17; } else { ymax = 15; } for (int y = 0; y < ymax; y++) { AddResetButton(15 + (x * 171), 20 + (y * 25), entry + 1, BibleReader.Books[entry++]); } } int zlimit = 15; entry = 0; for (int x = 0; x < 7; x++) { AddPage(3 + x); AddPageBkwdButton(15, 510, 1, "Back"); if (x > 0) { AddPageBkwdButton(345, 510, 2 + x, "Prev Topics"); } if (x < 6) { AddPageFwdButton(645, 510, 4 + x, "Next Topics"); } if (x == 6) { zlimit = 11; } for (int y = 0; y < 3; y++) { for (int z = 0; z < zlimit; z++) { AddResetButton(15 + (y * 225), 20 + (z * 25), entry + 100, BibleReader.ToTitleCase(TopicReader.GetTopicName((Topic)entry++))); } } } }