Ejemplo n.º 1
0
        public void RemovePlayer(PlayerMobile pm, bool ban = false)
        {
            var team = GetTeam(pm);

            if (team != null)
            {
                team.RemoveParticipant(pm);

                if (Teams[1] != team && team.Unoccupied)
                {
                    Teams.Remove(team);
                }

                if (ban)
                {
                    Banned.Add(pm);

                    PVPArenaSystem.SendMessage(Host, 1115951);            // You have banned the specified participant.
                    PVPArenaSystem.SendParticipantMessage(this, 1115951); // You have been banned from the session by the host player.
                }
                else
                {
                    PVPArenaSystem.SendMessage(pm, 1115948);              // One of the participants has left your duel session.
                    PVPArenaSystem.SendParticipantMessage(this, 1115948); // One of the participants has left your duel session.
                }

                PendingDuelGump.RefreshAll(this);
            }
        }
Ejemplo n.º 2
0
        public void RegisterPlayer(PlayerMobile pm)
        {
            PVPArenaSystem.SendParticipantMessage(this, 1115956); // A new duelist has joined your session!
            PVPArenaSystem.SendMessage(pm, 1115955);              // You have joined the session.

            if (BattleMode == BattleMode.Team)
            {
                if (TeamOrder.Count > TeamChaos.Count)
                {
                    TeamChaos.AddParticipant(pm);
                }
                else
                {
                    TeamOrder.AddParticipant(pm);
                }
            }
            else
            {
                if (Teams[Teams.Count - 1].Unoccupied)
                {
                    Teams[Teams.Count - 1].AddParticipant(pm);
                }
                else
                {
                    Teams.Add(new ArenaTeam(pm));
                }
            }
        }
Ejemplo n.º 3
0
        public void OnDuelEnd(ArenaDuel duel)
        {
            CurrentDuel = null;

            foreach (Corpse corpse in Region.GetEnumeratedItems().OfType <Corpse>())
            {
                if (corpse.Owner != null && corpse.Owner.InRange(corpse.Location, 30))
                {
                    corpse.MoveToWorld(corpse.Owner.Location, corpse.Owner.Map);
                }
                else
                {
                    corpse.MoveToWorld(GetRandomRemovalLocation(), Definition.Map);
                }
            }

            if (BookedDuels.Count > 0)
            {
                ArenaDuel newDuel = BookedDuels[0];
                CurrentDuel = newDuel;

                PVPArenaSystem.SendParticipantMessage(newDuel, 1153141); // Your session has been booked. Please wait a few moments to start the fight.

                Timer.DelayCall(BookedDuelBegin, () =>
                {
                    newDuel.DoPreDuel();
                });

                BookedDuels.Remove(newDuel);
            }
        }
Ejemplo n.º 4
0
        public void RemovePendingDuel(ArenaDuel duel, bool cancel = false)
        {
            if (PendingDuels.ContainsKey(duel))
            {
                PendingDuels.Remove(duel);

                if (cancel)
                {
                    PVPArenaSystem.SendParticipantMessage(duel, 1115947); // The session owner has canceled the duel.
                }
            }
        }
Ejemplo n.º 5
0
        public void RemovePlayers(ArenaTeam winners)
        {
            foreach (var part in GetParticipants(true))
            {
                Arena.RemovePlayer(part.Key, winners != null && winners.Contains(part.Key));
                PVPArenaSystem.Instance.CheckTitle(part.Key);
            }

            PVPArenaSystem.SendParticipantMessage(this, 1115973); // Thank you for your participation! Please return to the arena stone for additional dueling opportunities!
            Arena.OnDuelEnd(this);

            Closeout();
        }
Ejemplo n.º 6
0
        public void EndDuel(ArenaTeam winner)
        {
            Timer.DelayCall(KickTime, RemovePlayers, winner);
            Complete = true;

            SendResults(winner);

            if (winner != null)
            {
                foreach (PlayerMobile pm in winner.Players.Keys)
                {
                    if (Pot > 0)
                    {
                        Banker.Deposit(pm, Pot / winner.Count, true);
                    }

                    PVPArenaSystem.SendMessage(pm, 1115975); // Congratulations! You have won the duel!

                    Timer.DelayCall(TimeSpan.FromSeconds(1), player =>
                    {
                        DoWinEffects(player);
                    }, pm);
                }
            }

            foreach (ArenaTeam team in Teams)
            {
                if (team != winner)
                {
                    foreach (PlayerMobile pm in team.Players.Keys)
                    {
                        PVPArenaSystem.SendMessage(pm,
                                                   team.Count == 1
                                ? 1116489
                                : 1116488); // You have lost the duel... : Your team has lost the duel...
                    }
                }
            }

            RecordStats(winner);

            if (Ranked)
            {
                Arena.RecordRankings(this, winner);
            }

            PVPArenaSystem.SendParticipantMessage(this, 1115965); // All participants will be ejected from this arena in 40 seconds.
        }
Ejemplo n.º 7
0
        public void TryBeginDuel(ArenaDuel duel)
        {
            if (PendingDuels.ContainsKey(duel))
            {
                PendingDuels.Remove(duel);
            }

            if (CurrentDuel == null && BookedDuels.Count == 0)
            {
                CurrentDuel = duel;
                duel.DoPreDuel();
            }
            else
            {
                BookedDuels.Add(duel);
                PVPArenaSystem.SendParticipantMessage(duel, 1115960); // There are currently no open arenas. Your duel session has been added to the booking queue.
            }
        }
Ejemplo n.º 8
0
        public void BeginDuel()
        {
            EntryDeadline = DateTime.MinValue;
            StartTime     = DateTime.UtcNow;

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

            List <ArenaTeam> present = GetTeamsPresent();

            if (present.Count <= 1)
            {
                if (present.Count == 1)
                {
                    PVPArenaSystem.SendParticipantMessage(this, 1116476, true); // Your duel is about to begin but the opposing team has not came to the arena. This session will be aborted and you will be ejected from the arena.
                }

                CancelDuel(true);
                ColUtility.Free(present);

                RemoveBlockers();

                return;
            }

            ColUtility.Free(present);
            PVPArenaSystem.SendParticipantMessage(this, 1115964, true); // The duel will start in 5 seconds!

            Timer.DelayCall(StartTimeDuration, () =>
            {
                RemoveBlockers();
                DoStartEffects();

                InPreFight = false;

                foreach (var part in GetParticipants(true))
                {
                    part.Key.Delta(MobileDelta.Noto);
                }
            });
        }
Ejemplo n.º 9
0
        public void DoPreDuel()
        {
            AssignStartPoints();

            Gate = new ArenaGate(this);
            Gate.MoveToWorld(Arena.Definition.GateLocation, Arena.Definition.Map);
            DoGateEffect();

            Effects.PlaySound(Gate.Location, Gate.Map, 0x20E);

            InPreFight    = true;
            EntryDeadline = DateTime.UtcNow + EntryTime;

            PVPArenaSystem.SendParticipantMessage(this, 1115875);
            // The arena gate has opened near the arena stone. You have ninety seconds to use the gate or you will be removed from this duel.

            foreach (var kvp in GetParticipants())
            {
                BaseGump.SendGump(new OfferDuelGump(kvp.Key, this, Arena, false, true));
            }

            HasBegun = true;
            PlaceBlockers();
        }