Exemple #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);
            }
        }
Exemple #2
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);
            }
        }
Exemple #3
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));
                }
            }
        }
Exemple #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.
                }
            }
        }
Exemple #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();
        }
Exemple #6
0
        public void CancelDuel(bool refund = false)
        {
            Timer.DelayCall <ArenaTeam>(TimeSpan.FromSeconds(5), RemovePlayers, null);
            Complete = true;

            if (refund && EntryFee > EntryFee.Zero)
            {
                foreach (var part in GetParticipants())
                {
                    Banker.Deposit(part.Key, (int)EntryFee, true);
                    PVPArenaSystem.SendMessage(part.Key, 1149606); // The entry fee has been refunded to your bank box.
                }
            }
        }
Exemple #7
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.
        }
Exemple #8
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.
            }
        }
Exemple #9
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);
                }
            });
        }
Exemple #10
0
        private bool CheckValidation(PlayerMobile pm)
        {
            if (!Duel.IsParticipant(pm))
            {
                return(false);
            }

            if (pm.Young)
            {
                PVPArenaSystem.SendMessage(pm, 1149696); // As a young player, you may not enter this area.
                return(false);
            }

            if (pm.Followers > Duel.PetSlots)
            {
                PVPArenaSystem.SendMessage(pm, 1115974); // You currently exceed the maximum number of pet slots for this duel. Please stable your pet(s) with the arena manager before proceeding.
                return(false);
            }

            if (Duel.EntryFee > EntryFee.Zero)
            {
                int fee = (int)Duel.EntryFee;

                if (pm.Backpack != null && pm.Backpack.ConsumeTotal(typeof(Gold), fee))
                {
                    pm.SendLocalizedMessage(1149610); // You have paid the entry fee from your backpack.
                }
                else if (Banker.Withdraw(pm, fee, true))
                {
                    pm.SendLocalizedMessage(1149609); // You have paid the entry fee from your bank account.
                }
                else
                {
                    pm.SendLocalizedMessage(1149611); // You don't have enough money to pay the entry fee.
                    return(false);
                }

                Duel.Pot += fee;
            }

            return(true);
        }
Exemple #11
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();
        }
Exemple #12
0
        public void SetDuel()
        {
            PVPArenaSystem.SendMessage(Host, 1115800); // You have created a new duel session.

            Teams[0].AddParticipant(Host);
        }