Exemple #1
0
 private void OnMenuChanged(object sender, MenuChangedEventArgs e)
 {
     if (e.NewMenu is QuestLog)
     {
         foreach (ItemDeliveryQuest quest in QuestLogHelper.GetDailyItemDeliveryQuests())
         {
             this.UpdateItemDeliveryQuest(quest);
         }
     }
 }
Exemple #2
0
        private void OnItemRemoved(Item plainItem)
        {
            if (!this.isInDialog)
            {
                return;
            }

            if (!(plainItem is StardewValley.Object item))
            {
                return;
            }
            if (!item.canBeGivenAsGift())
            {
                return;                                       // e.g. Tools or any placable object
            }
            IEnumerator <NPC> enumerator = Game1.player.currentLocation.characters.GetEnumerator();

            while (enumerator.MoveNext())
            {
                NPC npc = enumerator.Current;
                if (NpcHelper.AcceptsGifts(npc) && NpcHelper.HasJustReceivedGift(npc, item))
                {
                    Logger.Trace(npc.Name + " received gift #" + item.ParentSheetIndex + " (" + item.Name + ")");
                    SaveGameHelper.HandleReceivedGift(npc, item);
                    return;
                }
            }

            foreach (ItemDeliveryQuest quest in QuestLogHelper.GetDailyItemDeliveryQuests())
            {
                if (quest.deliveryItem.Value.ParentSheetIndex == item.ParentSheetIndex && quest.hasReward())
                {
                    Logger.Trace("Handed over quest item");
                    return;
                }
            }

            Logger.Trace("It appears a gift has been given to someone, but I can't determine to whom :(");
            Logger.Trace("Maybe it was a non-daily quest item? (" + item.Name + ")");
        }