Beispiel #1
0
        static bool Prefix(ref List <TournamentParticipant> ____participants, TournamentParticipant participant, bool firstTime, TournamentMatch __instance)
        {
            if (!__instance.IsPlayerParticipating())
            {
                return(true);
            }

            var teams          = __instance.Teams.CastList <MBTournamentTeam>();
            var playerTeam     = GetPlayerTeamFrom(teams);
            var nonPlayerTeams = teams;

            nonPlayerTeams.Remove(playerTeam);

            MBTournamentParticipant wrappedParticipant = participant;

            ____participants.Add(participant);

            if (playerTeam.IsParticipantRequired() &&
                (participant.IsPlayer || participant.IsPlayerCompanion() || participant.IsMarriedToPlayer() || participant.IsPlayerTroop()))
            {
                playerTeam.AddParticipant(participant);

                return(false);
            }

            if ((firstTime && participant.TryPlaceInNewOrSameTeam(teams.CastList <TournamentTeam>())) || participant.TryPlaceInAnyTeam(teams.CastList <TournamentTeam>()))
            {
                return(false);
            }

            return(false);
        }
Beispiel #2
0
 public static bool ShouldAddToPlayerTeam(this TournamentParticipant participant)
 {
     return(Settings.BringCompanions && (participant.IsPlayerCompanion() || participant.IsMarriedToPlayer()));
 }