Exemple #1
0
        public override void OnResponse(RelayInfo info)
        {
            if (info.ButtonID == 0)
            {
                return;
            }

            if (info.ButtonID >= 10)
            {
                int id = info.ButtonID - 10;

                if (id >= 0 && id < SeasonalEventSystem.Entries.Count)
                {
                    SeasonalEventEntry entry = SeasonalEventSystem.Entries[id];

                    if (entry.EventType == EventType.TreasuresOfTokuno)
                    {
                        User.CloseGump(typeof(ToTAdminGump));
                        User.SendGump(new ToTAdminGump());
                    }
                    else
                    {
                        BaseGump.SendGump(new EditEventGump(User, entry));
                    }
                }
            }
            else if (info.ButtonID == 1)
            {
                SeasonalEventSystem.LoadEntries();
                User.SendMessage("All event entries have been restored to default.");

                Refresh();
            }
        }
        public static bool IsActive(EventType type)
        {
            SeasonalEventEntry entry = GetEntry(type);

            if (entry != null)
            {
                return(entry.IsActive());
            }

            return(false);
        }
Exemple #3
0
        public EditEventGump(PlayerMobile pm, SeasonalEventEntry 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)
        {
            SeasonalEventEntry entry = GetEntry(EventType.TreasuresOfTokuno);

            if (entry != null)
            {
                entry.Status = EventStatus.Inactive;

                if (from is PlayerMobile)
                {
                    BaseGump.SendGump(new SeasonalEventGump((PlayerMobile)from));
                }
            }
        }
        public static void OnLoad()
        {
            Persistence.Deserialize(
                FilePath,
                reader =>
            {
                reader.ReadInt();     // version

                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    SeasonalEventEntry entry = GetEntry((EventType)reader.ReadInt());
                    entry.Deserialize(reader);
                }
            });
        }
Exemple #6
0
        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(450, 40, 50, 20, "Edit", false, false);

            for (int i = 0; i < SeasonalEventSystem.Entries.Count; i++)
            {
                SeasonalEventEntry 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);

                    AddLabel(275, y, hue, String.Format("{0}/{1} - {2}/{3}", entry.MonthStart.ToString(), entry.DayStart.ToString(), end.Month.ToString(), end.Day.ToString()));
                }

                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);
        }