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 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.
                }
            }
        }
Ejemplo n.º 4
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.º 5
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);
        }
Ejemplo n.º 6
0
        public void SetDuel()
        {
            PVPArenaSystem.SendMessage(Host, 1115800); // You have created a new duel session.

            Teams[0].AddParticipant(Host);
        }