コード例 #1
0
ファイル: Notoriety.cs プロジェクト: zerodowned/Core
        public static int MobileNotoriety(Mobile a, Mobile b)
        {
            if (_NotorietyParent == null)
            {
                return(NotorietyHandlers.MobileNotoriety(a, b));
            }

            if (a == null || a.Deleted || b == null || b.Deleted || a == b)
            {
                return(_NotorietyParent(a, b));
            }

            if (a is PlayerMobile && b is PlayerMobile)
            {
                PlayerMobile x = (PlayerMobile)a, y = (PlayerMobile)b;
                PvPBattle    battleA = AutoPvP.FindBattle(x), battleB = AutoPvP.FindBattle(y);

                if (battleA == null || battleA.Deleted || battleB == null || battleB.Deleted || battleA != battleB || x == y)
                {
                    return(_NotorietyParent(x, y));
                }

                var battle = battleA;

                if (_NameHandlers.ContainsKey(battle) && _NameHandlers[battle] != null)
                {
                    var val = _NameHandlers[battle](x, y);

                    if (val == Bubble)
                    {
                        val = _NotorietyParent(x, y);
                    }

                    return(val);
                }
            }

            return(_NotorietyParent(a, b));
        }
コード例 #2
0
        public PvPProfileHistory(PvPProfile owner, params PvPProfileHistoryEntry[] entries)
            : this(owner)
        {
            if (entries == null)
            {
                Entries = new Dictionary <int, PvPProfileHistoryEntry>();
            }
            else
            {
                Entries = new Dictionary <int, PvPProfileHistoryEntry>(entries.Length);

                foreach (var entry in entries)
                {
                    var season = AutoPvP.EnsureSeason(entry.Season);

                    if (season != null)
                    {
                        Entries[season.Number] = entry;
                    }
                }
            }
        }
コード例 #3
0
        public void Eject(PlayerMobile pm, bool teleport)
        {
            if (pm == null || pm.Deleted)
            {
                return;
            }

            PvPTeam team;

            if (IsParticipant(pm, out team))
            {
                if (State == PvPBattleState.Running || State == PvPBattleState.Ended)
                {
                    EnsureStatistics(pm).Battles = 1;

                    if (State == PvPBattleState.Running)
                    {
                        EnsureStatistics(pm).Losses = 1;

                        int points = GetAwardPoints(team, pm);

                        EnsureStatistics(pm).PointsLost  += points;
                        AutoPvP.EnsureProfile(pm).Points -= points;
                    }
                }

                team.RemoveMember(pm, false);
            }
            else if (IsSpectator(pm))
            {
                RemoveSpectator(pm, false);
            }

            if (teleport)
            {
                Teleport(pm, Options.Locations.Eject, Options.Locations.Eject.Map);
            }
        }
コード例 #4
0
ファイル: Battle_Messages.cs プロジェクト: thehaunted88/Core
        public virtual void LocalBroadcast(string message, params object[] args)
        {
            var text = String.Format(message, args);

            if (String.IsNullOrWhiteSpace(text))
            {
                return;
            }

            if (Options.Broadcasts.Local.Mode == PvPBattleLocalBroadcastMode.Disabled)
            {
                return;
            }

            AutoPvP.InvokeBattleLocalBroadcast(this, text);

            PvPTeam team;

            foreach (var pm in GetLocalBroadcastList())
            {
                pm.SendMessage(IsParticipant(pm, out team) ? team.Color : Options.Broadcasts.Local.MessageHue, text);
            }
        }
コード例 #5
0
ファイル: PvPProfileUI.cs プロジェクト: thehaunted88/Core
        protected virtual void OnDeleteProfile(GumpButton button)
        {
            if (Selected == null || Selected.Deleted)
            {
                Selected = AutoPvP.EnsureProfile(User as PlayerMobile);
            }

            if (UseConfirmDialog)
            {
                new ConfirmDialogGump(User, Refresh())
                {
                    Title = "Delete Profile?",
                    Html  = "All data associated with this profile will be deleted.\n" +
                            "This action can not be reversed!\nDo you want to continue?",
                    AcceptHandler = OnConfirmDeleteProfile,
                    CancelHandler = Refresh
                }.Send();
            }
            else
            {
                OnConfirmDeleteProfile(button);
            }
        }
コード例 #6
0
ファイル: Battle_Regions.cs プロジェクト: AllanNisbet/runuo
        public virtual void OnEnter(PvPRegion region, Mobile m)
        {
            if (region == null || m == null || m.Deleted)
            {
                return;
            }

            if (region.IsPartOf(BattleRegion) && m.InRegion(BattleRegion))
            {
                var pm = m as PlayerMobile;

                if (pm != null)
                {
                    pm.SendMessage("You have entered {0}", Name);
                }

                AutoPvP.InvokeEnterBattle(this, region, m);
            }
            else if (region.IsPartOf(SpectateRegion) && m.InRegion(SpectateRegion))
            {
                var pm = m as PlayerMobile;

                if (pm != null)
                {
                    pm.SendMessage("You have entered {0} spectator area.", Name);

                    if (!IsSpectator(pm))
                    {
                        AddSpectator(pm, false);
                    }
                }

                AutoPvP.InvokeEnterBattle(this, region, m);
            }

            m.Delta(MobileDelta.Noto);
        }
コード例 #7
0
ファイル: ProfileOverview.cs プロジェクト: uotools/JustUO
        protected virtual void OnDeleteProfile(GumpButton button)
        {
            if (Selected == null || Selected.Deleted)
            {
                Selected = AutoPvP.EnsureProfile(User);
            }

            if (UseConfirmDialog)
            {
                Send(
                    new ConfirmDialogGump(
                        User,
                        Refresh(),
                        title: "Delete Profile?",
                        html:
                        "All data associated with this profile will be deleted.\nThis action can not be reversed!\nDo you want to continue?",
                        onAccept: OnConfirmDeleteProfile));
            }
            else
            {
                Selected.Delete();
                Close();
            }
        }
コード例 #8
0
ファイル: ProfileOverview.cs プロジェクト: uotools/JustUO
        protected virtual void OnResetStatistics(GumpButton button)
        {
            if (Selected == null || Selected.Deleted)
            {
                Selected = AutoPvP.EnsureProfile(User);
            }

            if (UseConfirmDialog)
            {
                Send(
                    new ConfirmDialogGump(
                        User,
                        Refresh(),
                        title: "Reset Profile Statistics?",
                        html:
                        "All data associated with the profile statistics will be lost.\nThis action can not be reversed!\nDo you want to continue?",
                        onAccept: OnConfirmResetStatistics));
            }
            else
            {
                Selected.History.Entries.Clear();
                Refresh(true);
            }
        }
コード例 #9
0
ファイル: Profile.cs プロジェクト: zerodowned/Core
        public void Deserialize(GenericReader reader)
        {
            var version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                Deleted = reader.ReadBool();
                Owner   = reader.ReadMobile <PlayerMobile>();
                _Points = reader.ReadLong();

                reader.ReadBlock(r => _History = r.ReadTypeCreate <PvPProfileHistory>(this, r) ?? new PvPProfileHistory(this, r));

                Subscriptions = reader.ReadBlockList(
                    r =>
                    {
                        var serial = r.ReadTypeCreate <PvPSerial>(r) ?? new PvPSerial(r);
                        return(AutoPvP.FindBattleByID(serial));
                    });
            }
            break;
            }
        }
コード例 #10
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);
        }
コード例 #11
0
ファイル: Profile.cs プロジェクト: zerodowned/Core
 public int GetRank(PvPSeason season = null)
 {
     return(AutoPvP.GetProfileRank(Owner, AutoPvP.CMOptions.Advanced.Profiles.RankingOrder, season));
 }
コード例 #12
0
ファイル: Battle_Messages.cs プロジェクト: thehaunted88/Core
        public virtual void WorldBroadcast(string message, params object[] args)
        {
            var text = String.Format(message, args);

            if (String.IsNullOrWhiteSpace(text))
            {
                return;
            }

            if (Options.Broadcasts.World.Mode == PvPBattleWorldBroadcastMode.Disabled)
            {
                return;
            }

            AutoPvP.InvokeBattleWorldBroadcast(this, text);

            switch (Options.Broadcasts.World.Mode)
            {
            case PvPBattleWorldBroadcastMode.Notify:
            {
                foreach (var pm in GetWorldBroadcastList())
                {
                    pm.SendNotification(text, true, 0.5, 10.0);
                }
            }
            break;

            case PvPBattleWorldBroadcastMode.Broadcast:
            {
                var p = new AsciiMessage(
                    Server.Serial.MinusOne,
                    -1,
                    MessageType.Regular,
                    Options.Broadcasts.World.MessageHue,
                    3,
                    "System",
                    text);

                p.Acquire();

                foreach (var pm in GetWorldBroadcastList())
                {
                    pm.Send(p);
                }

                p.Release();

                NetState.FlushAll();
            }
            break;

            case PvPBattleWorldBroadcastMode.TownCrier:
            {
                foreach (var tc in TownCrier.Instances)
                {
                    tc.PublicOverheadMessage(
                        MessageType.Yell,
                        Options.Broadcasts.World.MessageHue,
                        true,
                        String.Format(message, args));
                }
            }
            break;
            }
        }
コード例 #13
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);
        }
コード例 #14
0
        public virtual bool InOtherBattle(PlayerMobile pm)
        {
            PvPBattle battle = AutoPvP.FindBattle(pm);

            return(battle != null && battle != this && battle.IsParticipant(pm));
        }
コード例 #15
0
 protected virtual void OnMyProfile(GumpButton button)
 {
     new PvPProfileUI(User, AutoPvP.EnsureProfile(User as PlayerMobile), Hide(true)).Send();
 }
コード例 #16
0
ファイル: Battle.cs プロジェクト: thehaunted88/Core
        public void Delete()
        {
            if (Deleted)
            {
                return;
            }

            Reset();

            if (_CoreTimer != null)
            {
                _CoreTimer.Dispose();
                _CoreTimer = null;
            }

            _CoreTicks = 0;

            if (Gate != null)
            {
                Gate.Delete();
                Gate = null;
            }

            ForEachTeam(t => t.Delete());

            if (Schedule != null)
            {
                Schedule.Stop();
                Schedule.Enabled       = false;
                Schedule.OnGlobalTick -= OnScheduleTick;
                Schedule = null;
            }

            if (_BattleRegion != null)
            {
                _BattleRegion.ClearPreview();
                _BattleRegion.Unregister();
                _BattleRegion = null;
            }

            if (_SpectateRegion != null)
            {
                _SpectateRegion.ClearPreview();
                _SpectateRegion.Unregister();
                _SpectateRegion = null;
            }

            if (Options != null)
            {
                Options.Clear();
            }

            OnDeleted();

            if (AutoPvP.RemoveBattle(this))
            {
                OnRemoved();
            }

            Deleted = true;
        }
コード例 #17
0
ファイル: ProfileList.cs プロジェクト: LordEnigma/UO
 protected virtual void OnMyProfile(GumpButton button)
 {
     Send(new PvPProfileOverviewGump(User, AutoPvP.EnsureProfile(User), Hide(true)));
 }
コード例 #18
0
 protected virtual void OnConfirmDeleteAllBattles(GumpButton button)
 {
     AutoPvP.DeleteAllBattles();
     Refresh(true);
 }
コード例 #19
0
 protected virtual void OnConfirmInternalizeAllBattles(GumpButton button)
 {
     AutoPvP.InternalizeAllBattles();
     Refresh(true);
 }
コード例 #20
0
ファイル: Battle.cs プロジェクト: AllanNisbet/runuo
        public void Delete()
        {
            if (Deleted)
            {
                return;
            }

            Reset();

            EventSink.Shutdown -= ServerShutdownHandler;
            EventSink.Logout   -= LogoutHandler;
            EventSink.Login    -= LoginHandler;

            if (_CoreTimer != null)
            {
                _CoreTimer.Dispose();
                _CoreTimer = null;
            }

            _CoreTicks = 0;

            if (Gate != null)
            {
                Gate.Delete();
                Gate = null;
            }

            Teams.Where(t => t != null && !t.Deleted).ForEach(t => t.Delete());

            if (Schedule != null)
            {
                Schedule.Stop();
                Schedule.Enabled       = false;
                Schedule.OnGlobalTick -= OnScheduleTick;
                Schedule = null;
            }

            if (_BattleRegion != null)
            {
                _BattleRegion.ClearPreview();
                _BattleRegion.Unregister();
                _BattleRegion = null;
            }

            if (_SpectateRegion != null)
            {
                _SpectateRegion.ClearPreview();
                _SpectateRegion.Unregister();
                _SpectateRegion = null;
            }

            if (_Options != null)
            {
                _Options.Clear();
            }

            OnDeleted();

            if (AutoPvP.RemoveBattle(this))
            {
                OnRemoved();
            }

            Deleted = true;
        }
コード例 #21
0
ファイル: ProfileList.cs プロジェクト: LordEnigma/UO
        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);
        }
コード例 #22
0
ファイル: ProfileList.cs プロジェクト: LordEnigma/UO
 protected override void CompileList(List <PvPProfile> list)
 {
     list.Clear();
     list.AddRange(AutoPvP.GetSortedProfiles(RankSortOrder, Season));
     base.CompileList(list);
 }
コード例 #23
0
ファイル: Profile.cs プロジェクト: zerodowned/Core
 public void Remove()
 {
     AutoPvP.RemoveProfile(this);
 }
コード例 #24
0
 public virtual bool CanQueue(PlayerMobile pm)
 {
     return(!IsInternal && QueueAllowed && IsOnline(pm) && pm.Alive && !InCombat(pm) && !IsQueued(pm) &&
            !InOtherBattle(pm) && !AutoPvP.IsDeserter(pm) && !pm.InRegion <Jail>());
 }
コード例 #25
0
ファイル: Battle.cs プロジェクト: AllanNisbet/runuo
        public void Sync()
        {
            foreach (var p in GetParticipants().Where(pm => pm != null && !pm.Deleted).Select(pm => AutoPvP.EnsureProfile(pm)))
            {
                p.Sync();
            }

            foreach (var team in Teams.Where(team => team != null && !team.Deleted))
            {
                team.Sync();
            }

            if (Schedule != null && Schedule.Enabled)
            {
                Schedule.InvalidateNextTick(DateTime.UtcNow);
            }

            OnSync();
        }
コード例 #26
0
 public virtual bool CanSendInvite(PlayerMobile pm)
 {
     return(pm != null && !pm.Deleted && pm.Alive && !pm.InRegion <Jail>() && pm.DesignContext == null && IsOnline(pm) &&
            !InCombat(pm) && IsQueued(pm) && !IsParticipant(pm) && !InOtherBattle(pm) && !AutoPvP.IsDeserter(pm));
 }