Beispiel #1
0
        public ArenaDuel(PVPArena arena, PlayerMobile host)
        {
            Host = host;

            PlayerStatsEntry entry = PVPArenaSystem.Instance.GetPlayerEntry <PlayerStatsEntry>(host);

            if (entry.Profile != null)
            {
                ConfigureFromProfile(entry.Profile);
            }
            else
            {
                ConfigureDefault();
            }

            Arena = arena;

            Teams      = new List <ArenaTeam>();
            KillRecord = new Dictionary <string, string>();
            Banned     = new List <PlayerMobile>();
            Warned     = new List <PlayerMobile>();

            Teams.Add(new ArenaTeam(host));
            Teams.Add(new ArenaTeam());

            Complete = false;
        }
Beispiel #2
0
        public void HandleDeath(Mobile victim)
        {
            Mobile killer = victim.LastKiller;

            if (killer is BaseCreature creature)
            {
                killer = creature.GetMaster();
            }

            if (victim is PlayerMobile mobile)
            {
                if (killer != null)
                {
                    KillRecord[mobile.Name] = killer.Name;
                }

                if (killer is PlayerMobile playerMobile && killer != victim) // if not ranked, does it keep track of this?
                {
                    PlayerStatsEntry victimEntry = GetStats(mobile);
                    PlayerStatsEntry killerEntry = GetStats(playerMobile);

                    if (victimEntry != null)
                    {
                        victimEntry.Deaths++;
                        victimEntry.HandleDeath(playerMobile, true);
                    }

                    if (killerEntry != null)
                    {
                        killerEntry.Kills++;
                        killerEntry.HandleDeath(mobile, false);
                    }
                }

                List <ArenaTeam> stillAlive = new List <ArenaTeam>();

                for (var index = 0; index < Teams.Count; index++)
                {
                    ArenaTeam team = Teams[index];

                    if (CheckTeamAlive(mobile, team))
                    {
                        stillAlive.Add(team);
                    }
                }

                if (stillAlive.Count == 1)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(5), EndDuel, stillAlive[0]);
                }

                ColUtility.Free(stillAlive);
            }
        }
Beispiel #3
0
        public void HandleDeath(Mobile victim)
        {
            Mobile killer = victim.LastKiller;

            if (killer is BaseCreature)
            {
                killer = ((BaseCreature)killer).GetMaster();
            }

            if (victim is PlayerMobile)
            {
                if (killer != null)
                {
                    KillRecord[victim.Name] = killer.Name;
                }

                if (killer is PlayerMobile && killer != victim) // if not ranked, does it keep track of this?
                {
                    PlayerStatsEntry victimEntry = GetStats((PlayerMobile)victim);
                    PlayerStatsEntry killerEntry = GetStats((PlayerMobile)killer);

                    if (victimEntry != null)
                    {
                        victimEntry.Deaths++;
                        victimEntry.HandleDeath(killer, true);
                    }

                    if (killerEntry != null)
                    {
                        killerEntry.Kills++;
                        killerEntry.HandleDeath(victim, false);
                    }
                }

                List <ArenaTeam> stillAlive = new List <ArenaTeam>();

                foreach (var team in Teams)
                {
                    if (CheckTeamAlive((PlayerMobile)victim, team))
                    {
                        stillAlive.Add(team);
                    }
                }

                if (stillAlive.Count == 1)
                {
                    Timer.DelayCall <ArenaTeam>(TimeSpan.FromSeconds(5), EndDuel, stillAlive[0]);
                }

                ColUtility.Free(stillAlive);
            }
        }
Beispiel #4
0
        public void RecordStats(ArenaTeam winner)
        {
            foreach (KeyValuePair <PlayerMobile, PlayerStatsEntry> kvp in GetParticipants(true))
            {
                PlayerStatsEntry stats = kvp.Value;
                ArenaTeam        team  = null;

                for (var index = 0; index < Teams.Count; index++)
                {
                    var t = Teams[index];

                    if (t.Contains(kvp.Key))
                    {
                        team = t;
                        break;
                    }
                }

                if (winner == null)
                {
                    switch (BattleMode)
                    {
                    case BattleMode.Survival: stats.SurvivalDraws++; break;

                    case BattleMode.Team: stats.TeamDraws++; break;
                    }
                }
                else if (team == winner)
                {
                    switch (BattleMode)
                    {
                    case BattleMode.Survival: stats.SurvivalWins++; break;

                    case BattleMode.Team: stats.TeamWins++; break;
                    }
                }
                else
                {
                    switch (BattleMode)
                    {
                    case BattleMode.Survival: stats.SurvivalLosses++; break;

                    case BattleMode.Team: stats.TeamLosses++; break;
                    }
                }
            }
        }
Beispiel #5
0
        public void CheckTitle(PlayerMobile pm)
        {
            PlayerStatsEntry entry = GetPlayerEntry <PlayerStatsEntry>(pm);
            int title = 0;

            switch (entry.TotalDuels)
            {
            case 1: title = 1152068 + (int)ArenaTitle.FledglingGladiator; break;

            case 50: title = 1152068 + (int)ArenaTitle.BuddingGladiator; break;

            case 100: title = 1152068 + (int)ArenaTitle.Gladiator; break;

            case 250: title = 1152068 + (int)ArenaTitle.WellKnownGladiator; break;

            case 500: title = 1152068 + (int)ArenaTitle.VeteranGladiator; break;
            }

            if (title > 0)
            {
                pm.AddRewardTitle(title);
                pm.SendLocalizedMessage(1152067, String.Format("#{0}", title.ToString())); // You have gotten a new subtitle, ~1_VAL~, in reward for your duel!
            }
        }
Beispiel #6
0
        public void RecordStats(ArenaTeam winner)
        {
            foreach (KeyValuePair <PlayerMobile, PlayerStatsEntry> kvp in GetParticipants(true))
            {
                ArenaTeam        team  = Teams.FirstOrDefault(t => t.Contains(kvp.Key));
                PlayerStatsEntry stats = kvp.Value;

                if (winner == null)
                {
                    switch (BattleMode)
                    {
                    case BattleMode.Survival: stats.SurvivalDraws++; break;

                    case BattleMode.Team: stats.TeamDraws++; break;
                    }
                }
                else if (team == winner)
                {
                    switch (BattleMode)
                    {
                    case BattleMode.Survival: stats.SurvivalWins++; break;

                    case BattleMode.Team: stats.TeamWins++; break;
                    }
                }
                else
                {
                    switch (BattleMode)
                    {
                    case BattleMode.Survival: stats.SurvivalLosses++; break;

                    case BattleMode.Team: stats.TeamLosses++; break;
                    }
                }
            }
        }