public void OnSpellCast(SpellDeliverable spell) { var orders = SaveData.Value .Where(e => e.Contents is Order) .Select(e => e.Contents as Order); var incompleteOrderInvoices = orders .Where(o => o.State == OrderState.InProgress) .Select(o => o.Invoice); foreach (Invoice invoice in incompleteOrderInvoices) { var spells = invoice.LineItems.Where(li => li is SpellDeliverable).Select(li => li as SpellDeliverable).ToList(); if (spells.Contains(spell)) { Alert.Instance.ShowMessage($"WitchWatch: spell {spells.IndexOf(spell) + 1} was cast for order #{invoice.OrderNumber}"); } } }
public bool Equals(SpellDeliverable other) { return(base.Equals(other) && TargetName.Equals(other.TargetName, StringComparison.InvariantCultureIgnoreCase)); }