private void BuildEMPage() { int perPage = 15; AddPage(1); int y = 170; for (int i = 0; i < TownCryerSystem.ModeratorEntries.Count && i < perPage; i++) { TownCryerModeratorEntry entry = TownCryerSystem.ModeratorEntries[i]; AddButton(50, y, 0x5FB, 0x5FC, 200 + i, GumpButtonType.Reply, 0); AddLabelCropped(87, y, 631, 20, 0, entry.Title); if (User.AccessLevel > AccessLevel.Player) // Couselors+ can moderate events { AddButton(735, y, 0x5FD, 0x5FE, 2000 + i, GumpButtonType.Reply, 0); AddButton(760, y, 0x5FF, 0x600, 2500 + i, GumpButtonType.Reply, 0); } y += 23; } AddButton(320, 525, 0x627, 0x628, 9, GumpButtonType.Reply, 0); }
public static void Load(GenericReader reader) { int version = reader.ReadInt(); int count = reader.ReadInt(); for (int i = 0; i < count; i++) { var entry = new TownCryerModeratorEntry(reader); if (!entry.Expired) { ModeratorEntries.Add(entry); } } count = reader.ReadInt(); for (int i = 0; i < count; i++) { var entry = new TownCryerCityEntry(reader); if (!entry.Expired) { CityEntries.Add(entry); } } count = reader.ReadInt(); for (int i = 0; i < count; i++) { var entry = new TownCryerGuildEntry(reader); if (!entry.Expired) { GuildEntries.Add(entry); } } count = reader.ReadInt(); for (int i = 0; i < count; i++) { Mobile m = reader.ReadMobile(); DateTime dt = reader.ReadDateTime(); if (m != null) { if (MysteriousPotionEffects == null) { MysteriousPotionEffects = new Dictionary <Mobile, DateTime>(); } MysteriousPotionEffects[m] = dt; } } CheckTimer(); }
public CreateEMEntryGump(PlayerMobile pm, TownCrier cryer, TownCryerModeratorEntry entry = null) : base(pm, cryer) { Entry = entry; if (Entry != null) { Edit = true; } }
public override void OnResponse(RelayInfo info) { if (info.ButtonID == 1) { string headline = info.GetTextEntry(1).Text; string body1 = info.GetTextEntry(2).Text; string body2 = info.GetTextEntry(3).Text; string body3 = info.GetTextEntry(4).Text; string exp = info.GetTextEntry(5).Text; int expires = Utility.ToInt32(exp); if (Entry == null) { Entry = new TownCryerModeratorEntry(User, expires, headline, body1, body2, body3); } else { Entry.Title = headline; Entry.Body1 = body1; Entry.Body2 = body2; Entry.Body3 = body3; if (expires >= 1 && expires <= 30) { Entry.Expires = DateTime.Now + TimeSpan.FromDays(expires); } } if (expires < 1 || expires > 30) { User.SendLocalizedMessage(1158033); // The expiry can be between 1 and 30 days. Please check your entry and try again. } else if (string.IsNullOrEmpty(headline) || string.IsNullOrEmpty(body1) || headline.Length < 5 || body1.Length < 5) { User.SendLocalizedMessage(1158032); // You have made an illegal entry. Check your entries and try again. } else { if (!Edit) { TownCryerSystem.AddEntry(Entry); } User.SendLocalizedMessage(1158039); // Your entry has been submitted. SendGump(new TownCryerGump(User, Cryer, 0, TownCryerGump.GumpCategory.EventModerator)); return; } Refresh(); } }
public static void Load(GenericReader reader) { int version = reader.ReadInt(); int greetingsCount = 0; switch (version) { case 1: greetingsCount = reader.ReadInt(); int count = reader.ReadInt(); for (int i = 0; i < count; i++) { PlayerMobile pm = reader.ReadMobile() as PlayerMobile; if (pm != null) { AddExempt(pm); } } count = reader.ReadInt(); for (int i = 0; i < count; i++) { TownCryerGreetingEntry entry = new TownCryerGreetingEntry(reader); if (!entry.Expired) { GreetingsEntries.Add(entry); } } goto case 0; case 0: count = reader.ReadInt(); for (int i = 0; i < count; i++) { TownCryerModeratorEntry entry = new TownCryerModeratorEntry(reader); if (!entry.Expired) { ModeratorEntries.Add(entry); } } count = reader.ReadInt(); for (int i = 0; i < count; i++) { TownCryerCityEntry entry = new TownCryerCityEntry(reader); if (!entry.Expired) { CityEntries.Add(entry); } } count = reader.ReadInt(); for (int i = 0; i < count; i++) { TownCryerGuildEntry entry = new TownCryerGuildEntry(reader); if (!entry.Expired) { GuildEntries.Add(entry); } } count = reader.ReadInt(); for (int i = 0; i < count; i++) { Mobile m = reader.ReadMobile(); DateTime dt = reader.ReadDateTime(); if (m != null) { if (MysteriousPotionEffects == null) { MysteriousPotionEffects = new Dictionary <Mobile, DateTime>(); } MysteriousPotionEffects[m] = dt; } } break; } if (greetingsCount < GreetingsEntries.Count) { NewGreeting = true; } CheckTimer(); }
public static void AddEntry(TownCryerModeratorEntry entry) { ModeratorEntries.Add(entry); CheckTimer(); }
public TownCryerEventModeratorGump(PlayerMobile pm, TownCrier cryer, TownCryerModeratorEntry entry) : base(pm, cryer) { Entry = entry; }
public static void Save(GenericWriter writer) { writer.Write(1); writer.Write(GreetingsEntries.Count); writer.Write(TownCryerExempt.Count); for (var index = 0; index < TownCryerExempt.Count; index++) { PlayerMobile pm = TownCryerExempt[index]; writer.Write(pm); } int count = 0; for (var index = 0; index < GreetingsEntries.Count; index++) { var x = GreetingsEntries[index]; if (x.Saves) { count++; } } writer.Write(count); for (var index = 0; index < GreetingsEntries.Count; index++) { TownCryerGreetingEntry e = GreetingsEntries[index]; if (e.Saves) { e.Serialize(writer); } } writer.Write(ModeratorEntries.Count); for (var index = 0; index < ModeratorEntries.Count; index++) { TownCryerModeratorEntry e = ModeratorEntries[index]; e.Serialize(writer); } writer.Write(CityEntries.Count); for (var index = 0; index < CityEntries.Count; index++) { TownCryerCityEntry e = CityEntries[index]; e.Serialize(writer); } writer.Write(GuildEntries.Count); for (var index = 0; index < GuildEntries.Count; index++) { TownCryerGuildEntry e = GuildEntries[index]; e.Serialize(writer); } writer.Write(MysteriousPotionEffects != null ? MysteriousPotionEffects.Count : 0); if (MysteriousPotionEffects != null) { foreach (KeyValuePair <Mobile, DateTime> kvp in MysteriousPotionEffects) { writer.Write(kvp.Key); writer.Write(kvp.Value); } } }