public OpenBookGump( HTMLBook book ) : base(0, 0) { m_Book = book; this.Closable=true; this.Disposable=false; this.Dragable=true; this.Resizable=false; this.AddPage(0); this.AddBackground(173, 98, 115, 58, 9350); this.AddButton(184, 109, 2224, 2224, (int)Buttons.View, GumpButtonType.Reply, 0); this.AddLabel(207, 106, 44, "View book"); this.AddButton(184, 128, 2224, 2224, (int)Buttons.Edit, GumpButtonType.Reply, 0); this.AddLabel(207, 125, 44, "Edit book"); }
public PieceOfPaperGump( HTMLBook book ) : base(0, 0) { this.Closable=true; this.Disposable=false; this.Dragable=true; this.Resizable=false; this.AddPage(0); string text1 = ""; if ( book.HTMLContent.CachedHTMLContent[0].Lines != null ) for (int i = 0; i < book.HTMLContent.CachedHTMLContent[0].Lines.Length; i++) text1 += book.HTMLContent.CachedHTMLContent[0].Lines[i]; (this as IHTMLBookGump).DrawToSurface( this, 200, 95, text1, "", 0 ); }
private Dictionary<int, List<HTMLTag>> m_Words = new Dictionary<int, List<HTMLTag>>(); // see GetWordIndex #endregion Fields #region Constructors public HTMLContent( int pages, int maxLines, HTMLBook book ) { m_Book = book; m_CachedHTMLContent = new BookPageInfo[pages]; for ( int i = 0; i < m_CachedHTMLContent.Length; i++ ) { m_CachedHTMLContent[i] = new BookPageInfo(); m_CachedHTMLContent[i].Lines = new string[maxLines]; } // set default body styling m_Body = new List<HTMLTag>(); HTMLTag tag = new ColorTag(); tag.Value = "111111"; // #000000 (black) is invisible m_Body.Add( tag ); tag = new LeftAlignTag(); m_Body.Add( tag ); tag = new MediumFontTag(); m_Body.Add( tag ); }
public EnterCypherGump( HTMLBook book ) : base(0, 0) { m_Book = book; this.Closable=true; this.Disposable=false; this.Dragable=true; this.Resizable=false; this.AddPage(0); this.AddBackground(134, 63, 146, 135, 2620); this.AddLabel(153, 73, 337, "Decrypt Content"); this.AddImageTiled(170, 132, 74, 16, 1803); this.AddImage(162, 132, 1802); this.AddImageTiled(244, 132, 7, 16, 1804); this.AddTextEntry(168, 130, 79, 20, 798, (int)Buttons.Cypher, ""); int len = m_Book.Cypher.Length; this.AddLabel(163, 150, 100, "[" + len + " digits]"); this.AddButton(176, 185, 239, 240, (int)Buttons.Apply, GumpButtonType.Reply, 0); this.AddLabel(164, 109, 51, "Enter Cypher"); }
public BookChoiceMenu( HTMLBook book, int menu, int encLevel, Language language ) : base(0, 0) { m_Language = language; m_Menu = menu; m_Book = book; m_EncryptionLevel = encLevel; this.Closable=true; this.Disposable=false; this.Dragable=true; this.Resizable=false; this.AddPage(0); this.AddBackground(67, 55, 270, 234, 5120); this.AddLabel(152, 69, 337, "I would like to ..."); this.AddImage(58, 61, 1231); this.AddLabel(144, 109, 910, "Edit content"); this.AddLabel(144, 139, 910, "Edit styles"); if ( m_Book.Writable ) { this.AddLabel(144, 169, 910, "Seal the book"); this.AddButton(122, 170, 9702, 9703, (int)Buttons.SealBook, GumpButtonType.Reply, 0); } else { this.AddLabel(144, 169, 910, "Unseal the book"); this.AddButton(122, 170, 9702, 9703, (int)Buttons.UnsealBook, GumpButtonType.Reply, 0); } this.AddButton(122, 110, 9702, 9703, (int)Buttons.EditContent, GumpButtonType.Reply, 0); this.AddButton(122, 140, 9702, 9703, (int)Buttons.EditStyles, GumpButtonType.Reply, 0); this.AddButton(170, 274, 243, 242, 0, GumpButtonType.Reply, 0); this.AddLabel(144, 199, 910, "Translate"); this.AddButton(122, 200, 9702, 9703, (int)Buttons.Translate, GumpButtonType.Reply, 0); if ( m_Book.Cypher.Length == 0 ) {// TODO Scholar feat encryption this.AddLabel(144, 229, 910, "Encrypt content"); this.AddButton(122, 230, 9702, 9703, (int)Buttons.Encrypt, GumpButtonType.Reply, 0); } else { this.AddLabel(144, 229, 910, "Decrypt content"); this.AddButton(122, 230, 9702, 9703, (int)Buttons.Decrypt, GumpButtonType.Reply, 0); } if ( menu == 1 ) // encrypt dialog is open { this.AddBackground(328, 61, 146, 195, 2620); this.AddLabel(348, 71, 337, "Encryption Level"); this.AddButton(345, 103, (m_EncryptionLevel == 1 ? 11400 : 11410), (m_EncryptionLevel == 1 ? 11402 : 11412), (int)Buttons.Simple, GumpButtonType.Reply, 0); this.AddLabel(366, 101, 56, "Simple"); this.AddButton(345, 133, (m_EncryptionLevel == 2 ? 11400 : 11410), (m_EncryptionLevel == 2 ? 11402 : 11412), (int)Buttons.Moderate, GumpButtonType.Reply, 0); this.AddLabel(366, 131, 153, "Moderate"); this.AddButton(345, 163, (m_EncryptionLevel == 3 ? 11400 : 11410), (m_EncryptionLevel == 3 ? 11402 : 11412), (int)Buttons.Complex, GumpButtonType.Reply, 0); this.AddLabel(366, 161, 139, "Complex"); this.AddImageTiled(364, 193, 74, 16, 1803); this.AddImage(356, 193, 1802); this.AddImageTiled(438, 193, 7, 16, 1804); this.AddTextEntry(362, 191, 79, 20, 798, (int)Buttons.EncryptionCypher, ""); int digits = m_EncryptionLevel * 2; this.AddLabel(357, 211, 100, "[" + digits + " digits max.]"); this.AddButton(370, 243, 239, 240, (int)Buttons.DoEncrypt, GumpButtonType.Reply, 0); } else if ( menu == 2 ) // decrypt dialog is open { this.AddBackground(328, 61, 146, 135, 2620); this.AddLabel(347, 71, 337, "Decrypt Content"); this.AddImageTiled(364, 130, 74, 16, 1803); this.AddImage(356, 130, 1802); this.AddImageTiled(438, 130, 7, 16, 1804); this.AddTextEntry(362, 128, 79, 20, 798, (int)Buttons.DecryptionCypher, ""); int digits = m_Book.Cypher.Length; this.AddLabel(357, 148, 100, "[" + digits + " digits]"); this.AddButton(370, 183, 239, 240, (int)Buttons.DoDecrypt, GumpButtonType.Reply, 0); this.AddLabel(358, 107, 51, "Enter Cypher"); } else if ( menu == 3 ) // translation menu is open { this.AddBackground(328, 61, 146, 205, 2620); this.AddLabel(364, 71, 337, "Translation"); this.AddLabel(366, 101, ( m_Language == Language.Alyrian ? 56 : 95 ), "Alyrian"); this.AddButton(370, 253, 239, 240, (int)Buttons.DoTranslate, GumpButtonType.Reply, 0); this.AddButton(350, 105, 2362, 2361, (int)Buttons.Alyrian, GumpButtonType.Reply, 0); this.AddLabel(366, 121, ( m_Language == Language.Azhuran ? 56 : 95 ), "Azhuran"); this.AddButton(350, 125, 2362, 2361, (int)Buttons.Azhuran, GumpButtonType.Reply, 0); this.AddLabel(366, 141, ( m_Language == Language.Common ? 56 : 95 ), "Common"); this.AddButton(350, 145, 2362, 2361, (int)Buttons.Common, GumpButtonType.Reply, 0); this.AddLabel(366, 161, ( m_Language == Language.Khemetar ? 56 : 95 ), "Khemetar"); this.AddButton(350, 165, 2362, 2361, (int)Buttons.Khemetar, GumpButtonType.Reply, 0); this.AddLabel(366, 181, ( m_Language == Language.Mhordul ? 56 : 95 ), "Mhordul"); this.AddButton(350, 185, 2362, 2361, (int)Buttons.Mhordul, GumpButtonType.Reply, 0); this.AddLabel(366, 201, ( m_Language == Language.Tyrean ? 56 : 95 ), "Tyrean"); this.AddButton(350, 205, 2362, 2361, (int)Buttons.Tyrean, GumpButtonType.Reply, 0); this.AddLabel(366, 221, ( m_Language == Language.Vhalurian ? 56 : 95 ), "Vhalurian"); this.AddButton(350, 225, 2362, 2361, (int)Buttons.Vhalurian, GumpButtonType.Reply, 0); } }
public BookChoiceMenu( HTMLBook book, int menu ) : this(book, menu, 0, book.Language) { }
public BookChoiceMenu( HTMLBook book, int menu, int encLevel ) : this(book, menu, encLevel, book.Language) { }
public BookChoiceMenu( HTMLBook book ) : this(book, 0, 0) { }
public void SendLogToBook( HTMLBook m_Book ) { int oldPageCount = m_Book.Pages.Length; m_Book.Writable = true; m_Book.SealedBy = null; string content = ""; foreach( string st in this.Log ) content += st + "<br>"; List<BookPageInfo> newPages = new List<BookPageInfo>(); newPages.Add( new BookPageInfo( new string[]{content} ) ); while( newPages.Count < oldPageCount ) newPages.Add( new BookPageInfo() ); m_Book.Pages = newPages.ToArray(); m_Book.FixContent(); m_Book.HTMLContent = new HTMLContent( m_Book.PagesCount, m_Book.MaxLines, m_Book ); m_Book.FixStyling(); m_Book.HTMLContent.UpdateCache(); m_Book.SealedBy = this; m_Book.Writable = false; m_Book.Author = this.Name; string day = TimeSystem.Data.Day.ToString(); string month = TimeSystem.Data.Month.ToString(); Commands.LevelSystemCommands.FormatDayAndMonth( ref day, ref month ); m_Book.Title = ( "Vendor Log: " + day + " of " + month + ", " + TimeSystem.Data.Year.ToString() ); }
public BookEditingGump( HTMLBook book, int page, int level, int focusedPage, int focusedLine, int focusedWord, string searchWord ) : base(0, 0) { m_Book = book; m_Page = page; m_Level = level; m_FocusedPage = focusedPage; m_FocusedLine = focusedLine; m_FocusedWord = focusedWord; m_SearchWord = searchWord; if ( m_SearchWord.Length == 0 ) m_SearchWord = "search..."; this.Closable=true; this.Disposable=false; this.Dragable=true; this.Resizable=false; this.AddPage(0); IHTMLBookGump bookGump = Activator.CreateInstance(m_Book.Gump, m_Book) as IHTMLBookGump; string page1 = ConstructHTMLPage( page ); string page2 = ""; if ( page + 1 < m_Book.FormattedBookContent.Length ) page2 = ConstructHTMLPage( page+1 ); Rectangle2D bookGumpDimensions = bookGump.GetDimensions( page1, page2 ); int width = bookGumpDimensions.Width; int height = bookGumpDimensions.Height; int startX = 8; int startY = 62; int innerGumpStartX = startX; int innerGumpStartY = 104; int yScaleAmount = 0; if ( width > 457 ) // center outside { startX = (width - 457)/2; innerGumpStartX = 0; } else // center inside { int diff = (457 - width)/2; innerGumpStartX += diff; } yScaleAmount = height; this.AddBackground(0+startX, 0+startY, 457, 64+yScaleAmount, 9270); this.AddBackground(0+startX, 52+startY+yScaleAmount, 457, 172, 9270); this.AddBackground(11+startX, 63+startY+yScaleAmount, 435, 149, 9350); bookGump.DrawToSurface( this, innerGumpStartX, innerGumpStartY, page1, page2, page ); this.AddLabel(56+startX, 17+startY, 1125, "Editing Level:"); this.AddButton(150+startX, 79, ( m_Level == 0 ? 1895 : 1896 ), 1895, (int)Buttons.Body, GumpButtonType.Reply, 0); this.AddLabel(172+startX, 79, ( m_Level == 0 ? 1125 : 1130 ), "Body"); this.AddButton(210+startX, 79, ( m_Level == 1 ? 1895 : 1896 ), 1895, (int)Buttons.Page, GumpButtonType.Reply, 0); this.AddLabel(231+startX, 79, ( m_Level == 1 ? 1125 : 1130 ), "Page"); this.AddButton(270+startX, 79, ( m_Level == 2 ? 1895 : 1896 ), 1895, (int)Buttons.Lines, GumpButtonType.Reply, 0); this.AddLabel(292+startX, 79, ( m_Level == 2 ? 1125 : 1130 ), "Lines"); this.AddButton(330+startX, 79, ( m_Level == 3 ? 1895 : 1896 ), 1895, (int)Buttons.Words, GumpButtonType.Reply, 0); this.AddLabel(352+startX, 79, ( m_Level == 3 ? 1125 : 1130 ), "Words"); this.AddPage(1); List<HTMLTag> tags = new List<HTMLTag>(); switch ( m_Level ) { case 0: // BODY { this.AddLabel(210+startX, 67+startY+yScaleAmount, 634, "BODY"); foreach ( HTMLTag tag in m_Book.HTMLContent.Body ) tags.Add( tag ); break; } case 1: // PAGE { this.AddLabel(210+startX, 67+startY+yScaleAmount, 634, "PAGE"); this.AddLabel(22+startX, 94+startY+yScaleAmount, 635, "Page:"); this.AddButton(98+startX, 95+startY+yScaleAmount, ( m_FocusedPage == 0 ? 1895 : 1896 ), 1895, (int)Buttons.LeftPage, GumpButtonType.Reply, 0); this.AddLabel(120+startX, 95+startY+yScaleAmount, ( m_FocusedPage == 0 ? 635 : 632 ), "Left"); this.AddButton(158+startX, 95+startY+yScaleAmount, ( m_FocusedPage == 1 ? 1895 : 1896 ), 1895, (int)Buttons.RightPage, GumpButtonType.Reply, 0); this.AddLabel(180+startX, 95+startY+yScaleAmount, ( m_FocusedPage == 1 ? 635 : 632 ), "Right"); List<HTMLTag> bodyTags = m_Book.HTMLContent.Body; // add page first, then fill blanks with body tags List<HTMLTag> pageTags = m_Book.HTMLContent.GetPageTags( m_Page + m_FocusedPage ); foreach ( HTMLTag pageTag in pageTags ) tags.Add( pageTag ); foreach ( HTMLTag tag in bodyTags ) { bool found = false; foreach ( HTMLTag pageTag in pageTags ) { if ( tag.Type == pageTag.Type ) { found = true; break; } } if (!found) // type is not overriden in page tags tags.Add( tag ); } break; } case 2: // LINES { this.AddLabel(210+startX, 67+startY+yScaleAmount, 634, "LINES"); this.AddLabel(22+startX, 94+startY+yScaleAmount, 635, "Line:"); int x = 59; int y = 90; for ( int i = 1; i <= m_Book.MaxLines * ( page + 1 < m_Book.FormattedBookContent.Length ? 2 : 1); i++ ) { if ( i == 19 ) { startY += 20; x = 59; } int actualLine, actualPage, lineColor, xOffset; actualPage = ( i > m_Book.MaxLines ? 1 : 0 ); actualLine = i - actualPage*m_Book.MaxLines - 1; lineColor = ( actualPage == m_FocusedPage && actualLine == m_FocusedLine ? 36 : 635 ); this.AddButton(x+startX, y+startY+yScaleAmount, 9792, 9792, 100 + ( i-1 ), GumpButtonType.Reply, 0); // id offset for line buttons is 100 + lineIndex if ( i == 1 ) xOffset = m_LineNumberOffsets[0]; else if ( i > 1 && i < 10 ) xOffset = m_LineNumberOffsets[1]; else if ( i == 11 ) xOffset = m_LineNumberOffsets[3]; else xOffset = m_LineNumberOffsets[2]; this.AddLabel(x + xOffset + startX, y + 3+startY+yScaleAmount, lineColor, "" + i); x += 20; } // add line first, then fill blanks with page & body tags List<HTMLTag> lineTags = m_Book.HTMLContent.GetLineTags( m_Page + m_FocusedPage, m_FocusedLine ); List<HTMLTag> bodyTags = m_Book.HTMLContent.Body; List<HTMLTag> pageTags = m_Book.HTMLContent.GetPageTags( m_Page + m_FocusedPage ); foreach ( HTMLTag lineTag in lineTags ) tags.Add( lineTag ); foreach ( HTMLTag pageTag in pageTags ) { bool found = false; foreach ( HTMLTag tag in tags ) { if ( pageTag.Type == tag.Type ) { found = true; break; } } if (!found) // type is not overriden in line tags tags.Add( pageTag ); } foreach ( HTMLTag bodyTag in bodyTags ) { bool found = false; foreach ( HTMLTag tag in tags ) { if ( bodyTag.Type == tag.Type ) { found = true; break; } } if (!found) // type is not overriden in page tags tags.Add( bodyTag ); } break; } case 3: // WORDS { this.AddLabel(210+startX, 67+startY+yScaleAmount, 634, "WORDS"); this.AddLabel(22+startX, 94+startY+yScaleAmount, 635, "Word:"); // add word first, then fill blanks with line, page & body tags List<HTMLTag> wordTags = m_Book.HTMLContent.GetWordTags( m_Page + m_FocusedPage, m_FocusedLine, m_FocusedWord ); List<HTMLTag> lineTags = m_Book.HTMLContent.GetLineTags( m_Page + m_FocusedPage, m_FocusedLine ); List<HTMLTag> bodyTags = m_Book.HTMLContent.Body; List<HTMLTag> pageTags = m_Book.HTMLContent.GetPageTags( m_Page + m_FocusedPage ); foreach ( HTMLTag wordTag in wordTags ) tags.Add( wordTag ); foreach ( HTMLTag lineTag in lineTags ) { bool found = false; foreach ( HTMLTag tag in tags ) { if ( lineTag.Type == tag.Type ) { found = true; break; } } if (!found) // type is not overriden in word tags tags.Add( lineTag ); } foreach ( HTMLTag pageTag in pageTags ) { bool found = false; foreach ( HTMLTag tag in tags ) { if ( pageTag.Type == tag.Type ) { found = true; break; } } if (!found) // type is not overriden in line tags tags.Add( pageTag ); } foreach ( HTMLTag bodyTag in bodyTags ) { bool found = false; foreach ( HTMLTag tag in tags ) { if ( bodyTag.Type == tag.Type ) { found = true; break; } } if (!found) // type is not overriden in page tags tags.Add( bodyTag ); } break; } } // every level shares these foreach ( HTMLTag tag in tags ) m_Tags[(int)tag.Type] = tag; int font = 1; if ( m_Tags[(int)TagType.Font] != null ) { if ( m_Tags[(int)TagType.Font].Name == Tag.LargeFont ) font = 2; else if ( m_Tags[(int)TagType.Font].Name == Tag.SmallFont ) font = 0; } this.AddLabel(22+startX, 114+startY+yScaleAmount, 635, "Font Size:"); this.AddButton(98+startX, 115+startY+yScaleAmount, (font == 0 ? 1895 : 1896), 1895, (int)Buttons.Small, GumpButtonType.Reply, 0); this.AddLabel(120+startX, 115+startY+yScaleAmount, (font == 0 ? 635 : 632), "Small"); this.AddButton(158+startX, 115+startY+yScaleAmount, (font == 1 ? 1895 : 1896), 1895, (int)Buttons.Medium, GumpButtonType.Reply, 0); this.AddLabel(180+startX, 115+startY+yScaleAmount, (font == 1 ? 635 : 632), "Medium"); this.AddButton(230+startX, 114+startY+yScaleAmount, (font == 2 ? 1895 : 1896), 1895, (int)Buttons.Large, GumpButtonType.Reply, 0); this.AddLabel(252+startX, 114+startY+yScaleAmount, (font == 2 ? 635 : 632), "Large"); string color = "111111"; if ( m_Tags[(int)TagType.Color] != null ) color = m_Tags[(int)TagType.Color].Value; this.AddLabel(22+startX, 134+startY+yScaleAmount, 635, "Font Color:"); this.AddTextEntry(114+startX, 134+startY+yScaleAmount, 60, 20, 632, (int)Buttons.HexColorEntry, color); this.AddLabel(100+startX, 134+startY+yScaleAmount, 632, "#"); int style = 0; if ( m_Tags[(int)TagType.Italic] != null ) { if ( m_Tags[(int)TagType.Bold] != null ) style = 3; else style = 1; } else if ( m_Tags[(int)TagType.Bold] != null ) style = 2; this.AddLabel(22+startX, 154+startY+yScaleAmount, 635, "Font Style:"); this.AddButton(98+startX, 155+startY+yScaleAmount, ( style == 0 ? 1895 : 1896 ), 1895, (int)Buttons.None, GumpButtonType.Reply, 0); this.AddLabel(120+startX, 155+startY+yScaleAmount, (style == 0 ? 635 : 632), "None"); this.AddButton(158+startX, 155+startY+yScaleAmount, ( style == 1 ? 1895 : 1896 ), 1895, (int)Buttons.Italic, GumpButtonType.Reply, 0); this.AddLabel(180+startX, 155+startY+yScaleAmount, (style == 1 ? 635 : 632), "Italic"); this.AddButton(220+startX, 155+startY+yScaleAmount, ( style == 2 ? 1895 : 1896 ), 1895, (int)Buttons.Bold, GumpButtonType.Reply, 0); this.AddLabel(242+startX, 155+startY+yScaleAmount, (style == 2 ? 635 : 632), "Bold"); this.AddButton(277+startX, 155+startY+yScaleAmount, ( style == 3 ? 1895 : 1896 ), 1895, (int)Buttons.ItalicBold, GumpButtonType.Reply, 0); this.AddLabel(299+startX, 155+startY+yScaleAmount, (style == 3 ? 635 : 632), "Italic & Bold"); if ( m_Level == 0 || m_Level == 1 ) // body & page only { int align = 0; if ( m_Tags[(int)TagType.Alignment] != null ) { if ( m_Tags[(int)TagType.Alignment].Name == Tag.CenterAlign ) align = 1; } this.AddLabel(22+startX, 174+startY+yScaleAmount, 635, "Alignment:"); this.AddButton(98+startX, 175+startY+yScaleAmount, ( align == 0 ? 1895 : 1896 ), 1895, (int)Buttons.Left, GumpButtonType.Reply, 0); this.AddLabel(120+startX, 175+startY+yScaleAmount, (align == 0 ? 635 : 632), "Left"); this.AddButton(158+startX, 175+startY+yScaleAmount, ( align == 1 ? 1895 : 1896 ), 1895, (int)Buttons.Center, GumpButtonType.Reply, 0); this.AddLabel(180+startX, 175+startY+yScaleAmount, (align == 1 ? 635 : 632), "Center"); } if ( m_Level == 3 ) // word search { this.AddImage(88+startX, 93+startY+yScaleAmount, 2445); this.AddTextEntry(94+startX, 95+startY+yScaleAmount, 102, 16, 632, (int)Buttons.WordSearch, m_SearchWord); this.AddButton(202+startX, 97+startY+yScaleAmount, 2224, 2224, (int)Buttons.NextWord, GumpButtonType.Reply, 0); this.AddButton(63+startX, 97+startY+yScaleAmount, 2223, 2223, (int)Buttons.PreviousWord, GumpButtonType.Reply, 0); } }
public BookEditingGump( HTMLBook book, int page ) : this(book, page, 0, 0, 0, 0, "") { }
public BookEditingGump( HTMLBook book ) : this(book, 0, 0, 0, 0, 0, "") { }