Line 59: |
Line 59: |
| | <tt>Pet</tt> | | | <tt>Pet</tt> |
| | <tt>wasPetToday</tt> | | | <tt>wasPetToday</tt> |
− | | Replaced by <tt>lastPetDay</tt>, which is the <tt>Game1.Date.TotalDays</tt> value when it was last pet by each player. | + | | Replaced by <tt>lastPetDay</tt>, which is the <tt>Game1.Date.TotalDays</tt> value when it was last pet by each player. To check if ''any'' player pet them today: |
| + | <source lang="c#"> |
| + | private bool WasPetToday(Pet pet) |
| + | { |
| + | NetLongDictionary<int, NetInt> lastPettedDays = ModEntry.ReflectionHelper.GetField<NetLongDictionary<int, NetInt>>(pet, "lastPetDay").GetValue(); |
| + | return lastPettedDays.Values.Any(day => day == Game1.Date.TotalDays); |
| + | } |
| + | </source> |
| + | |
| + | To check if the current player pet them today: |
| + | <source lang="c#"> |
| + | private bool WasPetTodayByCurrentPlayer(Pet pet) |
| + | { |
| + | NetLongDictionary<int, NetInt> lastPettedDays = ModEntry.ReflectionHelper.GetField<NetLongDictionary<int, NetInt>>(pet, "lastPetDay").GetValue(); |
| + | return lastPettedDays.TryGetValue(Game1.player.UniqueMultiplayerID, out int lastDay) && lastDay == Game1.Date.TotalDays; |
| + | } |
| + | </source> |
| + | |- |
| + | | <tt>ShopMenu</tt> |
| + | | <tt>itemPriceAndStock</tt> |
| + | | Changed from <tt>Dictionary<Item, int[]></tt> to <tt>Dictionary<ISalable, int[]></tt>, but otherwise equivalent. (<tt>Item</tt> implements <tt>ISalable</tt>.) |
| |}</li> | | |}</li> |
| </ul> | | </ul> |