public static IEnumerable <TorNpc> PartyCompanions(this TorPlayer torPlayer, TorCharacterPredicateDelegate companionQualifier = null) { // Extension methods guarantee the 'this' argument is never null, so no need to check a contract here companionQualifier = companionQualifier ?? (ctx => true); // resolve playerQualifier to something sane return(torPlayer.PartyPlayers(p => p.IsCompanionInUse() && companionQualifier(p.Companion)).Select(p => p.Companion)); }
public static IEnumerable <TorCharacter> PartyMembers(this TorPlayer torPlayer, bool includeCompanions = true, TorCharacterPredicateDelegate memberQualifier = null) { memberQualifier = memberQualifier ?? (c => true); // resolve playerQualifier to something sane IEnumerable <TorCharacter> partyMembers = torPlayer.PartyPlayers(); if (includeCompanions) { partyMembers = partyMembers.Concat(torPlayer.PartyCompanions()); } return(partyMembers.Where(c => memberQualifier(c))); }