Пример #1
0
        private static void PATCH__After_chooseSecretSantaGift(Event __instance, Item i)
        {
            if (i is SObject o)
            {
                NPC actorByName = __instance.getActorByName(secretSantaRecipient);

                if (GiftDialogueHelper.FetchGiftReaction(actorByName, o, out string giftDialogue, "_SecretSanta"))
                {
                    GiftDialogueHelper.CancelCurrentDialogue(actorByName);
                    Game1.drawDialogue(actorByName, giftDialogue);
                }
            }

            // Clear secret santa recipient name after object received
            secretSantaRecipient = null;
        }
Пример #2
0
        private static void PATCH__After_receiveGift(NPC __instance, SObject o)
        {
            try
            {
                string bdaySuffix = __instance.isBirthday(Game1.currentSeason, Game1.dayOfMonth) ? "_Birthday" : "";

                if (GiftDialogueHelper.FetchGiftReaction(__instance, o, out string giftDialogue, bdaySuffix))
                {
                    GiftDialogueHelper.CancelCurrentDialogue(__instance);
                    Game1.drawDialogue(__instance, giftDialogue);
                }
            }
            catch (Exception ex)
            {
                ModMonitor.Log($"An error occurred during handle custom gift reaction dialogue: {ex.Message}", LogLevel.Error);
                ModMonitor.Log(ex.ToString());
            }
        }