public static bool IsRunning(EventType type) { SeasonalEvent entry = GetEvent(type); if (entry != null) { return entry.Running; } return false; }
public static bool IsActive(EventType type) { SeasonalEvent entry = GetEvent(type); if (entry != null) { return entry.IsActive(); } return false; }
public EditEventGump(PlayerMobile pm, SeasonalEvent entry) : base(pm, 100, 100) { pm.CloseGump(typeof(EditEventGump)); Entry = entry; _Month = entry.MonthStart; _Day = entry.DayStart; _Duration = entry.Duration; _Status = entry.Status; }
public static void OnToTDeactivated(Mobile from) { SeasonalEvent entry = GetEvent(EventType.TreasuresOfTokuno); if (entry != null) { entry.Status = EventStatus.Inactive; if (from is PlayerMobile mobile) { BaseGump.SendGump(new SeasonalEventGump(mobile)); } } }
public override void AddGumpLayout() { AddBackground(0, 0, 500, 600, 9300); AddHtml(0, 10, 500, 20, Center("Season Event Configuration"), false, false); int y = 60; AddHtml(10, 40, 190, 20, "System Name", false, false); AddHtml(200, 40, 75, 20, "Status", false, false); AddHtml(275, 40, 150, 20, "Season", false, false); AddHtml(400, 40, 50, 20, "Props", false, false); AddHtml(450, 40, 50, 20, "Edit", false, false); for (int i = 0; i < SeasonalEventSystem.Entries.Count; i++) { SeasonalEvent entry = SeasonalEventSystem.Entries[i]; int hue = entry.IsActive() ? 167 : 137; AddLabel(10, y, hue, entry.Name); AddLabel(200, y, hue, entry.Status.ToString()); if (entry.Status != EventStatus.Seasonal) { AddLabel(275, y, hue, "N/A"); } else { DateTime end = new DateTime(DateTime.Now.Year, entry.MonthStart, entry.DayStart, 0, 0, 0) + TimeSpan.FromDays(entry.Duration); if (entry.Duration > -1) { AddLabel(275, y, hue, String.Format("{0}/{1} - {2}/{3}", entry.MonthStart.ToString(), entry.DayStart.ToString(), end.Month.ToString(), end.Day.ToString())); } else { AddLabel(275, y, hue, String.Format("{0}/{1} - Completion", entry.MonthStart.ToString(), entry.DayStart.ToString())); } } AddButton(400, y, 4029, 4030, i + 100, GumpButtonType.Reply, 0); AddButton(450, y, 4029, 4030, i + 10, GumpButtonType.Reply, 0); y += 25; } AddButton(10, 568, 4017, 4018, 1, GumpButtonType.Reply, 0); AddHtml(45, 568, 150, 20, "Restore Defaults", false, false); }
public static TEvent GetEvent<TEvent>() where TEvent : SeasonalEvent { SeasonalEvent first = null; for (var index = 0; index < Entries.Count; index++) { var e = Entries[index]; if (e.GetType() == typeof(TEvent)) { first = e; break; } } return first as TEvent; }
public static void OnLoad() { Persistence.Deserialize( FilePath, reader => { reader.ReadInt(); // version int count = reader.ReadInt(); for (int i = 0; i < count; i++) { var type = (EventType)reader.ReadInt(); SeasonalEvent entry = GetEvent(type); entry.Deserialize(reader); } }); }