private KPDatabaseDataSet.InteractionsRow GetLastAction(KPDatabaseDataSet.BattlesRow b) { var killer = b.CombatantsRowByBattleKillerRelation; var killerActions = b.GetInteractionsRows() .Where(i => i.IsActorIDNull() == false && i.ActorID == killer.CombatantID); return(killerActions.LastOrDefault(a => (ActionType)a.ActionType != ActionType.Death)); }
/// <summary> /// An extension method to determine whether a given InteractionsRow passes the filter /// check set by the specified MobFilter object. Checks the filter against the target /// of the action. /// </summary> /// <param name="mobFilter">The filter to check against.</param> /// <param name="rowToCheck">The InteractionsRow to check.</param> /// <returns>Returns true if the row passes the filter test, otherwise false.</returns> public static bool CheckFilterBattle(this MobFilter mobFilter, KPDatabaseDataSet.BattlesRow rowToCheck) { if (mobFilter.AllMobs == true) { if (mobFilter.Exclude0XPMobs) { return(rowToCheck.ExperiencePoints > 0); } else if (rowToCheck.IsEnemyIDNull() == true) { return(false); } else if ((EntityType)rowToCheck.CombatantsRowByEnemyCombatantRelation.CombatantType == EntityType.Mob) { return(true); } } if (rowToCheck.DefaultBattle == true) { return(false); } if (mobFilter.CustomSelection == true) { return(mobFilter.CustomBattleIDs.Contains(rowToCheck.BattleID)); } if (mobFilter.GroupMobs == false) { if (rowToCheck.BattleID == mobFilter.FightNumber) { return(true); } else { return(false); } } if (mobFilter.MobName == string.Empty) { return(false); } if (rowToCheck.IsEnemyIDNull() == true) { return(false); } if ((EntityType)rowToCheck.CombatantsRowByEnemyCombatantRelation.CombatantType != EntityType.Mob) { return(false); } if (rowToCheck.CombatantsRowByEnemyCombatantRelation.CombatantName == mobFilter.MobName) { if (mobFilter.MobXP == -1) { return(true); } if (mobFilter.MobXP == MobXPHandler.Instance.GetBaseXP(rowToCheck.BattleID)) { return(true); } } return(false); }