public static bool IsHealer(this TorPlayer p) { var result = false; switch (p.Discipline) { case CharacterDiscipline.CombatMedic: result = true; break; case CharacterDiscipline.Bodyguard: result = true; break; case CharacterDiscipline.Medicine: result = true; break; case CharacterDiscipline.Seer: result = true; break; case CharacterDiscipline.Sawbones: result = true; break; case CharacterDiscipline.Corruption: result = true; break; } return(result); }
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))); }
public static IEnumerable <TorPlayer> PartyPlayers(this TorPlayer torPlayer, TorPlayerPredicateDelegate playerQualifier = null) { playerQualifier = playerQualifier ?? (ctx => true); // resolve playerQualifier to something sane var playerGroupId = torPlayer.GroupId; // If we're solo, only have the torPlayer on the list... // We can't build this list using the 'normal' query, as all solo players have the common GroupId of zero. // We don't want a list of 'solo' players (what the normal query would do), we want a list with only the solo torPlayer on it. if (playerGroupId == 0) { return(ObjectManager.GetObjects <TorPlayer>().Where(p => (p == BuddyTor.Me) && playerQualifier(p))); } // NB: IsInParty() is implemented in terms of PartyPlayers(). Be careful not to implement this method in terms of // IsInParty(); otherwise, infinite recursive descent will occur. return (ObjectManager.GetObjects <TorPlayer>().Where(p => !p.IsDeleted && playerQualifier(p) && (p.GroupId == playerGroupId))); }
public static string SelfBuffName(this TorPlayer torPlayer) { return(TunablesMap[torPlayer.Class].SelfBuffName); }
public static string RejuvenateAbilityName(this TorPlayer torPlayer) { return(TunablesMap[torPlayer.Class].RejuvenateAbilityName); }
public static float ResourcePercent(this TorPlayer torPlayer) { return(TunablesMap[torPlayer.Class].NormalizedResource(torPlayer)); }
public static bool IsCompanionInUse(this TorPlayer torPlayer) { // Extension methods guarantee the 'this' argument is never null, so no need to check a contract here return((torPlayer.CompanionUnlocked > 0) && (torPlayer.Companion != null)); }