Esempio n. 1
0
		public MoongateLibraryGump(Mobile mobile, MoongateLibrary rgate, DateTime LastChanged, ArrayList RuneBooks, int page, int selected)
			: base(100, 100)
		{
			m_Mobile = mobile;
			m_MoongateLibrary = rgate;
			m_LastChanged = LastChanged;
			m_RuneBooks = RuneBooks;
			m_page = page;
			m_selected = selected;
			myGate = m_MoongateLibrary.Owner(m_Mobile);
			AddPage(0);

			if (myGate)
				AddBackground(0, 0, 435, 465, 5054);
			else
				AddBackground(0, 0, 435, 440, 5054);
			AddHtmlLocalized(5, 5, 210, 20, 1012011, false, false); // Pick your destination:
			AddHtml(280, 5, 210, 20, "<basefont size=2 color=#0000ff>CEO Moongate Library<basefont>", false, false);
			if (m_MoongateLibrary.Cost != 0)
			{
				if (myGate)
					AddHtml(120, 20, 210, 20, String.Format("<basefont size=4 color=#FFCC33>Cost: {0}gp<basefont>", m_MoongateLibrary.Cost), false, false);
				else
					AddHtml(165, 5, 210, 20, String.Format("<basefont size=4 color=#FFCC33>Cost: {0}gp<basefont>", m_MoongateLibrary.Cost), false, false);

			}
			if (myGate)
			{
				AddButton(110, 385, 4005, 4007, 2, GumpButtonType.Reply, 0);
				AddLabel(145, 385, 0, "ADD"); // Add Runebook
				AddButton(10, 435, 4005, 4007, 6, GumpButtonType.Reply, 0);
				AddLabel(45, 435, 0, "REDEED"); // Deed Moongate (saves all entries)
				AddButton(110, 410, 4005, 4007, 5, GumpButtonType.Reply, 0);
				AddLabel(145, 410, 0, "REMALL"); // Add Runebook
				AddButton(110, 435, 4005, 4007, 7, GumpButtonType.Reply, 0);
				AddLabel(145, 435, 0, "HELP"); // Add Runebook
				if (m_MoongateLibrary.Active)
					AddButton(212, 10, 0x2c88, 0x2c94, 3, GumpButtonType.Reply, 0);
				else
					AddButton(212, 10, 0x2c94, 0x2c88, 4, GumpButtonType.Reply, 0);
				AddHtml(410, 20, 210, 20, string.Format("<basefont size=2 color=#0000ff>({0})<basefont>", m_RuneBooks.Count), false, false);
			}

			if (m_RuneBooks.Count == 0)
				return;
			AddButton(10, 385, 4005, 4007, 1, GumpButtonType.Reply, 0);
			AddHtmlLocalized(45, 385, 140, 25, 1011036, false, false); // OKAY
			AddButton(10, 410, 4005, 4007, 0, GumpButtonType.Reply, 0);
			AddHtmlLocalized(45, 410, 140, 25, 1011012, false, false); // CANCEL
			int forcount = m_RuneBooks.Count < 15 ? m_RuneBooks.Count : 12;
			int dispy = myGate ? 0 : 20;
			int slength = 0;
			for (int i = 0; i < forcount; i++)
			{
				int index = m_page * 12 + i;
				if (index >= m_RuneBooks.Count)
					break;
				Runebook runebook = m_RuneBooks[index] as Runebook;
				string bookdesc = runebook.Description == null ? "No Description" : runebook.Description;
				bookdesc.Trim();
				string[] keywordargs = ParseString(bookdesc, 15, ":");
				//Console.WriteLine("Args={0} len={1}", keywordargs.Length, bookdesc.Length);
				string booksecurity = null;
				if (keywordargs != null && keywordargs.Length > 1)
				{
					bookdesc = keywordargs[0];
					booksecurity = keywordargs[1];
				}
				if (bookdesc.Length > 21)
				{
					if (Insensitive.StartsWith(bookdesc, "TITLE,"))
					{
						slength = bookdesc.Length - 6;
						if (bookdesc.Length > 27)
							bookdesc = bookdesc.Substring(0, 26);
					}
					else
						bookdesc = bookdesc.Substring(0, 20);
				}
				//Console.WriteLine("bookdesc={0}", bookdesc);
				if (AccessAllowed(booksecurity, m_Mobile))
				{
					if (selected == -1)
						m_selected = selected = i;
					if (bookdesc.Equals("SKIP") || bookdesc.Equals("BREAK") || Insensitive.StartsWith(bookdesc, "TITLE,")) 
					{
						if (myGate)
							AddButton(30 - dispy, 35 + (i * 25), 2117, 2118, 100 + i, GumpButtonType.Reply, 0);
					}
					else
						AddButton(30 - dispy, 35 + (i * 25), 2117, 2118, 100 + i, GumpButtonType.Reply, 0);

					if (selected == i)
					{
						if (myGate)
						{
							AddButton(5, 35 + (i * 25), 3, 4, 200 + i, GumpButtonType.Reply, 0);
							if (index > 0)
								AddButton(20, 29 + (i * 25), 2435, 2436, 300 + i, GumpButtonType.Reply, 0);
							if (index < (m_RuneBooks.Count - 1))
								AddButton(20, 41 + (i * 25), 2437, 2438, 400 + i, GumpButtonType.Reply, 0);
						}
						if (bookdesc.Equals("SKIP") || bookdesc.Equals("BREAK") || Insensitive.StartsWith(bookdesc, "TITLE,"))
						{
							if (Insensitive.StartsWith(bookdesc, "TITLE,"))
							{
								slength = bookdesc.Length - 6;
								AddHtml(50 - dispy, 35 + (i * 25), 155, 20, string.Format("<basefont color=#FFFFCC><U>{0}</U></basefont>", slength < 1 ? "FIX YOUR TITLE!" : bookdesc.Substring(6, slength)), false, false);
							}
							else if (myGate)
								AddHtml(50 - dispy, 35 + (i * 25), 155, 20, "<basefont color=#00ff42>" + bookdesc + "</basefont>", false, false);
						}
						else
							AddHtml(50 - dispy, 35 + (i * 25), 155, 20, "<basefont color=#00ff42>" + bookdesc + "</basefont>", false, false);
						DisplayBookLocations(runebook);
					}
					else
					{
						if (Insensitive.StartsWith(bookdesc, "TITLE,"))
						{
							slength = bookdesc.Length - 6;
							AddHtml(50 - dispy, 35 + (i * 25), 155, 20, string.Format("<basefont color=#FFFFCC><U>{0}</U></basefont>", slength < 1 ? "FIX YOUR TITLE!" : bookdesc.Substring(6, slength)), false, false);
						}
						else if (bookdesc.Equals("BREAK"))
							AddHtml(50 - dispy, 35 + (i * 25), 155, 20, "<basefont color=#6600CC>---------------------</basefont>", false, false);
						else
							if (bookdesc.Equals("SKIP"))
							{
								if (myGate)
									AddHtml(50 - dispy, 35 + (i * 25), 155, 20, bookdesc, false, false);
							}
							else
								AddHtml(50 - dispy, 35 + (i * 25), 155, 20, bookdesc, false, false);
					}
				}
				else
				{
					if (Insensitive.StartsWith(bookdesc, "TITLE,"))
					{
						slength = bookdesc.Length - 6;
						AddHtml(50 - dispy, 35 + (i * 25), 155, 20, string.Format("<basefont color=#FFFFCC><U>{0}</U></basefont>", slength < 1 ? "FIX YOUR TITLE!" : bookdesc.Substring(6, slength)), false, false);
					}
					else if (bookdesc.Equals("BREAK"))
						AddHtml(50 - dispy, 35 + (i * 25), 155, 20, "<basefont color=#6600CC>---------------------</basefont>", false, false);
					else
						if (!bookdesc.Equals("SKIP"))
							AddHtml(50 - dispy, 35 + (i * 25), 155, 20, "<i>" + bookdesc + "</i>", false, false);
				}
			}
			
			//int count = (m_RuneBooks.Count / 12) + (m_RuneBooks.Count % 12 > 0 ? 1:0);
			if (m_RuneBooks.Count > 14)
				for (int i = 0; i < m_RuneBooks.Count / 12.0; i++)
				{
					if (i == m_page)
						AddImage(9 + (i * 24), 345, 0x8B1 + i, 69);
					else
						AddButton(9 + (i * 24), 345, 0x8B1 + i, 0x8B1 + i, 50 + i, GumpButtonType.Reply, 0);
				}
		}
Esempio n. 2
0
		public MoongateLibraryConfirmGump(MoongateLibrary moongatelibrary, Mobile mobile, Point3D location, Map map, string runedesc, int message)
			: base(10, 10)
		{
			m_Mobile = mobile;
			m_location = location;
			m_map = map;
			m_MoongateLibrary = moongatelibrary;
			myGate = m_MoongateLibrary.Owner(m_Mobile);
			m_message = message;
			m_runedesc = runedesc;

			Effects.PlaySound(m_Mobile.Location, m_Mobile.Map, 0x20E);
			AddPage(0);

			AddBackground(0, 0, 360, 155, 5054);
			AddBackground(10, 10, 340, 135, 3000);

			switch (message)
			{
				case 1:
					{
						AddLabel(20, 30, 44, "Your destination may be dangerous, are you sure?");
						AddHtml(20, 50, 380, 60, @"Press Continue to proceed or Cancel to abort.", false, false);
						break;
					}
				case 2:
					{
						AddLabel(20, 20, 44, "This destination requires a password:"******"You have chosen a Felucca destination, are you sure?");
						AddHtml(20, 50, 380, 60, @"Press Continue to proceed or Cancel to abort.", false, false);
						break;
					}
			}

			AddButton(60, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);
			AddHtmlLocalized(95, 100, 290, 40, 1011011, false, false); // CONTINUE
			AddButton(220, 100, 4005, 4007, 0, GumpButtonType.Reply, 0);
			AddHtmlLocalized(255, 100, 290, 20, 1011012, false, false); // CANCEL
		}