/// <summary>Get how much each NPC likes receiving an item as a gift.</summary> /// <param name="item">The item to check.</param> public IEnumerable <GiftTasteModel> GetGiftTastes(Item item) { if (!item.canBeGivenAsGift()) { yield break; } foreach (NPC npc in this.GetAllCharacters()) { if (!this.IsSocialVillager(npc)) { continue; } GiftTaste?taste = this.GetGiftTaste(npc, item); if (taste.HasValue) { yield return(new GiftTasteModel(npc, item, taste.Value)); } } }
/// <summary>Get how much each NPC likes receiving an item as a gift.</summary> /// <param name="item">The item to check.</param> /// <param name="metadata">Provides metadata that's not available from the game data directly.</param> public IEnumerable <KeyValuePair <NPC, GiftTaste> > GetGiftTastes(Item item, Metadata metadata) { if (!item.canBeGivenAsGift()) { yield break; } foreach (NPC npc in this.GetAllCharacters()) { if (!this.IsSocialVillager(npc, metadata)) { continue; } GiftTaste?taste = this.GetGiftTaste(npc, item); if (taste.HasValue) { yield return(new KeyValuePair <NPC, GiftTaste>(npc, taste.Value)); } } }