private static void FarmhandDonated(ModMessageReceivedEventArgs e) { if (!Context.IsMainPlayer) { return; } string fishName = e.ReadAs <string>(); string donatedFlag = GetDonatedMailFlag(fishName); MasterPlayerMail.Add(donatedFlag); string numDonated = $"AquariumFishDonated:{GetNumDonatedFish()}"; MasterPlayerMail.Add(numDonated); if (ModEntry.Data.ConversationTopicsOnDonate.Contains(fishName)) { foreach (var farmer in Game1.getAllFarmers()) { if (farmer.activeDialogueEvents.ContainsKey(donatedFlag)) { farmer.activeDialogueEvents[donatedFlag] = 3; } else { farmer.activeDialogueEvents.Add(donatedFlag, 3); } } } }
public static bool IsUnDonatedFish(string s) { if (InternalNameToDonationName.ContainsValue(s)) { return(!MasterPlayerMail.Contains($"AquariumDonated:{s}")); } return(false); }
public static bool IsUnDonatedFish(Item i) { if (i?.Category != -4) { return(false); } return(!MasterPlayerMail.Contains(GetDonatedMailFlag(i))); }
public static bool IsUnDonatedFish(Item i) { if (i?.Category != -4) { return(false); } try { return(!MasterPlayerMail.Contains(GetDonatedMailFlag(i))); } catch { _monitor.Log($"An item in the inventory \"{i.Name}\" has a category of Fish but is not a valid fish object.", LogLevel.Error); return(false); } }
public static bool DonateFish(Item i) { if (!IsUnDonatedFish(i)) { return(false); } string donatedFlag = GetDonatedMailFlag(i); if (!MasterPlayerMail.Contains(donatedFlag)) { if (!Context.IsMainPlayer) { _helper.Multiplayer.SendMessage(i.Name, DonateFishMessageType, modIDs: new[] { _manifest.UniqueID }); _fishSign.UpdateLastDonatedFish(i); return(true); } MasterPlayerMail.Add(donatedFlag); string numDonated = $"AquariumFishDonated:{GetNumDonatedFish()}"; MasterPlayerMail.Add(numDonated); } if (ModEntry.Data.ConversationTopicsOnDonate.Contains(i.Name)) { foreach (var farmer in Game1.getAllFarmers()) { if (farmer.activeDialogueEvents.ContainsKey(donatedFlag)) { farmer.activeDialogueEvents[donatedFlag] = 3; } else { farmer.activeDialogueEvents.Add(donatedFlag, 3); } } } _fishSign.UpdateLastDonatedFish(i); return(true); }
public static bool DonateFish(Item i) { if (!IsUnDonatedFish(i)) { return(false); } MasterPlayerMail.Add(GetDonatedMailFlag(i)); string numDonated = $"AquariumFishDonated:{GetNumDonatedFish()}"; if (!MasterPlayerMail.Contains(numDonated)) { MasterPlayerMail.Add(numDonated); } _fishSign.UpdateLastDonatedFish(i); return(true); }
public static void UnlockAchievement() { if (Game1.player.achievements.Contains(AchievementEditor.AchievementId)) { return; } Game1.addHUDMessage(new HUDMessage(_helper.Translation.Get("AchievementName"), true)); Game1.playSound("achievement"); Game1.player.achievements.Add(AchievementEditor.AchievementId); if (!Context.IsMainPlayer) { return; } if (!MasterPlayerMail.Contains("AquariumCompleted")) { _helper.Events.GameLoop.Saving += AddCompletionFlag; } }
private static void AddCompletionFlag(object sender, SavingEventArgs e) { //adding this at the end of the day so that the event won't trigger until the next day MasterPlayerMail.Add("AquariumCompleted"); _helper.Events.GameLoop.Saving -= AddCompletionFlag; }
public static int GetNumDonatedFish() { return(MasterPlayerMail.Count(flag => flag.StartsWith("AquariumDonated:"))); }
public static bool IsUnDonatedFish(string s) { return(!MasterPlayerMail.Contains($"AquariumDonated:{s}")); }