void LocalAddHtml(string text, int x, int y, int width, int height, int color, bool background, bool scrollbar) { if (text == null) { return; } // check for cliloc specification if (text.StartsWith("#")) { int cliloc = 0; if (int.TryParse(text.Substring(1, text.Length - 1), out cliloc)) { AddHtmlLocalized(x, y, width, height, cliloc, color, background, scrollbar); } } else { try { string colorstring = String.Format("{0:X}", color); AddHtml(x, y, width, height, XmlSimpleGump.Color(text, colorstring), background, scrollbar); } catch { } } }
public XmlQuestStatusGump(IXmlQuest questitem, string gumptitle, int X, int Y, bool solid, int screen) : base(X, Y) { Closable = true; Dragable = true; m_X = X; m_Y = Y; m_solid = solid; m_questitem = questitem; m_gumptitle = gumptitle; m_screen = screen; AddPage(0); if (!solid) { AddImageTiled(54, 33, 369, 400, 2624); AddAlphaRegion(54, 33, 369, 400); } else { AddBackground(54, 33, 369, 400, 5054); } AddImageTiled(416, 39, 44, 389, 203); // AddButton( 338, 392, 2130, 2129, 3, GumpButtonType.Reply, 0 ); // Okay button AddHtmlLocalized(139, 59, 200, 30, 1046026, 0x7fff, false, false); // Quest Log AddImage(97, 49, 9005); // quest ribbon AddImageTiled(58, 39, 29, 390, 10460); // left hand border AddImageTiled(412, 37, 31, 389, 10460); // right hand border AddImage(430, 9, 10441); AddImageTiled(40, 38, 17, 391, 9263); AddImage(6, 25, 10421); AddImage(34, 12, 10420); AddImageTiled(94, 25, 342, 15, 10304); // top border AddImageTiled(40, 414, 415, 16, 10304); // bottom border AddImage(-10, 314, 10402); AddImage(56, 150, 10411); AddImage(136, 84, 96); AddImage(372, 57, 1417); AddImage(381, 66, 5576); // add the status and journal tabs AddImageTiled(90, 34, 322, 5, 0x145E); // top border int tab1 = 0x138F; int tab2 = 0x138E; if (screen == 1) { tab1 = 0x138E; tab2 = 0x138F; } AddButton(100, 18, tab1, tab2, 900, GumpButtonType.Reply, 0); AddLabel(115, 17, 0, "Status"); AddButton(189, 18, tab2, tab1, 901, GumpButtonType.Reply, 0); AddLabel(205, 17, 0, "Journal"); if (screen == 1) { // display the journal if (questitem.Journal != null && questitem.Journal.Count > 0) { string journaltext = null; for (int i = 0; i < questitem.Journal.Count; i++) { journaltext += "<u>"; journaltext += ((XmlQuest.JournalEntry)questitem.Journal[i]).EntryID; journaltext += ":</u><br>"; journaltext += ((XmlQuest.JournalEntry)questitem.Journal[i]).EntryText; journaltext += "<br><br>"; } AddHtml(100, 90, 270, 300, journaltext, true, true); } // add the add journal entry button AddButton(300, 49, 0x99C, 0x99D, 952, GumpButtonType.Reply, 0); //AddButton(300, 49, 0x159E, 0x159D, 952, GumpButtonType.Reply, 0); } else { if (gumptitle != null && gumptitle.Length > 0) { // display the title if it is there AddImage(146, 91, 2103); // bullet AddHtml(164, 86, 200, 30, XmlSimpleGump.Color(gumptitle, "00FF42"), false, false); } if (questitem.NoteString != null && questitem.NoteString.Length > 0) { // display the note string if it is there AddHtml(100, 106, 270, 80, questitem.NoteString, true, true); } DisplayQuestStatus(130, 192, questitem.Objective1, questitem.State1, questitem.Completed1, questitem.Description1); DisplayQuestStatus(130, 224, questitem.Objective2, questitem.State2, questitem.Completed2, questitem.Description2); DisplayQuestStatus(130, 256, questitem.Objective3, questitem.State3, questitem.Completed3, questitem.Description3); DisplayQuestStatus(130, 288, questitem.Objective4, questitem.State4, questitem.Completed4, questitem.Description4); DisplayQuestStatus(130, 320, questitem.Objective5, questitem.State5, questitem.Completed5, questitem.Description5); //if(questitem.HasCollect){ AddButton(100, 350, 0x2A4E, 0x2A3A, 700, GumpButtonType.Reply, 0); AddLabel(135, 356, 0x384, "Collect"); //} if ((questitem.RewardItem != null && !questitem.RewardItem.Deleted)) { m_questitem.CheckRewardItem(); if (questitem.RewardItem.Amount > 1) { AddLabel(230, 356, 55, String.Format("Reward: {0} ({1})", questitem.RewardItem.GetType().Name, questitem.RewardItem.Amount)); AddLabel(230, 373, 55, String.Format("Weight: {0}", questitem.RewardItem.Weight * questitem.RewardItem.Amount)); } else if (questitem.RewardItem is Container) { AddLabel(230, 356, 55, String.Format("Reward: {0} ({1} items)", questitem.RewardItem.GetType().Name, questitem.RewardItem.TotalItems)); AddLabel(230, 373, 55, String.Format("Weight: {0}", questitem.RewardItem.TotalWeight + questitem.RewardItem.Weight)); } else { AddLabel(230, 356, 55, String.Format("Reward: {0}", questitem.RewardItem.GetType().Name)); AddLabel(230, 373, 55, String.Format("Weight: {0}", questitem.RewardItem.Weight)); } AddImageTiled(330, 373, 81, 40, 200); AddItem(340, 376, questitem.RewardItem.ItemID); } if (questitem.RewardAttachment != null && !questitem.RewardAttachment.Deleted) { AddLabel(230, 339, 55, String.Format("Bonus: {0}", questitem.RewardAttachment.GetType().Name)); } if ((questitem.RewardItem != null && !questitem.RewardItem.Deleted) || (questitem.RewardAttachment != null && !questitem.RewardAttachment.Deleted)) { if (questitem.CanSeeReward) { AddButton(400, 380, 2103, 2103, 800, GumpButtonType.Reply, 0); } } // indicate any status info XmlQuest.VerifyObjectives(questitem); if (questitem.Status != null) { AddLabel(100, 392, 33, questitem.Status); } else // indicate the expiration time if (questitem.IsValid) { //AddHtmlLocalized(150, 400, 50, 37, 1046033, 0xf0000 , false , false ); // Expires AddHtml(130, 392, 200, 37, XmlSimpleGump.Color(questitem.ExpirationString, "00FF42"), false, false); } else if (questitem.AlreadyDone) { if (!questitem.Repeatable) { AddLabel(100, 392, 33, "Already done - cannot be repeated"); } else { ArrayList a = XmlAttach.FindAttachments(questitem.Owner, typeof(XmlQuestAttachment), questitem.Name); if (a != null && a.Count > 0) { AddLabel(100, 392, 33, String.Format("Repeatable in {0}", ((XmlQuestAttachment)a[0]).Expiration)); } else { AddLabel(150, 392, 33, "Already done - ???"); } } } else { //AddHtml( 150, 384, 200, 37, XmlSimpleGump.Color( "No longer valid", "00FF42" ), false, false ); AddLabel(150, 392, 33, "No longer valid"); } if (XmlQuest.QuestPointsEnabled) { AddHtml(250, 40, 200, 30, XmlSimpleGump.Color(String.Format("Difficulty Level {0}", questitem.Difficulty), "00FF42"), false, false); } if (questitem.PartyEnabled) { AddHtml(250, 55, 200, 30, XmlSimpleGump.Color("Party Quest", "00FF42"), false, false); if (questitem.PartyRange >= 0) { AddHtml(250, 70, 200, 30, XmlSimpleGump.Color(String.Format("Party Range {0}", questitem.PartyRange), "00FF42"), false, false); } else { AddHtml(250, 70, 200, 30, XmlSimpleGump.Color("No Range Limit", "00FF42"), false, false); } } else { AddHtml(250, 55, 200, 30, XmlSimpleGump.Color("Solo Quest", "00FF42"), false, false); } } }
public void DisplayQuestStatus(int x, int y, string objectivestr, string statestr, bool status, string descriptionstr) { if (objectivestr != null && objectivestr.Length > 0) { // look for special keywords string[] arglist = BaseXmlSpawner.ParseString(objectivestr, 5, ","); int targetcount = 1; bool foundkill = false; bool foundcollect = false; bool foundgive = false; bool foundescort = false; string name = null; string mobname = null; string type = null; string status_str; string text = null; string typestr; bool checkprop; if (arglist.Length > 0) { switch (arglist[0]) { case "GIVE": // format for the objective string will be GIVE,mobname,itemtype[,count][,proptest] if (arglist.Length > 2) { mobname = arglist[1]; //name = arglist[2]; type = arglist[2]; } XmlQuest.CheckArgList(arglist, 3, null, out typestr, out targetcount, out checkprop, out status_str); foundgive = true; break; case "GIVENAMED": // format for the objective string will be GIVENAMED,mobname,itemname[,type][,count][,proptest] if (arglist.Length > 2) { mobname = arglist[1]; name = arglist[2]; } XmlQuest.CheckArgList(arglist, 3, null, out typestr, out targetcount, out checkprop, out status_str); if (typestr != null) { type = typestr; } foundgive = true; break; case "KILL": // format for the objective string will be KILL,mobtype[,count][,proptest] if (arglist.Length > 1) { //name = arglist[1]; type = arglist[1]; } XmlQuest.CheckArgList(arglist, 2, null, out typestr, out targetcount, out checkprop, out status_str); foundkill = true; break; case "KILLNAMED": // format for the objective string KILLNAMED,mobname[,type][,count][,proptest] if (arglist.Length > 1) { name = arglist[1]; } XmlQuest.CheckArgList(arglist, 2, null, out typestr, out targetcount, out checkprop, out status_str); if (typestr != null) { type = typestr; } foundkill = true; break; case "COLLECT": // format for the objective string will be COLLECT,itemtype[,count][,proptest] if (arglist.Length > 1) { //name = arglist[1]; type = arglist[1]; } XmlQuest.CheckArgList(arglist, 2, null, out typestr, out targetcount, out checkprop, out status_str); foundcollect = true; break; case "COLLECTNAMED": // format for the objective string will be COLLECTNAMED,itemname[,itemtype][,count][,proptest] if (arglist.Length > 1) { name = arglist[1]; } XmlQuest.CheckArgList(arglist, 2, null, out typestr, out targetcount, out checkprop, out status_str); if (typestr != null) { type = typestr; } foundcollect = true; break; case "ESCORT": // format for the objective string will be ESCORT,mobname[,proptest] if (arglist.Length > 1) { name = arglist[1]; } foundescort = true; break; } } if (foundkill) { // get the current kill status int killed = 0; try { killed = int.Parse(statestr); } catch { } int remaining = targetcount - killed; if (remaining < 0) { remaining = 0; } // report the kill task objective status if (descriptionstr != null) { text = String.Format("{0} ({1} left)", descriptionstr, remaining); } else { if (name != null) { if (type == null) { type = "mob"; } text = String.Format("Kill {0} {1}(s) named {2} ({3} left)", targetcount, type, name, remaining); } else { text = String.Format("Kill {0} {1}(s) ({2} left)", targetcount, type, remaining); } } } else if (foundescort) { // get the current escort status int escorted = 0; try { escorted = int.Parse(statestr); } catch { } int remaining = targetcount - escorted; if (remaining < 0) { remaining = 0; } // report the escort task objective status if (descriptionstr != null) { text = descriptionstr; } else { text = String.Format("Escort {0}", name); } } else if (foundcollect) { // get the current collection status int collected = 0; try { collected = int.Parse(statestr); } catch { } int remaining = targetcount - collected; if (remaining < 0) { remaining = 0; } // report the collect task objective status if (descriptionstr != null) { text = String.Format("{0} ({1} left)", descriptionstr, remaining); } else { if (name != null) { if (type == null) { type = "mob"; } text = String.Format("Collect {0} {1}(s) named {2} ({3} left)", targetcount, type, name, remaining); } else { text = String.Format("Collect {0} {1}(s) ({2} left)", targetcount, type, remaining); } } } else if (foundgive) { // get the current give status int collected = 0; try { collected = int.Parse(statestr); } catch { } int remaining = targetcount - collected; if (remaining < 0) { remaining = 0; } // report the collect task objective status if (descriptionstr != null) { text = String.Format("{0} ({1} left)", descriptionstr, remaining); } else { if (name != null) { if (type == null) { type = "item"; } text = String.Format("Give {0} {1}(s) named {2} to {3} ({4} left)", targetcount, type, name, mobname, remaining); } else { text = String.Format("Give {0} {1}(s) to {2} ({3} left)", targetcount, type, mobname, remaining); } } } else { // just report the objectivestring text = objectivestr; } AddHtml(x, y, 223, 35, XmlSimpleGump.Color(text, "EFEF5A"), false, false); if (status) { AddImage(x - 20, y + 3, 0x939); // bullet AddHtmlLocalized(x + 222, y, 225, 37, 1046033, 0xff42, false, false); // Complete } else { AddImage(x - 20, y + 3, 0x938); // bullet AddHtmlLocalized(x + 222, y, 225, 37, 1046034, 0x7fff, false, false); // Incomplete } } }
public QuestLogGump(Mobile from, int page, ArrayList list) : base(12, 24) { if (from == null) { return; } from.CloseGump(typeof(QuestLogGump)); XmlQuestPoints p = (XmlQuestPoints)XmlAttach.FindAttachment(from, typeof(XmlQuestPoints)); m_From = from; m_Page = page; if (list == null) { // make a new list based on the number of items in the book int nquests = 0; list = new ArrayList(); // find all quest items in the players pack if (from.Backpack != null) { var packquestitems = from.Backpack.FindItemsByType(typeof(IXmlQuest)); if (packquestitems != null) { nquests += packquestitems.Length; for (int i = 0; i < packquestitems.Length; ++i) { if (packquestitems[i] != null && !packquestitems[i].Deleted && !(packquestitems[i].Parent is XmlQuestBook)) { list.Add(packquestitems[i]); } } } // find any questbooks they might have var questbookitems = from.Backpack.FindItemsByType(typeof(XmlQuestBook)); if (questbookitems != null) { for (int j = 0; j < questbookitems.Length; ++j) { var questitems = ((XmlQuestBook)questbookitems[j]).FindItemsByType(typeof(IXmlQuest)); if (questitems != null) { nquests += questitems.Length; for (int i = 0; i < questitems.Length; ++i) { list.Add(questitems[i]); } } } } // find any completed quests on the XmlQuestPoints attachment if (p != null && p.QuestList != null) { // add all completed quests foreach (XmlQuestPoints.QuestEntry q in p.QuestList) { list.Add(q); } } } } m_List = list; int index = GetIndexForPage(page); int count = GetCountForIndex(index); int tableIndex = 0; int width = 600; width = 766; X = (824 - width) / 2; int xoffset = 20; AddPage(0); AddBackground(10, 10, width, 439, 5054); AddImageTiled(18, 20, width - 17, 420, 2624); AddImageTiled(58 - xoffset, 64, 36, 352, 200); // open AddImageTiled(96 - xoffset, 64, 163, 352, 1416); // name AddImageTiled(261 - xoffset, 64, 55, 352, 200); // type AddImageTiled(308 - xoffset, 64, 85, 352, 1416); // status AddImageTiled(395 - xoffset, 64, 116, 352, 200); // expires AddImageTiled(511 - xoffset, 64, 42, 352, 1416); // points AddImageTiled(555 - xoffset, 64, 175, 352, 200); // completed AddImageTiled(734 - xoffset, 64, 42, 352, 1416); // repeated for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i) { object obj = list[i]; AddImageTiled(24, 94 + (tableIndex * 32), 489, 2, 2624); ++tableIndex; } AddAlphaRegion(18, 20, width - 17, 420); AddImage(5, 5, 10460); AddImage(width - 15, 5, 10460); AddImage(5, 424, 10460); AddImage(width - 15, 424, 10460); AddHtmlLocalized(375, 25, 200, 30, 1046026, LabelColor, false, false); // Quest Log AddHtmlLocalized(63 - xoffset, 45, 200, 32, 1072837, LabelColor, false, false); // Current Points: AddHtml(243 - xoffset, 45, 200, 32, XmlSimpleGump.Color("Available Credits:", "FFFFFF"), false, false); // Your Reward Points: AddHtml(453 - xoffset, 45, 200, 32, XmlSimpleGump.Color("Rank:", "FFFFFF"), false, false); // Rank AddHtml(600 - xoffset, 45, 200, 32, XmlSimpleGump.Color("Quests Completed:", "FFFFFF"), false, false); // Quests completed if (p != null) { int pcolor = 53; AddLabel(170 - xoffset, 45, pcolor, p.Points.ToString()); AddLabel(350 - xoffset, 45, pcolor, p.Credits.ToString()); AddLabel(500 - xoffset, 45, pcolor, p.Rank.ToString()); AddLabel(720 - xoffset, 45, pcolor, p.QuestsCompleted.ToString()); } AddHtmlLocalized(63 - xoffset, 64, 200, 32, 3000362, LabelColor, false, false); // Open AddHtmlLocalized(147 - xoffset, 64, 200, 32, 3005104, LabelColor, false, false); // Name AddHtmlLocalized(270 - xoffset, 64, 200, 32, 1062213, LabelColor, false, false); // Type AddHtmlLocalized(326 - xoffset, 64, 200, 32, 3000132, LabelColor, false, false); // Status AddHtmlLocalized(429 - xoffset, 64, 200, 32, 1062465, LabelColor, false, false); // Expires AddHtml(514 - xoffset, 64, 200, 32, XmlSimpleGump.Color("Points", "FFFFFF"), false, false); // Points AddHtml(610 - xoffset, 64, 200, 32, XmlSimpleGump.Color("Next Available", "FFFFFF"), false, false); // Next Available //AddHtmlLocalized( 610 - xoffset, 64, 200, 32, 1046033, LabelColor, false, false ); // Completed AddHtmlLocalized(738 - xoffset, 64, 200, 32, 3005020, LabelColor, false, false); // Repeat AddButton(675 - xoffset, 416, 4017, 4018, 0, GumpButtonType.Reply, 0); AddHtmlLocalized(710 - xoffset, 416, 120, 20, 1011441, LabelColor, false, false); // EXIT AddButton(113 - xoffset, 416, 0xFA8, 0xFAA, 10, GumpButtonType.Reply, 0); AddHtml(150 - xoffset, 416, 200, 32, XmlSimpleGump.Color("Top Players", "FFFFFF"), false, false); // Top players gump tableIndex = 0; if (page > 0) { AddButton(225, 416, 4014, 4016, 2, GumpButtonType.Reply, 0); AddHtmlLocalized(260, 416, 150, 20, 1011067, LabelColor, false, false); // Previous page } if (GetIndexForPage(page + 1) < list.Count) { AddButton(375, 416, 4005, 4007, 3, GumpButtonType.Reply, 0); AddHtmlLocalized(410, 416, 150, 20, 1011066, LabelColor, false, false); // Next page } for (int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i) { object obj = list[i]; if (obj is IXmlQuest) { IXmlQuest e = (IXmlQuest)obj; int y = 96 + (tableIndex++ *32); AddButton(60 - xoffset, y + 2, 0xFAB, 0xFAD, 2000 + i, GumpButtonType.Reply, 0); // open gump int color; if (!e.IsValid) { color = 33; } else if (e.IsCompleted) { color = 67; } else { color = 5; } AddLabel(100 - xoffset, y, color, e.Name); //AddHtmlLocalized( 315, y, 200, 32, e.IsCompleted ? 1049071 : 1049072, htmlcolor, false, false ); // Completed/Incomplete AddLabel(315 - xoffset, y, color, e.IsCompleted ? "Completed" : "In Progress"); // indicate the expiration time if (e.IsValid) { // do a little parsing of the expiration string to fit it in the space string substring = e.ExpirationString; if (e.ExpirationString.IndexOf("Expires in") >= 0) { substring = e.ExpirationString.Substring(11); } AddLabel(400 - xoffset, y, color, substring); } else { AddLabel(400 - xoffset, y, color, "No longer valid"); } if (e.PartyEnabled) { AddLabel(270 - xoffset, y, color, "Party"); //AddHtmlLocalized( 250, y, 200, 32, 3000332, htmlcolor, false, false ); // Party } else { AddLabel(270 - xoffset, y, color, "Solo"); } AddLabel(515 - xoffset, y, color, e.Difficulty.ToString()); } else if (obj is XmlQuestPoints.QuestEntry) { XmlQuestPoints.QuestEntry e = (XmlQuestPoints.QuestEntry)obj; int y = 96 + (tableIndex++ *32); int color = 67; AddLabel(100 - xoffset, y, color, e.Name); AddLabel(315 - xoffset, y, color, "Completed"); if (e.PartyEnabled) { AddLabel(270 - xoffset, y, color, "Party"); //AddHtmlLocalized( 250, y, 200, 32, 3000332, htmlcolor, false, false ); // Party } else { AddLabel(270 - xoffset, y, color, "Solo"); } AddLabel(515 - xoffset, y, color, e.Difficulty.ToString()); //AddLabel( 560 - xoffset, y, color, e.WhenCompleted.ToString() ); // determine when the quest can be done again by looking for an xmlquestattachment with the same name XmlQuestAttachment qa = (XmlQuestAttachment)XmlAttach.FindAttachment(from, typeof(XmlQuestAttachment), e.Name); if (qa != null) { if (qa.Expiration == TimeSpan.Zero) { AddLabel(560 - xoffset, y, color, "Not Repeatable"); } else { DateTime nexttime = DateTime.UtcNow + qa.Expiration; AddLabel(560 - xoffset, y, color, nexttime.ToString()); } } else { // didnt find one so it can be done again AddLabel(560 - xoffset, y, color, "Available Now"); } AddLabel(741 - xoffset, y, color, e.TimesCompleted.ToString()); } } }
public XmlSimpleGump(object invoker, string gumptext, string gumptitle, int gumptype, BaseXmlSpawner.KeywordTag tag, Mobile from, XmlGumpCallback gumpcallback) : base(0, 0) { string maintext = gumptext; int nselections = 0; int height = 400; int width = 369; Closable = false; Dragable = true; m_gumptype = gumptype; m_invoker = invoker; m_keywordtag = tag; m_gumpcallback = gumpcallback; AddPage(0); // for the multiple selection gump, parse the gumptext for selections and responses if (gumptype == 4) { maintext = ParseGumpText(gumptext); nselections = gumpSelections.Count; height = height + nselections * 40; } if (gumptype == 5) { maintext = ParseGumpText(gumptext); nselections = gumpSelections.Count; // the maintext in this case is a width,height specifier so parse it string [] args = maintext.Split(','); if (args != null && args.Length > 1) { int.TryParse(args[0].Trim(), out width); int.TryParse(args[1].Trim(), out height); } } AddImageTiled(54, 33, width, height, 2624); AddAlphaRegion(54, 33, width, height); AddImageTiled(width + 47, 39, 44, height - 11, 203); AddImageTiled(58, 39, 29, height - 10, 10460); // left hand border AddImageTiled(width + 43, 37, 31, height - 11, 10460); // right hand border AddImageTiled(40, 38, 17, height - 9, 9263); // leftmost border //AddImageTiled( 94, 25, width - 27, 15, 10304 ); // top border AddImageTiled(40, 25, width + 48, 15, 10304); // top border AddImageTiled(40, height + 27, width + 46, 16, 10304); // bottom border if (gumptype != 5) { AddImage(width + 61, 9, 10441); // dragon borders AddImage(6, 25, 10421); AddImage(34, 12, 10420); AddImage(-10, height - 86, 10402); AddImage(56, 150, 10411); AddImage(136, 84, 96); // divider AddImage(width + 3, 57, 1417); // quest icons AddImage(width + 12, 66, 5576); AddButton(width - 31, height - 8, 2130, 2129, 3, GumpButtonType.Reply, 0); // Okay button } else { AddButton(width + 70, 25, 0x138b, 0x138b, 0, GumpButtonType.Reply, 0); // closegump button } if (gumptitle != null && gumptitle.Length > 0 && gumptype != 5) { // display the title if it is there AddImage(156, 126, 2103); // bullet LocalAddHtml(gumptitle, 174, 121, 200, 40, 0x00FF42, false, false); } if (gumptype == 0) { // simple message gump LocalAddHtml(maintext, 105, 159, 299, 182, 0xEFEF5A, false, true); } else if (gumptype == 1) { // Yes/no type gump AddRadio(101, height - 45, 9721, 9724, true, 1); // accept/yes radio AddRadio(101, height - 11, 9721, 9724, false, 2); // decline/no radio AddHtmlLocalized(137, height - 41, 200, 30, 1049016, 0x7fff, false, false); // Yes AddHtmlLocalized(137, height - 7, 200, 30, 1049017, 0x7fff, false, false); // No LocalAddHtml(maintext, 105, 159, 299, 182, 0xEFEF5A, false, true); } else if (gumptype == 2) { // reply type gump AddImageTiled(134, height - 7, 159, 23, 0x52); AddImageTiled(135, height - 6, 157, 21, 0xBBC); AddHtmlLocalized(105, height - 7, 200, 30, 3002006, 0x7fff, false, false); // Say: AddTextEntry(135, height - 7, 150, 21, 0, 99, null); LocalAddHtml(maintext, 105, 159, 299, 182, 0xEFEF5A, false, true); } else if (gumptype == 3) { // Quest type gump AddImage(97, 49, 9005); // quest ribbon AddRadio(101, height - 45, 9721, 9724, true, 1); // accept/yes radio AddRadio(101, height - 11, 9721, 9724, false, 2); // decline/no radio AddHtmlLocalized(139, 59, 200, 30, 1046013, 0x7fff, false, false); // Quest Offer AddHtmlLocalized(137, height - 41, 200, 30, 1049011, 0x7fff, false, false); // I accept! AddHtmlLocalized(137, height - 7, 200, 30, 1049012, 0x7fff, false, false); // No thanks, I decline. LocalAddHtml(maintext, 105, 159, 299, 182, 0xEFEF5A, false, true); } else if (gumptype == 4) { // multiple selection type gump // parse the gump text to get the selections and responses for (int i = 0; i < gumpSelections.Count; i++) { int y = 360 + i * 40; AddRadio(101, y, 9721, 9724, i == 0 ? true: false, i); // accept/yes radio AddHtml(137, y + 4, 250, 40, XmlSimpleGump.Color(gumpSelections[i].Selection, "FFFFFF"), false, false); } LocalAddHtml(maintext, 105, 159, 299, 182, 0xEFEF5A, false, true); } else if (gumptype == 5) { // parse the gump text to get the selections and responses for (int i = 0; i < gumpSelections.Count; i++) { string selection = gumpSelections[i].Selection; string response = gumpSelections[i].Response; int gx = 0; int gy = 0; int gwidth = 0; int gheight = 0; string label = null; string [] args = null; int gumpid = 0; int color = 0; if (selection != null) { args = selection.Split(','); } // process the gumpitem specifications if (args.Length > 1) { for (int j = 0; j < args.Length; j++) { args[j] = args[j].Trim(); } if (args[0].ToLower() == "button") { // syntax is button,gumpid,x,y if (args.Length > 3) { if (args[1].StartsWith("0x")) { int.TryParse(args[1].Substring(2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out gumpid); } else { int.TryParse(args[1], out gumpid); } int.TryParse(args[2], out gx); int.TryParse(args[3], out gy); int buttonid = 1000 + i; // add the button AddButton(gx, gy, gumpid, gumpid, buttonid, GumpButtonType.Reply, 0); } } else if (args[0].ToLower() == "label") { // syntax is label,x,y,label[,color] if (args.Length > 3) { int.TryParse(args[1], out gx); int.TryParse(args[2], out gy); label = args[3]; } // set the default label color color = 0x384; if (args.Length > 4) { int.TryParse(args[4], out color); } // add the label AddLabel(gx, gy, color, label); } else if (args[0].ToLower() == "html") { // reparse the specification to allow for the possibility of commas in the html text args = selection.Split(new char[] { ',' }, 6); color = 0xEFEF5A; // syntax is html,x,y,width,height,text[,hue] * hue has to be in HEX format, ex: 0xFF00AA (lenght of 8 mandatory!) if (args.Length > 5) { int.TryParse(args[1].Trim(), out gx); int.TryParse(args[2].Trim(), out gy); int.TryParse(args[3].Trim(), out gwidth); int.TryParse(args[4].Trim(), out gheight); if (args.Length > 6 && args[5].StartsWith("0x") && args[5].Trim().Length == 8) { if (!int.TryParse(args[5].Trim().Substring(2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out color)) { color = 0xEFEF5A; } label = args[6]; } else { label = args[5]; } } // add the html area //AddHtml( gx, gy, gwidth, gheight, label, false, true ); LocalAddHtml(label, gx, gy, gwidth, gheight, color, false, true); } else if (args[0].ToLower() == "textentry") { gumpSelections[i].GumpItemType = 1; // syntax is textentry,x,y,width,height[,textcolor][,text] if (args.Length > 4) { int.TryParse(args[1].Trim(), out gx); int.TryParse(args[2].Trim(), out gy); int.TryParse(args[3].Trim(), out gwidth); int.TryParse(args[4].Trim(), out gheight); } if (args.Length > 5) { label = args[5]; } // set the default textentry color color = 0x384; if (args.Length > 6) { int.TryParse(args[6], out color); } AddTextEntry(gx, gy, gwidth, gheight, color, i, label); } else if (args[0].ToLower() == "radio") { int gumpid1 = 0; int gumpid2 = 0; // syntax is radio,gumpid1,gumpid2,x,y[,initialstate] if (args.Length > 4) { int.TryParse(args[1].Trim(), out gumpid1); int.TryParse(args[2].Trim(), out gumpid2); int.TryParse(args[3].Trim(), out gx); int.TryParse(args[4].Trim(), out gy); } bool initial = false; if (args.Length > 5) { bool.TryParse(args[5], out initial); } AddRadio(gx, gy, gumpid1, gumpid2, initial, i); } else if (args[0].ToLower() == "image") { // syntax is image,gumpid,x,y[,hue] if (args.Length > 3) { if (args[1].StartsWith("0x")) { int.TryParse(args[1].Substring(2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out gumpid); } else { int.TryParse(args[1], out gumpid); } int.TryParse(args[2], out gx); int.TryParse(args[3], out gy); if (args.Length > 4) { int.TryParse(args[4], out color); } // add the image AddImage(gx, gy, gumpid, color); } } else if (args[0].ToLower() == "imagetiled") { // syntax is imagetiled,gumpid,x,y,width,height if (args.Length > 5) { if (args[1].StartsWith("0x")) { int.TryParse(args[1].Substring(2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out gumpid); } else { int.TryParse(args[1], out gumpid); } int.TryParse(args[2], out gx); int.TryParse(args[3], out gy); int.TryParse(args[4], out gwidth); int.TryParse(args[5], out gheight); // add the image AddImageTiled(gx, gy, gwidth, gheight, gumpid); } } else if (args[0].ToLower() == "item") { // syntax is item,itemid,x,y[,hue] if (args.Length > 3) { if (args[1].StartsWith("0x")) { int.TryParse(args[1].Substring(2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out gumpid); } else { int.TryParse(args[1], out gumpid); } int.TryParse(args[2], out gx); int.TryParse(args[3], out gy); if (args.Length > 4) { int.TryParse(args[4], out color); } // add the image AddItem(gx, gy, gumpid, color); } } } } } }