Beispiel #1
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (User.AccessLevel >= Conquests.Access)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Clear",
                        b =>
                        Send(
                            new ConfirmDialogGump(
                                User,
                                this,
                                title: "Clear Conquests?",
                                html:
                                "All conquests in the profile will be cleared, erasing all data associated with them.\nThis action can not be reversed.\n\nDo you want to continue?",
                                onAccept: OnConfirmClearProfile)),
                        HighlightHue));
            }

            if (User != Profile.Owner)
            {
                list.AppendEntry(new ListGumpEntry("My Conquests", OnMyProfile, HighlightHue));
            }

            list.AppendEntry(new ListGumpEntry("Help", ShowHelp));

            base.CompileMenuOptions(list);
        }
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (User.AccessLevel >= Conquests.Access)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Delete All",
                        button => Send(
                            new ConfirmDialogGump(User, this)
                {
                    Title = "Delete All Profiles?",
                    Html  =
                        "All profiles in the database will be deleted, erasing all data associated with them.\nThis action can not be reversed.\n\nDo you want to continue?",
                    AcceptHandler = subButton =>
                    {
                        var profiles = Conquests.Profiles.Values.Where(p => p != null).ToArray();

                        Conquests.Profiles.Clear();

                        profiles.ForEach(p => p.Clear());

                        Refresh(true);
                    }
                }),
                        ErrorHue));
            }

            list.AppendEntry(new ListGumpEntry("My Conquests", OnMyProfile, HighlightHue));

            list.AppendEntry(new ListGumpEntry("Help", ShowHelp));

            base.CompileMenuOptions(list);
        }
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (User.AccessLevel >= Voting.Access)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Delete All",
                        button => Send(
                            new ConfirmDialogGump(User, this)
                {
                    Title = "Delete All Profiles?",
                    Html  =
                        "All profiles in the database will be deleted, erasing all data associated with them.\n" +
                        "This action can not be reversed.\n\nDo you want to continue?",
                    AcceptHandler = subButton =>
                    {
                        while (Voting.Profiles.Count > 0)
                        {
                            var p = Voting.Profiles.Pop();

                            if (p.Value != null && !p.Value.Deleted)
                            {
                                p.Value.Delete();
                            }
                            else
                            {
                                Voting.Profiles.Remove(p.Key);
                            }
                        }

                        Refresh(true);
                    }
                }),
                        ErrorHue));
            }

            list.AppendEntry(new ListGumpEntry("My Profile", OnMyProfile, HighlightHue));

            list.AppendEntry(
                new ListGumpEntry(
                    SortByToday ? "Sort by Grand Total" : "Sort by Today's Total",
                    b =>
            {
                SortByToday = !SortByToday;
                Refresh(true);
            }));

            list.AppendEntry(new ListGumpEntry("Help", ShowHelp));

            base.CompileMenuOptions(list);
        }
Beispiel #4
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (User.AccessLevel >= TrashCollection.Access)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Delete All",
                        button => Send(
                            new ConfirmDialogGump(User, this)
                {
                    Title = "Delete All Profiles?",
                    Html  =
                        "All profiles in the database will be deleted, erasing all data associated with them.\n" +
                        "This action can not be reversed.\n\nDo you want to continue?",
                    AcceptHandler = subButton =>
                    {
                        TrashCollection.Profiles.Values.ToArray().Where(p => p != null && !p.Deleted).ForEach(p => p.Delete());

                        Refresh(true);
                    }
                }),
                        ErrorHue));
            }

            list.AppendEntry(new ListGumpEntry("My Profile", OnMyProfile, HighlightHue));

            list.AppendEntry(
                new ListGumpEntry(
                    SortByToday ? "Sort by Grand Total" : "Sort by Today's Total",
                    b =>
            {
                SortByToday = !SortByToday;
                Refresh(true);
            }));

            list.AppendEntry(new ListGumpEntry("Help", ShowHelp));

            base.CompileMenuOptions(list);
        }
        protected override void CompileOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (User.AccessLevel >= AutoPvP.Access)
            {
                if (Restrictions.IsRestricted(Key))
                {
                    list.AppendEntry(
                        new ListGumpEntry(
                            "Set Unrestricted",
                            button =>
                    {
                        Restrictions.SetRestricted(Key, false);
                        Refresh(true);
                    },
                            ErrorHue));
                }
                else
                {
                    list.AppendEntry(
                        new ListGumpEntry(
                            "Set Restricted",
                            button =>
                    {
                        Restrictions.SetRestricted(Key, true);
                        Refresh(true);
                    },
                            HighlightHue));
                }

                if (!Locked && User.AccessLevel >= AutoPvP.Access)
                {
                    list.AppendEntry(
                        new ListGumpEntry(
                            "Delete",
                            button =>
                    {
                        if (UseConfirmDialog)
                        {
                            Send(
                                new ConfirmDialogGump(
                                    User,
                                    Refresh(),
                                    title: "Delete Entry?",
                                    html:
                                    "All data associated with this entry will be deleted.\nThis action can not be reversed!\nDo you want to continue?",
                                    onAccept: OnConfirmDelete));
                        }
                        else
                        {
                            OnConfirmDelete(button);
                        }
                    }));
                }
            }

            base.CompileOptions(list);

            list.Replace("Cancel", new ListGumpEntry("Done", Cancel));
        }
Beispiel #6
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (CanGlobalEdit())
            {
                if (GlobalEdit)
                {
                    list.AppendEntry("End Global Edit", b => EndGlobalEdit(), ErrorHue);

                    list.AppendEntry("Edit Defaults", b => User.SendGump(new PropertiesGump(User, Toolbars.CMOptions)), HighlightHue);

                    list.AppendEntry(
                        "Reset Global Entries",
                        b => new ConfirmDialogGump(User, this)
                    {
                        Title = "Reset Global Entries",
                        Html  = "Applying global defaults will copy the global toolbar to all existing toolbars.\n" +
                                "This will overwrite any custom entries that exist.\n\nDo you want to continue?",
                        AcceptHandler = db =>
                        {
                            Toolbars.SetGlobalEntries();
                            Refresh(true);
                        }
                    }.Send(),
                        HighlightHue);

                    list.AppendEntry(
                        "Reset Global Themes",
                        b => new ConfirmDialogGump(User, this)
                    {
                        Title = "Reset Global Themes",
                        Html  = "Applying global theme will reset the theme of all existing toolbars.\n\n" +                                //
                                "Do you want to continue?",
                        AcceptHandler = db =>
                        {
                            Toolbars.SetGlobalTheme();
                            Refresh(true);
                        }
                    }.Send(),
                        HighlightHue);

                    list.AppendEntry(
                        "Reset Global Positions",
                        b => new ConfirmDialogGump(
                            User,
                            this,
                            title: "Reset Global Positions",
                            html: "Applying global position will reset the position of all existing toolbars.\n\n" +                             //
                            "Do you want to continue?",
                            onAccept: db =>
                    {
                        Toolbars.SetGlobalPosition();
                        Refresh(true);
                    }).Send(),
                        HighlightHue);

                    list.AppendEntry(
                        "Reset Global Sizes",
                        b => new ConfirmDialogGump(User, this)
                    {
                        Title = "Reset Global Sizes",
                        Html  = "Applying global size will reset the size of all existing toolbars.\n" +
                                "Any entries located beyond the new size will be lost.\n\n" +                                    //
                                "Do you want to continue?",
                        AcceptHandler = db =>
                        {
                            Toolbars.SetGlobalSize();
                            Refresh(true);
                        }
                    }.Send(),
                        HighlightHue);
                }
                else
                {
                    list.AppendEntry("Begin Global Edit", b => BeginGlobalEdit(), HighlightHue);
                }
            }

            list.AppendEntry(
                "Load Defaults",
                b => new ConfirmDialogGump(User, this)
            {
                Title = "Load Defaults",
                Html  = "Loadng defaults will overwrite any custom entries that exist in your toolbar.\n\n" +                        //
                        "Do you want to continue?",
                AcceptHandler = db =>
                {
                    State.SetDefaultEntries();
                    Refresh(true);
                }
            }.Send(),
                HighlightHue);

            list.AppendEntry(
                "Set Position",
                b => new OffsetSelectorGump(
                    User,
                    this,
                    new Point(State.X, State.Y),
                    (self, oldValue) =>
            {
                X = State.X = self.Value.X;
                Y = State.Y = self.Value.Y;
                Refresh(true);
            }).Send(),
                HighlightHue);

            list.AppendEntry(
                "Set Size",
                b =>
            {
                var html = String.Format(
                    "Set the size for your toolbar.\nFormat: Width,Height\nWidth Range: {0}\nHeight Range: {1}\n\nIf you shrink the size, any entires located beyond the new size will be lost.",
                    String.Format("{0}-{1}", Toolbars.CMOptions.DefaultWidth, Toolbars.DefaultEntries.Width),
                    String.Format("{0}-{1}", Toolbars.CMOptions.DefaultHeight, Toolbars.DefaultEntries.Height));

                new InputDialogGump(User, this)
                {
                    Title     = "Set Size",
                    Html      = html,
                    InputText = String.Format("{0},{1}", State.Width, State.Height),
                    Callback  = (cb, text) =>
                    {
                        int w = State.Width, h = State.Height;

                        if (text.IndexOf(",", StringComparison.Ordinal) != -1)
                        {
                            var split = text.Split(',');

                            if (split.Length >= 2)
                            {
                                if (Int32.TryParse(split[0], out w))
                                {
                                    if (w < Toolbars.CMOptions.DefaultWidth)
                                    {
                                        w = Toolbars.CMOptions.DefaultWidth;
                                    }
                                    else if (!GlobalEdit && w > Toolbars.DefaultEntries.Width)
                                    {
                                        w = Toolbars.DefaultEntries.Width;
                                    }
                                }
                                else
                                {
                                    w = State.Width;
                                }

                                if (Int32.TryParse(split[1], out h))
                                {
                                    if (h < Toolbars.CMOptions.DefaultHeight)
                                    {
                                        h = Toolbars.CMOptions.DefaultHeight;
                                    }
                                    else if (!GlobalEdit && h > Toolbars.DefaultEntries.Height)
                                    {
                                        h = Toolbars.DefaultEntries.Height;
                                    }
                                }
                                else
                                {
                                    h = State.Height;
                                }
                            }
                        }

                        State.Resize(w, h);
                        Refresh(true);
                    }
                }.Send();
            },
                HighlightHue);

            list.AppendEntry(
                "Set Theme",
                b =>
            {
                var opts = new MenuGumpOptions();

                var themes = default(ToolbarTheme).EnumerateValues <ToolbarTheme>(false);

                foreach (var themeID in themes)
                {
                    if (State.Theme == themeID)
                    {
                        continue;
                    }

                    var id    = themeID;
                    var theme = ToolbarThemes.GetTheme(themeID);

                    opts.AppendEntry(
                        theme.Name,
                        tb =>
                    {
                        State.Theme = id;
                        Refresh(true);
                    },
                        HighlightHue);
                }

                new MenuGump(User, this, opts, b).Send();
            },
                HighlightHue);

            base.CompileMenuOptions(list);

            list.RemoveEntry("New Search");
            list.RemoveEntry("Clear Search");

            list.Replace("Refresh", "Exit", b => Close(b));
        }
Beispiel #7
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (Selected != null && User.AccessLevel >= Schedules.Access)
            {
                if (!Selected.Enabled)
                {
                    list.AppendEntry(
                        new ListGumpEntry(
                            "Enable",
                            b =>
                    {
                        Selected.Enabled = true;
                        Refresh(true);
                    },
                            HighlightHue));
                }
                else
                {
                    list.AppendEntry(
                        new ListGumpEntry(
                            "Disable",
                            b =>
                    {
                        Selected.Enabled = false;
                        Refresh(true);
                    },
                            HighlightHue));

                    list.AppendEntry(
                        new ListGumpEntry("Edit Months", b => Send(new ScheduleMonthsMenuGump(User, Selected, this, b)), HighlightHue));
                    list.AppendEntry(
                        new ListGumpEntry("Edit Days", b => Send(new ScheduleDaysMenuGump(User, Selected, this, b)), HighlightHue));
                    list.AppendEntry(
                        new ListGumpEntry("Edit Times", b => Send(new SheduleTimeListGump(User, Selected, Hide(true))), HighlightHue));
                    list.AppendEntry(
                        new ListGumpEntry(
                            "Clear Schedule",
                            b =>
                    {
                        if (UseConfirmDialog)
                        {
                            Send(
                                new ConfirmDialogGump(
                                    User,
                                    this,
                                    title: "Clear Schedule?",
                                    html:
                                    "The schedule will be cleared, erasing all data associated with its entries.\nThis action can not be reversed.\n\nDo you want to continue?",
                                    onAccept: OnConfirmClearSchedule));
                        }
                        else
                        {
                            OnConfirmClearSchedule(b);
                        }
                    },
                            HighlightHue));
                }
            }

            base.CompileMenuOptions(list);
        }
Beispiel #8
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (Selected != null && !Selected.Deleted)
            {
                if (User.AccessLevel >= AutoPvP.Access)
                {
                    list.AppendEntry(
                        new ListGumpEntry(
                            "Edit Options",
                            b =>
                    {
                        Minimize();
                        User.SendGump(new PropertiesGump(User, Selected));
                    },
                            HighlightHue));

                    list.AppendEntry(
                        new ListGumpEntry(
                            "Delete",
                            b =>
                    {
                        if (UseConfirmDialog)
                        {
                            Send(
                                new ConfirmDialogGump(
                                    User,
                                    this,
                                    title: "Delete Team?",
                                    html:
                                    "All data associated with this team will be deleted.\nThis action can not be reversed!\nDo you want to continue?",
                                    onAccept: OnConfirmDeleteTeam));
                        }
                        else
                        {
                            OnConfirmDeleteTeam(b);
                        }
                    },
                            HighlightHue));
                }

                PvPTeam team;

                if (Selected.Battle.IsParticipant(User, out team))
                {
                    if (team == Selected)
                    {
                        list.AppendEntry(new ListGumpEntry("Quit & Leave", b => Selected.Battle.Eject(User, true)));
                    }
                }
                else
                {
                    if (Selected.Battle.IsQueued(User))
                    {
                        if (Selected.Battle.Queue[User] == Selected)
                        {
                            list.AppendEntry(new ListGumpEntry("Leave Queue", b => Selected.Battle.Dequeue(User)));
                        }
                    }
                    else if (!Selected.Battle.AutoAssign && Selected.Battle.CanQueue(User))
                    {
                        list.AppendEntry(new ListGumpEntry("Join Queue", b => Selected.Battle.Enqueue(User, Selected)));
                    }
                }
            }

            base.CompileMenuOptions(list);
        }
Beispiel #9
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (User.AccessLevel >= AutoPvP.Access)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "View Season Schedule",
                        b => Send(new ScheduleOverviewGump(User, AutoPvP.SeasonSchedule, Hide(true))),
                        (User.AccessLevel >= AutoPvP.Access) ? HighlightHue : TextHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "Delete All",
                        b =>
                {
                    if (UseConfirmDialog)
                    {
                        Send(
                            new ConfirmDialogGump(
                                User,
                                this,
                                title: "Delete All Battles?",
                                html:
                                "All battles in the database will be deleted, erasing all data associated with them.\nThis action can not be reversed.\n\nDo you want to continue?",
                                onAccept: OnConfirmDeleteAllBattles));
                    }
                    else
                    {
                        OnConfirmDeleteAllBattles(b);
                    }
                },
                        HighlightHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "Internalize All",
                        b =>
                {
                    if (UseConfirmDialog)
                    {
                        Send(
                            new ConfirmDialogGump(
                                User,
                                this,
                                title: "Internalize All Battles?",
                                html:
                                "All battles in the database will be internalized, forcing them to end.\nThis action can not be reversed.\n\nDo you want to continue?",
                                onAccept: OnConfirmInternalizeAllBattles));
                    }
                    else
                    {
                        OnConfirmInternalizeAllBattles(b);
                    }
                },
                        HighlightHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "New Battle", b => Send(new PvPScenarioListGump(User, Hide(true), UseConfirmDialog)), HighlightHue));
            }

            base.CompileMenuOptions(list);
        }
Beispiel #10
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (User.AccessLevel >= AutoPvP.Access)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Delete All",
                        button => new ConfirmDialogGump(User, this)
                {
                    Title = "Delete All Profiles?",
                    Html  = "All profiles in the database will be deleted, erasing all data associated with them.\n" +
                            "This action can not be reversed.\n\nDo you want to continue?",
                    AcceptHandler = subButton =>
                    {
                        var profiles = new List <PvPProfile>(AutoPvP.Profiles.Values);

                        foreach (var p in profiles.Where(p => p != null && !p.Deleted))
                        {
                            p.Delete();
                        }

                        Refresh(true);
                    },
                    CancelHandler = Refresh
                }.Send(),
                        HighlightHue));
            }

            list.AppendEntry(new ListGumpEntry("My Profile", OnMyProfile));

            list.AppendEntry(
                new ListGumpEntry("Sort By (" + SortOrder + ")", b => new PvPProfilesSortUI(User, this, this, b).Send()));

            if (Season != null)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Overall Ranks",
                        b =>
                {
                    Season = null;
                    Refresh(true);
                }));
            }

            var season = AutoPvP.CurrentSeason;

            if (Season != season)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        String.Format("Season {0:#,0} Ranks", season.Number),
                        b =>
                {
                    Season = season;
                    Refresh(true);
                }));
            }

            if (season.Number > 1)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Select Season",
                        b => new InputDialogGump(User, this)
                {
                    Title     = "Select Season",
                    Html      = "Enter the number for the season you wish to view rankings for.\nSeasons 1 to " + season.Number,
                    InputText = Season == null ? "" : Season.Number.ToString(CultureInfo.InvariantCulture),
                    Callback  = (ib, text) =>
                    {
                        int num;

                        if (Int32.TryParse(text, out num))
                        {
                            PvPSeason s;

                            if (!AutoPvP.Seasons.TryGetValue(num, out s) || s == null)
                            {
                                User.SendMessage(ErrorHue, "Invalid Season selection.");
                            }
                            else
                            {
                                Season = s;
                            }
                        }

                        Refresh(true);
                    },
                    CancelHandler = Refresh
                }.Send()));
            }

            base.CompileMenuOptions(list);
        }
Beispiel #11
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (User.AccessLevel >= AutoPvP.Access)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Delete All",
                        b =>
                {
                    if (UseConfirmDialog)
                    {
                        Send(
                            new ConfirmDialogGump(
                                User,
                                this,
                                title: "Delete All Teams?",
                                html:
                                "All teams in the battle will be deleted, erasing all data associated with them.\nThis action can not be reversed.\n\nDo you want to continue?",
                                onAccept: OnConfirmDeleteAllTeams));
                    }
                    else
                    {
                        OnConfirmDeleteAllTeams(b);
                    }
                },
                        HighlightHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "New Team",
                        b =>
                        Send(
                            new InputDialogGump(
                                User,
                                this,
                                title: "Team Name",
                                html: "Enter a name for this team.\n255 Chars Max.",
                                input: NameList.RandomName("daemon"),
                                limit: 255,
                                callback: (b1, name) =>
                {
                    if (String.IsNullOrEmpty(name))
                    {
                        name = NameList.RandomName("daemon");
                    }

                    Battle.AddTeam(name, 1, 5, 11 + (List.Count + 1));
                    Refresh(true);
                })),
                        HighlightHue));
            }

            var user = User as PlayerMobile;

            if (user != null)
            {
                if (Battle.IsParticipant(user))
                {
                    list.AppendEntry(new ListGumpEntry("Quit & Leave", b => Battle.Eject(User, true)));
                }
                else
                {
                    if (Battle.IsQueued(user))
                    {
                        if (Battle.Queue[user] == Selected)
                        {
                            list.AppendEntry(new ListGumpEntry("Leave Queue", b => Battle.Dequeue(user)));
                        }
                    }
                    else if (!Battle.AutoAssign && Battle.CanQueue(user))
                    {
                        list.AppendEntry(new ListGumpEntry("Join Queue", b => Battle.Enqueue(user)));
                    }
                }
            }

            base.CompileMenuOptions(list);
        }
Beispiel #12
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (CanGlobalEdit())
            {
                if (GlobalEdit)
                {
                    list.AppendEntry(new ListGumpEntry("End Global Edit", b => EndGlobalEdit(), ErrorHue));

                    list.AppendEntry(
                        new ListGumpEntry(
                            "Set Default Size",
                            b =>
                            Send(
                                new InputDialogGump(
                                    User,
                                    this,
                                    title: "Set Default Size",
                                    html:
                                    "Set the global default size for all toolbars.\nFormat: Width,Height\n\nIf you shrink the size, any entires located beyond the new size will be lost.",
                                    input: String.Format("{0},{1}", Toolbars.CMOptions.DefaultWidth, Toolbars.CMOptions.DefaultHeight),
                                    callback: (cb, text) =>
                    {
                        int w = Toolbars.CMOptions.DefaultWidth, h = Toolbars.CMOptions.DefaultHeight;

                        if (text.IndexOf(",", StringComparison.Ordinal) != -1)
                        {
                            var split = text.Split(',');

                            if (!Int32.TryParse(split[0], out w))
                            {
                                w = Toolbars.CMOptions.DefaultWidth;
                            }

                            if (!Int32.TryParse(split[1], out h))
                            {
                                h = Toolbars.CMOptions.DefaultHeight;
                            }
                        }

                        Toolbars.CMOptions.DefaultWidth  = w;
                        Toolbars.CMOptions.DefaultHeight = h;
                        Refresh(true);
                    })),
                            HighlightHue));

                    list.AppendEntry(
                        new ListGumpEntry(
                            "Reset Global Entries",
                            b =>
                            Send(
                                new ConfirmDialogGump(
                                    User,
                                    this,
                                    title: "Reset Global Entries",
                                    html:
                                    "Applying global defaults will copy the global toolbar to all existing toolbars.\nThis will overwrite any custom entries that exist.\n\nDo you want to continue?",
                                    onAccept: db =>
                    {
                        Toolbars.SetGlobalEntries();
                        Refresh(true);
                    })),
                            HighlightHue));

                    list.AppendEntry(
                        new ListGumpEntry(
                            "Reset Global Sizes",
                            b =>
                            Send(
                                new ConfirmDialogGump(
                                    User,
                                    this,
                                    title: "Reset Global Sizes",
                                    html:
                                    "Applying global size will reset the size of all existing toolbars.\nAny entries located beyond the new size will be lost.\n\nDo you want to continue?",
                                    onAccept: db =>
                    {
                        Toolbars.SetGlobalSize();
                        Refresh(true);
                    })),
                            HighlightHue));
                }
                else
                {
                    list.AppendEntry(new ListGumpEntry("Begin Global Edit", b => BeginGlobalEdit(), HighlightHue));
                }
            }

            list.AppendEntry(
                new ListGumpEntry(
                    "Load Defaults",
                    b =>
                    Send(
                        new ConfirmDialogGump(
                            User,
                            this,
                            title: "Load Defaults",
                            html:
                            "Loadng the defaults will overwrite any custom entries that exist in your toolbar.\n\nDo you want to continue?",
                            onAccept: db =>
            {
                State.SetDefaultEntries();
                Refresh(true);
            })),
                    HighlightHue));

            list.AppendEntry(
                new ListGumpEntry(
                    "Set Position",
                    b => Send(
                        new OffsetSelectorGump(
                            User,
                            this,
                            new Point(State.X, State.Y),
                            (self, oldValue) =>
            {
                State.X = self.Value.X;
                State.Y = self.Value.Y;
                X       = State.X;
                Y       = State.Y;
                Refresh(true);
            })),
                    HighlightHue));

            list.AppendEntry(
                new ListGumpEntry(
                    "Set Size",
                    b =>
            {
                string html =
                    String.Format(
                        "Set the size for your toolbar.\nFormat: Width,Height\nWidth Range: {0}\nHeight Range: {1}\n\nIf you shrink the size, any entires located beyond the new size will be lost.",
                        String.Format("{0}-{1}", Toolbars.CMOptions.DefaultWidth, Toolbars.DefaultEntries.Width),
                        String.Format("{0}-{1}", Toolbars.CMOptions.DefaultHeight, Toolbars.DefaultEntries.Height));

                Send(
                    new InputDialogGump(
                        User,
                        this,
                        title: "Set Size",
                        html: html,
                        input: String.Format("{0},{1}", State.Width, State.Height),
                        callback: (cb, text) =>
                {
                    int w = State.Width, h = State.Height;

                    if (text.IndexOf(",", StringComparison.Ordinal) != -1)
                    {
                        var split = text.Split(',');

                        if (split.Length >= 2)
                        {
                            if (Int32.TryParse(split[0], out w))
                            {
                                if (w < Toolbars.CMOptions.DefaultWidth)
                                {
                                    w = Toolbars.CMOptions.DefaultWidth;
                                }
                                else if (!GlobalEdit && w > Toolbars.DefaultEntries.Width)
                                {
                                    w = Toolbars.DefaultEntries.Width;
                                }
                            }
                            else
                            {
                                w = State.Width;
                            }

                            if (Int32.TryParse(split[1], out h))
                            {
                                if (h < Toolbars.CMOptions.DefaultHeight)
                                {
                                    h = Toolbars.CMOptions.DefaultHeight;
                                }
                                else if (!GlobalEdit && h > Toolbars.DefaultEntries.Height)
                                {
                                    h = Toolbars.DefaultEntries.Height;
                                }
                            }
                            else
                            {
                                h = State.Height;
                            }
                        }
                    }

                    State.Resize(w, h);
                    Refresh(true);
                }));
            },
                    HighlightHue));

            list.AppendEntry(
                new ListGumpEntry(
                    "Set Theme",
                    b =>
            {
                MenuGumpOptions opts = new MenuGumpOptions();
                var themes           = Enum.GetValues(typeof(ToolbarTheme)).Cast <ToolbarTheme>();

                foreach (var themeID in themes)
                {
                    if (State.Theme == themeID)
                    {
                        continue;
                    }

                    ToolbarTheme id        = themeID;
                    ToolbarThemeBase theme = ToolbarThemes.GetTheme(themeID);
                    opts.AppendEntry(
                        new ListGumpEntry(
                            theme.Name,
                            tb =>
                    {
                        State.Theme = id;
                        Refresh(true);
                    },
                            HighlightHue));
                }

                Send(new MenuGump(User, this, opts, b));
            },
                    HighlightHue));

            base.CompileMenuOptions(list);

            list.RemoveEntry("New Search");
            list.RemoveEntry("Clear Search");

            list.Replace("Refresh", new ListGumpEntry("Exit", Close));
        }
Beispiel #13
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (User.AccessLevel >= AutoPvP.Access)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Remove All",
                        b =>
                {
                    if (UseConfirmDialog)
                    {
                        Send(
                            new ConfirmDialogGump(
                                User,
                                this,
                                title: "Remove All Doors?",
                                html:
                                "All doors in the list will be removed (not deleted).\nThis action can not be reversed.\n\nDo you want to continue?",
                                onAccept: OnConfirmRemoveAllDoors));
                    }
                    else
                    {
                        OnConfirmRemoveAllDoors(b);
                    }
                },
                        HighlightHue));

                list.AppendEntry(new ListGumpEntry("Add Door", b => SelectAddDoor(), HighlightHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "Open All",
                        b => List.ForEach(
                            door =>
                {
                    if (door == null || door.Deleted || door.Open)
                    {
                        return;
                    }

                    door.Open = true;

                    if (!door.UseChainedFunctionality)
                    {
                        return;
                    }

                    door.GetChain().ForEach(
                        chained =>
                    {
                        if (chained == null || chained.Deleted || chained.Open)
                        {
                            return;
                        }

                        chained.Open = true;
                    });
                }),
                        HighlightHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "Close All",
                        b => List.ForEach(
                            door =>
                {
                    if (door == null || door.Deleted || !door.Open)
                    {
                        return;
                    }

                    door.Open = false;

                    if (!door.UseChainedFunctionality)
                    {
                        return;
                    }

                    door.GetChain().ForEach(
                        chained =>
                    {
                        if (chained != null && !chained.Deleted && chained.Open)
                        {
                            chained.Open = false;
                        }
                    });
                }),
                        ErrorHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "Unlock All",
                        b => List.ForEach(
                            door =>
                {
                    if (door == null || door.Deleted || !door.Locked)
                    {
                        return;
                    }

                    door.Locked = false;

                    if (!door.UseChainedFunctionality)
                    {
                        return;
                    }

                    door.GetChain().ForEach(
                        chained =>
                    {
                        if (chained != null && !chained.Deleted && chained.Locked)
                        {
                            chained.Locked = false;
                        }
                    });
                }),
                        HighlightHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "Lock All",
                        b => List.ForEach(
                            door =>
                {
                    if (door == null || door.Deleted || door.Locked)
                    {
                        return;
                    }

                    door.Locked = true;

                    if (!door.UseChainedFunctionality)
                    {
                        return;
                    }

                    door.GetChain().ForEach(
                        chained =>
                    {
                        if (chained != null && !chained.Deleted && !chained.Locked)
                        {
                            chained.Locked = true;
                        }
                    });
                }),
                        ErrorHue));
            }

            base.CompileMenuOptions(list);
        }
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (Selected != null && User.AccessLevel >= Schedules.Access)
            {
                if (!Selected.Enabled)
                {
                    list.AppendEntry(
                        "Enable",
                        b =>
                    {
                        Selected.Enabled = true;
                        Refresh(true);
                    },
                        HighlightHue);
                }
                else
                {
                    list.AppendEntry(
                        "Disable",
                        b =>
                    {
                        Selected.Enabled = false;
                        Refresh(true);
                    },
                        HighlightHue);
                }

                if (Selected.IsLocal)
                {
                    list.AppendEntry(
                        "Use Universal Time",
                        b =>
                    {
                        Selected.IsLocal = false;
                        Refresh(true);
                    },
                        HighlightHue);
                }
                else
                {
                    list.AppendEntry(
                        "Use Local Time",
                        b =>
                    {
                        Selected.IsLocal = true;
                        Refresh(true);
                    },
                        HighlightHue);
                }

                list.AppendEntry("Edit Months", b => Send(new ScheduleMonthsMenuGump(User, Selected, Refresh(), b)), HighlightHue);
                list.AppendEntry("Edit Days", b => Send(new ScheduleDaysMenuGump(User, Selected, Refresh(), b)), HighlightHue);
                list.AppendEntry("Edit Times", b => Send(new SheduleTimeListGump(User, Selected, Hide(true))), HighlightHue);

                list.AppendEntry(
                    "Clear Schedule",
                    b =>
                {
                    if (UseConfirmDialog)
                    {
                        new ConfirmDialogGump(User, this)
                        {
                            Title = "Clear Schedule?",
                            Html  = "The schedule will be cleared, erasing all data associated with its entries.\n" +
                                    "This action can not be reversed.\n\nDo you want to continue?",
                            AcceptHandler = OnConfirmClearSchedule,
                            CancelHandler = Refresh
                        }.Send();
                    }
                    else
                    {
                        OnConfirmClearSchedule(b);
                    }
                },
                    HighlightHue);
            }

            base.CompileMenuOptions(list);
        }
Beispiel #15
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (Selected != null && !Selected.Deleted)
            {
                if (User.AccessLevel >= AutoPvP.Access)
                {
                    list.AppendEntry(
                        "Edit Options",
                        b =>
                    {
                        Minimize();

                        var pg = new PropertiesGump(User, Selected)
                        {
                            X = b.X,
                            Y = b.Y
                        };

                        User.SendGump(pg);
                    },
                        HighlightHue);

                    list.AppendEntry(
                        "Edit Advanced Options",
                        b =>
                    {
                        Minimize();

                        var pg = new PropertiesGump(User, Selected.Options)
                        {
                            X = b.X,
                            Y = b.Y
                        };

                        User.SendGump(pg);
                    },
                        HighlightHue);

                    if (Selected.State == PvPBattleState.Internal)
                    {
                        list.AppendEntry(
                            "Edit Spectate Region",
                            b =>
                        {
                            if (Selected.SpectateRegion == null)
                            {
                                Selected.SpectateRegion = RegionExtUtility.Create <PvPSpectateRegion>(Selected);
                            }

                            new PvPSpectateBoundsGump(User, Selected, Hide(true)).Send();
                        },
                            HighlightHue);

                        list.AppendEntry(
                            "Edit Battle Region",
                            b =>
                        {
                            if (Selected.BattleRegion == null)
                            {
                                Selected.BattleRegion = RegionExtUtility.Create <PvPBattleRegion>(Selected);
                            }

                            new PvPBattleBoundsGump(User, Selected, Hide(true)).Send();
                        },
                            HighlightHue);
                    }

                    list.AppendEntry(
                        "Edit Doors",
                        b => new PvPDoorsUI(User, Selected, Hide(true), UseConfirmDialog).Send(),
                        HighlightHue);

                    list.AppendEntry(
                        "Edit Description",
                        b => new TextInputPanelGump <PvPBattle>(User, Hide(true))
                    {
                        Title    = "Battle Description (HTML/BBC Supported)",
                        Input    = Selected.Description,
                        Limit    = 1000,
                        Callback = s =>
                        {
                            s = s.ParseBBCode();

                            if (!String.IsNullOrWhiteSpace(s))
                            {
                                Selected.Description = s;
                            }

                            Refresh(true);
                        }
                    }.Send(),
                        HighlightHue);
                }

                list.AppendEntry(
                    "View Schedule",
                    b => new ScheduleOverviewGump(User, Selected.Schedule, Hide(true)).Send(),
                    User.AccessLevel >= AutoPvP.Access ? HighlightHue : TextHue);

                if (User.AccessLevel >= AutoPvP.Access)
                {
                    list.AppendEntry(
                        "View Rules/Restrictions",
                        b =>
                    {
                        var opts = new MenuGumpOptions();

                        opts.AppendEntry(
                            "Inherit Rules/Restrictions",
                            b2 =>
                        {
                            var opts2 = new MenuGumpOptions();

                            foreach (var ba in AutoPvP.Battles.Values.Where(ba => ba != Selected))
                            {
                                opts2.AppendEntry(
                                    ba.Name,
                                    () =>
                                {
                                    Selected.Options.Rules.CopyFrom(ba.Options.Rules);

                                    Selected.Options.Restrictions.Items.List =                                                             //
                                                                               new Dictionary <Type, bool>(ba.Options.Restrictions.Items.List);

                                    Selected.Options.Restrictions.Pets.List =                                                             //
                                                                              new Dictionary <Type, bool>(ba.Options.Restrictions.Pets.List);

                                    Selected.Options.Restrictions.Spells.List =                                                             //
                                                                                new Dictionary <Type, bool>(ba.Options.Restrictions.Spells.List);

                                    Selected.Options.Restrictions.Skills.List =                                                             //
                                                                                new Dictionary <int, bool>(ba.Options.Restrictions.Skills.List);

                                    Refresh(true);
                                });
                            }

                            new MenuGump(User, this, opts2, b).Send();
                        });

                        opts.AppendEntry(
                            new ListGumpEntry(
                                "Rules",
                                mb =>
                        {
                            Refresh();

                            var g = new PropertiesGump(User, Selected.Options.Rules)
                            {
                                X = mb.X,
                                Y = mb.Y
                            };

                            User.SendGump(g);
                        }));

                        opts.AppendEntry(
                            "Items",
                            mb => new PvPRestrictItemsListGump(User, Selected.Options.Restrictions.Items, Hide(true)).Send());

                        opts.AppendEntry(
                            "Pets",
                            mb => new PvPRestrictPetsListGump(User, Selected.Options.Restrictions.Pets, Hide(true)).Send());

                        opts.AppendEntry(
                            "Skills",
                            mb => new PvPRestrictSkillsListGump(User, Selected.Options.Restrictions.Skills, Hide(true)).Send());

                        opts.AppendEntry(
                            "Spells",
                            mb => new PvPRestrictSpellsListGump(User, Selected.Options.Restrictions.Spells, Hide(true)).Send());

                        new MenuGump(User, this, opts, b).Send();
                    },
                        User.AccessLevel >= AutoPvP.Access ? HighlightHue : TextHue);

                    list.AppendEntry(
                        "Reset Statistics",
                        b =>
                    {
                        if (UseConfirmDialog)
                        {
                            new ConfirmDialogGump(User, this)
                            {
                                Title = "Reset Battle Statistics?",
                                Html  = "All data associated with the battle statistics will " +
                                        "be transferred to player profiles then cleared.\nThis action can not be reversed!\n" +
                                        "Do you want to continue?",
                                AcceptHandler = OnConfirmResetStatistics,
                                CancelHandler = Refresh
                            }.Send();
                        }
                        else
                        {
                            OnConfirmResetStatistics(b);
                        }
                    },
                        HighlightHue);

                    if (Selected.State == PvPBattleState.Internal)
                    {
                        if (Selected.Validate(User))
                        {
                            list.AppendEntry(
                                "Publish",
                                b =>
                            {
                                Selected.State = PvPBattleState.Queueing;

                                Refresh(true);
                            },
                                HighlightHue);
                        }
                    }
                    else
                    {
                        list.AppendEntry(
                            "Internalize",
                            b =>
                        {
                            Selected.State = PvPBattleState.Internal;

                            Refresh(true);
                        },
                            HighlightHue);

                        if (!Selected.Hidden)
                        {
                            if (Selected.Validate(User))
                            {
                                list.AppendEntry(
                                    "Hide",
                                    b =>
                                {
                                    Selected.Hidden = true;

                                    Refresh(true);
                                },
                                    HighlightHue);
                            }
                        }
                        else
                        {
                            list.AppendEntry(
                                "Unhide",
                                b =>
                            {
                                Selected.Hidden = false;

                                Refresh(true);
                            },
                                HighlightHue);
                        }
                    }

                    list.AppendEntry(
                        "Delete",
                        b =>
                    {
                        if (UseConfirmDialog)
                        {
                            new ConfirmDialogGump(User, this)
                            {
                                Title = "Delete Battle?",
                                Html  = "All data associated with this battle will be deleted.\n" +
                                        "This action can not be reversed!\nDo you want to continue?",
                                AcceptHandler = OnConfirmDeleteBattle,
                                CancelHandler = Refresh
                            }.Send();
                        }
                        else
                        {
                            OnConfirmDeleteBattle(b);
                        }
                    },
                        HighlightHue);
                }

                list.AppendEntry(
                    "Command List",
                    b =>
                {
                    var html = new StringBuilder();

                    Selected.GetHtmlCommandList(User, html);

                    new HtmlPanelGump <PvPBattle>(User, this)
                    {
                        Title    = "Command List",
                        Html     = html.ToString(),
                        Selected = Selected
                    }.Send();
                });

                var profile = AutoPvP.EnsureProfile(User as PlayerMobile);

                if (profile != null && !profile.Deleted)
                {
                    if (profile.IsSubscribed(Selected))
                    {
                        list.AppendEntry(
                            "Unsubscribe",
                            b =>
                        {
                            profile.Unsubscribe(Selected);

                            User.SendMessage("You have unsubscribed from {0} notifications.", Selected.Name);

                            Refresh(true);
                        });
                    }
                    else
                    {
                        list.AppendEntry(
                            "Subscribe",
                            b =>
                        {
                            if (UseConfirmDialog)
                            {
                                new ConfirmDialogGump(User, this)
                                {
                                    Title = "Subscriptions",
                                    Html  = "Subscribing to a battle allows you to see its world broadcast notifications.\n\n" +
                                            "Do you want to subscribe to " + Selected.Name + "?",
                                    AcceptHandler = OnConfirmSubscribe,
                                    CancelHandler = Refresh
                                }.Send();
                            }
                            else
                            {
                                OnConfirmSubscribe(b);
                            }
                        });
                    }
                }

                if (User is PlayerMobile)
                {
                    var user = (PlayerMobile)User;

                    if (Selected.IsParticipant(user))
                    {
                        list.AppendEntry("Quit & Leave", b => Selected.Quit(user, true));
                    }
                    else
                    {
                        if (Selected.IsQueued(user))
                        {
                            list.AppendEntry("Leave Queue", b => Selected.Dequeue(user));
                        }
                        else if (Selected.CanQueue(user))
                        {
                            list.AppendEntry("Join Queue", b => Selected.Enqueue(user));
                        }

                        if (Selected.IsSpectator(user))
                        {
                            list.AppendEntry("Leave Spectators", b => Selected.RemoveSpectator(user, true));
                        }
                        else if (Selected.CanSpectate(user))
                        {
                            list.AppendEntry("Join Spectators", b => Selected.AddSpectator(user, true));
                        }
                    }
                }
            }

            base.CompileMenuOptions(list);
        }
Beispiel #16
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (Selected != null && !Selected.Deleted)
            {
                if (User.AccessLevel >= AutoPvP.Access)
                {
                    list.AppendEntry(
                        new ListGumpEntry(
                            "Edit Options",
                            b =>
                    {
                        Minimize();
                        User.SendGump(
                            new PropertiesGump(User, Selected)
                        {
                            X = b.X,
                            Y = b.Y
                        });
                    },
                            HighlightHue));

                    list.AppendEntry(
                        new ListGumpEntry(
                            "Edit Advanced Options",
                            b =>
                    {
                        Minimize();
                        User.SendGump(
                            new PropertiesGump(User, Selected.Options)
                        {
                            X = b.X,
                            Y = b.Y
                        });
                    },
                            HighlightHue));

                    if (Selected.State == PvPBattleState.Internal)
                    {
                        list.AppendEntry(
                            new ListGumpEntry(
                                "Edit Spectate Region",
                                b =>
                        {
                            if (Selected.SpectateRegion == null)
                            {
                                Selected.SpectateRegion = RegionExtUtility.Create <PvPSpectateRegion>(Selected);
                            }

                            Send(new PvPSpectateBoundsGump(User, Selected, Hide(true)));
                        },
                                HighlightHue));

                        list.AppendEntry(
                            new ListGumpEntry(
                                "Edit Battle Region",
                                b =>
                        {
                            if (Selected.BattleRegion == null)
                            {
                                Selected.BattleRegion = RegionExtUtility.Create <PvPBattleRegion>(Selected);
                            }

                            Send(new PvPBattleBoundsGump(User, Selected, Hide(true)));
                        },
                                HighlightHue));
                    }

                    list.AppendEntry(
                        new ListGumpEntry(
                            "Edit Doors", b => Send(new PvPDoorListGump(User, Selected, Hide(true), UseConfirmDialog)), HighlightHue));

                    list.AppendEntry(
                        new ListGumpEntry(
                            "Edit Description",
                            b =>
                            Send(
                                new TextInputPanelGump <PvPBattle>(
                                    User,
                                    Hide(true),
                                    title: "Battle Description (HTML/BBC Supported)",
                                    input: Selected.Description,
                                    limit: 1000,
                                    callback: s =>
                    {
                        s = s.ParseBBCode();

                        if (!String.IsNullOrWhiteSpace(s))
                        {
                            Selected.Description = s;
                        }

                        Refresh(true);
                    })),
                            HighlightHue));
                }

                list.AppendEntry(
                    new ListGumpEntry(
                        "View Schedule",
                        b => Send(new ScheduleOverviewGump(User, Selected.Schedule, Hide(true))),
                        (User.AccessLevel >= AutoPvP.Access) ? HighlightHue : TextHue));

                list.AppendEntry(
                    new ListGumpEntry(
                        "View Teams",
                        b => Send(new PvPTeamListGump(User, Selected, Hide(true))),
                        (User.AccessLevel >= AutoPvP.Access) ? HighlightHue : TextHue));

                if (User.AccessLevel >= AutoPvP.Access)
                {
                    list.AppendEntry(
                        new ListGumpEntry(
                            "View Rules/Restrictions",
                            b =>
                    {
                        MenuGumpOptions opts = new MenuGumpOptions();

                        opts.AppendEntry(
                            new ListGumpEntry(
                                "Inherit Rules/Restrictions",
                                b2 =>
                        {
                            MenuGumpOptions opts2 = new MenuGumpOptions();

                            AutoPvP.Battles.Values.Where(ba => ba != Selected)
                            .ForEach(
                                ba => opts2.AppendEntry(
                                    new ListGumpEntry(
                                        ba.Name,
                                        () =>
                            {
                                var rulesA = Selected.Options.Rules;
                                var rulesB = ba.Options.Rules;

                                rulesA.AllowBeneficial    = rulesB.AllowBeneficial;
                                rulesA.AllowHarmful       = rulesB.AllowHarmful;
                                rulesA.AllowHousing       = rulesB.AllowHousing;
                                rulesA.AllowPets          = rulesB.AllowPets;
                                rulesA.AllowSpawn         = rulesB.AllowSpawn;
                                rulesA.AllowSpeech        = rulesB.AllowSpeech;
                                rulesA.CanBeDamaged       = rulesB.CanBeDamaged;
                                rulesA.CanDamageEnemyTeam = rulesB.CanDamageEnemyTeam;
                                rulesA.CanDamageOwnTeam   = rulesB.CanDamageOwnTeam;
                                rulesA.CanDie             = rulesB.CanDie;
                                rulesA.CanHeal            = rulesB.CanHeal;
                                rulesA.CanHealEnemyTeam   = rulesB.CanHealEnemyTeam;
                                rulesA.CanHealOwnTeam     = rulesB.CanHealOwnTeam;
                                rulesA.CanMount           = rulesB.CanMount;
                                rulesA.CanMoveThrough     = rulesB.CanMoveThrough;
                                rulesA.CanMountEthereal   = rulesB.CanMountEthereal;
                                rulesA.CanResurrect       = rulesB.CanResurrect;
                                rulesA.CanUseStuckMenu    = rulesB.CanUseStuckMenu;

                                Selected.Options.Restrictions.Items.List =
                                    new Dictionary <Type, bool>(ba.Options.Restrictions.Items.List);

                                Selected.Options.Restrictions.Pets.List =
                                    new Dictionary <Type, bool>(ba.Options.Restrictions.Pets.List);

                                Selected.Options.Restrictions.Spells.List =
                                    new Dictionary <Type, bool>(ba.Options.Restrictions.Spells.List);

                                Selected.Options.Restrictions.Skills.List =
                                    new Dictionary <int, bool>(ba.Options.Restrictions.Skills.List);

                                Refresh(true);
                            })));

                            Send(new MenuGump(User, this, opts2, b));
                        }));

                        opts.AppendEntry(
                            new ListGumpEntry(
                                "Rules",
                                mb =>
                        {
                            Refresh();

                            PropertiesGump g = new PropertiesGump(User, Selected.Options.Rules)
                            {
                                X = mb.X,
                                Y = mb.Y
                            };
                            User.SendGump(g);
                        }));

                        opts.AppendEntry(
                            new ListGumpEntry(
                                "Items", mb => Send(new PvPRestrictItemsListGump(User, Selected.Options.Restrictions.Items, Hide(true)))));

                        opts.AppendEntry(
                            new ListGumpEntry(
                                "Pets", mb => Send(new PvPRestrictPetsListGump(User, Selected.Options.Restrictions.Pets, Hide(true)))));

                        opts.AppendEntry(
                            new ListGumpEntry(
                                "Skills", mb => Send(new PvPRestrictSkillsListGump(User, Selected.Options.Restrictions.Skills, Hide(true)))));

                        opts.AppendEntry(
                            new ListGumpEntry(
                                "Spells", mb => Send(new PvPRestrictSpellsListGump(User, Selected.Options.Restrictions.Spells, Hide(true)))));

                        Send(new MenuGump(User, this, opts, b));
                    },
                            (User.AccessLevel >= AutoPvP.Access) ? HighlightHue : TextHue));

                    list.AppendEntry(
                        new ListGumpEntry(
                            "Reset Statistics",
                            b =>
                    {
                        if (UseConfirmDialog)
                        {
                            Send(
                                new ConfirmDialogGump(
                                    User,
                                    this,
                                    title: "Reset Battle Statistics?",
                                    html:
                                    "All data associated with the battle statistics will be transferred to player profiles then cleared.\nThis action can not be reversed!\nDo you want to continue?",
                                    onAccept: OnConfirmResetStatistics));
                        }
                        else
                        {
                            OnConfirmResetStatistics(b);
                        }
                    },
                            HighlightHue));

                    if (Selected.State == PvPBattleState.Internal)
                    {
                        if (Selected.Validate(User))
                        {
                            list.AppendEntry(
                                new ListGumpEntry(
                                    "Publish",
                                    b =>
                            {
                                Selected.State = PvPBattleState.Queueing;
                                Refresh(true);
                            },
                                    HighlightHue));
                        }
                    }
                    else
                    {
                        list.AppendEntry(
                            new ListGumpEntry(
                                "Internalize",
                                b =>
                        {
                            Selected.State = PvPBattleState.Internal;
                            Refresh(true);
                        },
                                HighlightHue));

                        if (!Selected.Hidden)
                        {
                            if (Selected.Validate(User))
                            {
                                list.AppendEntry(
                                    new ListGumpEntry(
                                        "Hide",
                                        b =>
                                {
                                    Selected.Hidden = true;
                                    Refresh(true);
                                },
                                        HighlightHue));
                            }
                        }
                        else
                        {
                            list.AppendEntry(
                                new ListGumpEntry(
                                    "Unhide",
                                    b =>
                            {
                                Selected.Hidden = false;
                                Refresh(true);
                            },
                                    HighlightHue));
                        }
                    }

                    list.AppendEntry(
                        new ListGumpEntry(
                            "Delete",
                            b =>
                    {
                        if (UseConfirmDialog)
                        {
                            Send(
                                new ConfirmDialogGump(
                                    User,
                                    this,
                                    title: "Delete Battle?",
                                    html:
                                    "All data associated with this battle will be deleted.\nThis action can not be reversed!\nDo you want to continue?",
                                    onAccept: OnConfirmDeleteBattle));
                        }
                        else
                        {
                            OnConfirmDeleteBattle(b);
                        }
                    },
                            HighlightHue));
                }

                list.AppendEntry(
                    new ListGumpEntry(
                        "Command List",
                        b =>
                {
                    StringBuilder html = new StringBuilder();
                    Selected.GetHtmlCommandList(User, html);
                    new HtmlPanelGump <PvPBattle>(User, this, title: "Command List", html: html.ToString(), selected: Selected).Send();
                }));

                PvPProfile profile = AutoPvP.EnsureProfile(User);

                if (profile != null && !profile.Deleted)
                {
                    if (profile.IsSubscribed(Selected))
                    {
                        list.AppendEntry(
                            new ListGumpEntry(
                                "Unsubscribe",
                                b =>
                        {
                            profile.Unsubscribe(Selected);
                            User.SendMessage("You have unsubscribed from {0} notifications.", Selected.Name);
                            Refresh(true);
                        }));
                    }
                    else
                    {
                        list.AppendEntry(
                            new ListGumpEntry(
                                "Subscribe",
                                b =>
                        {
                            if (UseConfirmDialog)
                            {
                                Send(
                                    new ConfirmDialogGump(
                                        User,
                                        this,
                                        title: "Subscriptions",
                                        html:
                                        "Subscribing to a battle allows you to see its world broadcast notifications.\n\nDo you want to subscribe to " +
                                        Selected.Name + "?",
                                        onAccept: OnConfirmSubscribe));
                            }
                            else
                            {
                                OnConfirmSubscribe(b);
                            }
                        }));
                    }
                }

                if (Selected.IsParticipant(User))
                {
                    list.AppendEntry(new ListGumpEntry("Quit & Leave", b => Selected.Eject(User, true)));
                }
                else
                {
                    if (Selected.IsQueued(User))
                    {
                        list.AppendEntry(new ListGumpEntry("Leave Queue", b => Selected.Dequeue(User)));
                    }
                    else if (Selected.CanQueue(User))
                    {
                        list.AppendEntry(new ListGumpEntry("Join Queue", b => Selected.Enqueue(User)));
                    }

                    if (Selected.IsSpectator(User))
                    {
                        list.AppendEntry(new ListGumpEntry("Leave Spectators", b => Selected.RemoveSpectator(User, true)));
                    }
                    else if (Selected.CanSpectate(User))
                    {
                        list.AppendEntry(new ListGumpEntry("Join Spectators", b => Selected.AddSpectator(User, true)));
                    }
                }
            }

            base.CompileMenuOptions(list);
        }
Beispiel #17
0
        protected override void CompileMenuOptions(MenuGumpOptions list)
        {
            list.Clear();

            if (User.AccessLevel >= AutoPvP.Access)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Delete All",
                        button =>
                        Send(
                            new ConfirmDialogGump(
                                User,
                                this,
                                title: "Delete All Profiles?",
                                html:
                                "All profiles in the database will be deleted, erasing all data associated with them.\nThis action can not be reversed.\n\nDo you want to continue?",
                                onAccept: subButton =>
                {
                    var profiles = new List <PvPProfile>(AutoPvP.Profiles.Values);

                    foreach (PvPProfile p in profiles.Where(p => p != null && !p.Deleted))
                    {
                        p.Delete();
                    }

                    Refresh(true);
                })),
                        HighlightHue));
            }

            list.AppendEntry(new ListGumpEntry("My Profile", OnMyProfile));

            list.AppendEntry(
                new ListGumpEntry("Sort By (" + RankSortOrder + ")", b => Send(new PvPProfileListSortGump(User, this, this, b))));

            if (Season != null)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Overall Ranks",
                        b =>
                {
                    Season = null;
                    Refresh(true);
                }));

                if (!Season.Active && User.AccessLevel >= AutoPvP.Access)
                {
                    list.AppendEntry(
                        new ListGumpEntry(
                            "Issue Winner Rewards",
                            b => Season.Winners.Keys.Select(m => AutoPvP.EnsureProfile(m)).ForEach(
                                p =>
                    {
                        Season.IssueWinnerRewards(p);
                        Refresh();
                    })));

                    list.AppendEntry(
                        new ListGumpEntry(
                            "Issue Loser Rewards",
                            b => Season.Losers.Keys.Select(m => AutoPvP.EnsureProfile(m)).ForEach(
                                p =>
                    {
                        Season.IssueLoserRewards(p);
                        Refresh();
                    })));
                }
            }

            PvPSeason season = AutoPvP.CurrentSeason;

            if (Season != season)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Season " + season.Number + " Ranks",
                        b =>
                {
                    Season = season;
                    Refresh(true);
                }));
            }

            if (season.Number > 1)
            {
                list.AppendEntry(
                    new ListGumpEntry(
                        "Select Season",
                        b =>
                        Send(
                            new InputDialogGump(
                                User,
                                this,
                                title: "Select Season",
                                html: "Enter the number for the season you wish to view rankings for.\nSeasons 1 to " + season.Number,
                                input: Season == null ? "" : Season.Number.ToString(CultureInfo.InvariantCulture),
                                callback: (ib, text) =>
                {
                    int num;

                    if (Int32.TryParse(text, out num))
                    {
                        if ((Season = (AutoPvP.Seasons.ContainsKey(num) ? AutoPvP.Seasons[num] : null)) == null)
                        {
                            User.SendMessage(ErrorHue, "Invalid Season selection.");
                        }
                    }

                    Refresh(true);
                }))));
            }

            base.CompileMenuOptions(list);
        }