Ejemplo n.º 1
0
        public static bool PlayerIsNotInDuel(Player attacker, Player target)
        {
            var duel = DuelProcedures.GetDuel(attacker.InDuel);

            // attacker is not in any duel, so obviously they are not in this duel
            if (duel == null)
            {
                return(true);
            }

            // otherwise scan through participants and see if the target is amongst them
            var notInDuel = true;

            foreach (var d in duel.Combatants)
            {
                if (target.Id == d.PlayerId)
                {
                    notInDuel = false;
                    break;
                }
            }

            if (notInDuel)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        private static void EndDuel(Player victim)
        {
            var duel             = DuelProcedures.GetDuel(victim.InDuel);
            var duelParticipants = DuelProcedures.GetPlayerViewModelsInDuel(duel.Id);

            var remainders = duelParticipants.Count();

            foreach (var p in duelParticipants)
            {
                if (p.Player.FormSourceId != duel.Combatants.FirstOrDefault(dp => dp.PlayerId == p.Player.Id).StartFormSourceId)
                {
                    remainders--;
                }
            }

            if (remainders <= 1)
            {
                DuelProcedures.EndDuel(duel.Id, DuelProcedures.FINISHED);
            }
        }