示例#1
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);
            }
        }
示例#2
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);
            }
        }