public TownCrierGump(Mobile from, ITownCrierEntryList owner) : base(50, 50) { m_From = from; m_Owner = owner; from.CloseGump(typeof(TownCrierGump)); AddPage(0); ArrayList entries = new ArrayList(); if (owner.Entries != null) { foreach (TownCrierEntry tce in owner.Entries) { if (m_From.AccessLevel >= AccessLevel.GameMaster || m_From.Serial == tce.Poster) { entries.Add(tce); } } } owner.GetRandomEntry(); // force expiration checks int count = 0; if (entries != null) { count = entries.Count; } AddImageTiled(0, 0, 300, 38 + (count == 0 ? 20 : (count * 85)), 0xA40); AddAlphaRegion(1, 1, 298, 36 + (count == 0 ? 20 : (count * 85))); AddHtml(8, 8, 300 - 8 - 30, 20, "<basefont color=#FFFFFF><center>TOWN CRIER MESSAGES</center></basefont>", false, false); AddButton(300 - 8 - 30, 8, 0xFAB, 0xFAD, 1, GumpButtonType.Reply, 0); if (count == 0) { AddHtml(8, 30, 284, 20, "<basefont color=#FFFFFF>The crier has no news.</basefont>", false, false); } else { for (int i = 0; i < entries.Count; ++i) { TownCrierEntry tce = (TownCrierEntry)entries[i]; TimeSpan toExpire = tce.ExpireTime - DateTime.Now; if (toExpire < TimeSpan.Zero) { toExpire = TimeSpan.Zero; } StringBuilder sb = new StringBuilder(); sb.Append("[Expires: "); if (toExpire.TotalHours >= 1) { sb.Append((int)toExpire.TotalHours); sb.Append(':'); sb.Append(toExpire.Minutes.ToString("D2")); } else { sb.Append(toExpire.Minutes); } sb.Append(':'); sb.Append(toExpire.Seconds.ToString("D2")); sb.Append("] "); for (int j = 0; j < tce.Lines.Length; ++j) { if (j > 0) { sb.Append("<br>"); } sb.Append(tce.Lines[j]); } sb.Append("<br>Poster: "); sb.Append(tce.Poster.ToString()); AddHtml(8, 35 + (i * 85), 254, 80, sb.ToString(), true, true); AddButton(300 - 8 - 26, 35 + (i * 85), 0x15E1, 0x15E5, 2 + i, GumpButtonType.Reply, 0); } } }
public TownCrierGump( Mobile from, ITownCrierEntryList owner ) : base( 50, 50 ) { m_From = from; m_Owner = owner; from.CloseGump( typeof( TownCrierGump ) ); AddPage( 0 ); List<TownCrierEntry> entries = owner.Entries; owner.GetRandomEntry(); // force expiration checks int count = 0; if ( entries != null ) count = entries.Count; AddImageTiled( 0, 0, 300, 38 + (count == 0 ? 20 : (count * 85)), 0xA40 ); AddAlphaRegion( 1, 1, 298, 36 + (count == 0 ? 20 : (count * 85)) ); AddHtml( 8, 8, 300 - 8 - 30, 20, "<basefont color=#FFFFFF><center>TOWN CRIER MESSAGES</center></basefont>", false, false ); AddButton( 300 - 8 - 30, 8, 0xFAB, 0xFAD, 1, GumpButtonType.Reply, 0 ); if ( count == 0 ) { AddHtml( 8, 30, 284, 20, "<basefont color=#FFFFFF>The crier has no news.</basefont>", false, false ); } else { for ( int i = 0; i < entries.Count; ++i ) { TownCrierEntry tce = (TownCrierEntry)entries[i]; TimeSpan toExpire = tce.ExpireTime - DateTime.Now; if ( toExpire < TimeSpan.Zero ) toExpire = TimeSpan.Zero; StringBuilder sb = new StringBuilder(); sb.Append( "[Expires: " ); if ( toExpire.TotalHours >= 1 ) { sb.Append( (int)toExpire.TotalHours ); sb.Append( ':' ); sb.Append( toExpire.Minutes.ToString( "D2" ) ); } else { sb.Append( toExpire.Minutes ); } sb.Append( ':' ); sb.Append( toExpire.Seconds.ToString( "D2" ) ); sb.Append( "] " ); for ( int j = 0; j < tce.Lines.Length; ++j ) { if ( j > 0 ) sb.Append( "<br>" ); sb.Append( tce.Lines[j] ); } AddHtml( 8, 35 + (i * 85), 254, 80, sb.ToString(), true, true ); AddButton( 300 - 8 - 26, 35 + (i * 85), 0x15E1, 0x15E5, 2 + i, GumpButtonType.Reply, 0 ); } } }
public TownCrierGump(Mobile from, ITownCrierEntryList owner) : base(50, 50) { m_From = from; m_Owner = owner; from.CloseGump(typeof(TownCrierGump)); AddPage(0); List <TownCrierEntry> entries = owner.Entries; owner.GetRandomEntry(); // force expiration checks int count = 0; if (entries != null) { count = entries.Count; } AddImageTiled(0, 0, 300, 38 + (count == 0 ? 20 : (count * 85)), 0xA40); AddAlphaRegion(1, 1, 298, 36 + (count == 0 ? 20 : (count * 85))); if (owner is GlobalTownCrierEntryList) { AddHtml(8, 8, 300 - 8 - 30, 20, "<basefont color=#FFFFFF><center>GLOBAL TOWN CRIER MESSAGES</center></basefont>", false, false); } else { AddHtml(8, 8, 300 - 8 - 30, 20, "<basefont color=#FFFFFF><center>TOWN CRIER MESSAGES</center></basefont>", false, false); } AddButton(300 - 8 - 30, 8, 0xFAB, 0xFAD, 1, GumpButtonType.Reply, 0); AddTooltip(3000161); // New Message if (entries == null || count == 0) { AddHtml(8, 30, 284, 20, "<basefont color=#FFFFFF>The crier has no news.</basefont>", false, false); } else { for (int i = 0; i < entries.Count; ++i) { TownCrierEntry tce = entries[i]; TimeSpan toExpire = tce.ExpireTime - DateTime.UtcNow; if (toExpire < TimeSpan.Zero) { toExpire = TimeSpan.Zero; } StringBuilder sb = new StringBuilder(); sb.Append("[Expires: "); if (toExpire.TotalHours >= 1) { sb.Append((int)toExpire.TotalHours); sb.Append(':'); sb.Append(toExpire.Minutes.ToString("D2")); } else { sb.Append(toExpire.Minutes); } sb.Append(':'); sb.Append(toExpire.Seconds.ToString("D2")); sb.Append("] "); for (int j = 0; j < tce.Lines.Length; ++j) { if (j > 0) { sb.Append("<br>"); } sb.Append(tce.Lines[j]); } AddHtml(8, 35 + (i * 85), 254, 80, sb.ToString(), true, true); AddButton(300 - 8 - 26, 35 + (i * 85), 0x15E1, 0x15E5, 2 + i, GumpButtonType.Reply, 0); AddTooltip(3005101); // Edit } } }