public static void answerDialogueAction(string questionAndAnswer) { try { if (questionAndAnswer.StartsWith(GiftShipmentController.GiftDialogKey)) { string npcName = questionAndAnswer.Remove(0, GiftShipmentController.GiftDialogKey.Length + 1); if (npcName == GiftResponseKeyNone) { return; } if (npcName.StartsWith(GiftResponseKeyPrevious)) { GiftShipmentController.CreateResponsePage(int.Parse(npcName.Remove(0, GiftResponseKeyPrevious.Length))); } else if (npcName.StartsWith(GiftResponseKeyNext)) { GiftShipmentController.CreateResponsePage(int.Parse(npcName.Remove(0, GiftResponseKeyNext.Length))); } else { GiftShipmentController.GiftToNpc(npcName); } } } catch (Exception e) { MailServicesModEntry.ModMonitor.Log("Error trying to answer your gift choice.", LogLevel.Error); MailServicesModEntry.ModMonitor.Log($"The error message above: {e.Message}", LogLevel.Trace); } }
public static bool mailbox() { try { if (!DataLoader.ModConfig.DisableGiftService && Game1.player.mailbox.Count == 0 && Game1.player.ActiveObject != null && Game1.player.ActiveObject.canBeGivenAsGift()) { if (Game1.player.Money >= DataLoader.ModConfig.GiftServiceFee) { return(GiftShipmentController.CreateResponsePage(0)); } else { Game1.drawObjectDialogue(DataLoader.I18N.Get("Shipment.Gift.NoMoney")); return(false); } } } catch (Exception e) { MailServicesModEntry.ModMonitor.Log("Error trying to send gift to a villager.", LogLevel.Error); MailServicesModEntry.ModMonitor.Log($"The error message above: {e.Message}", LogLevel.Trace); } return(true); }