private void UpdateCollectionQuest(NpcHandler npcHandler, ItemHandler itemHandler, Quest quest) { ResourceCollectionQuest request = (ResourceCollectionQuest)quest; bool isValidObjective = ParseOneByObjective(itemHandler.Item.ParentSheetIndex, request.deliveryItem.Value.ParentSheetIndex); bool isValidRecipient = ParseOneByRecipient(npcHandler.Target.Name, request.target.Value); if (isValidObjective && isValidRecipient) { int numberItemsOwed = Config.LazyItemChecking ? request.number.Value : request.number.Value - request.numberCollected.Value; bool isValidAmount = Game1.player.hasItemInInventory(itemHandler.Item.ParentSheetIndex, numberItemsOwed); if (isValidAmount) { // Remove only when quest giver is Robin if (request.target.Value.Equals("Robin")) { itemHandler.RemoveFromInventory(request.number.Value); } npcHandler.Update(0, true, null); Update(quest, request.reward.Value); } else { // Remove none and warn WarnAmountLow(request.target.Value.ToString(), numberItemsOwed); } } }
private void UpdateDeliveryQuest(NpcHandler npcHandler, ItemHandler itemHandler, Quest quest) { ItemDeliveryQuest request = (ItemDeliveryQuest)quest; bool isValidObjective = ParseOneByObjective(itemHandler.Item.ParentSheetIndex, request.item.Value); bool isValidRecipient = ParseOneByRecipient(npcHandler.Target.Name, request.target.Value); // Clint's Attempt if (request.id.Value == 110 && isValidObjective && npcHandler.Target.Name.Equals("Emily")) { itemHandler.RemoveFromInventory(1); npcHandler.Update(250, true, "Clint"); Update(quest, 0); } else if (isValidRecipient && isValidObjective) { // Robin's Request if (request.id.Value == 113) { bool isValidAmount = Game1.player.hasItemInInventory(itemHandler.Item.ParentSheetIndex, 10); if (isValidAmount) { itemHandler.RemoveFromInventory(10); npcHandler.Update(250, true, null); Update(quest, request.moneyReward.Value); } else { // Remove none and warn WarnAmountLow(request.target.Value, 10); } } else if (quest.dailyQuest.Value) { itemHandler.RemoveFromInventory(1); npcHandler.Update(150, true, null); Update(quest, itemHandler.Item.Price * 3); } else { itemHandler.RemoveFromInventory(1); npcHandler.Update(250, true, null); Update(quest, request.moneyReward.Value); } } }
private void ProcessGift(NpcHandler npcHandler) { string who = npcHandler.Target.Name; if (NpcHandler.CanReceiveGiftToday(who)) { int rating = itemHandler.GiftTasteRating(npcHandler); npcHandler.Update(rating, false, null); itemHandler.RemoveFromInventory(1); } }
private void UpdateLostItemQuest(NpcHandler npcHandler, ItemHandler itemHandler, Quest quest) { if (quest.id.Value == 100 && npcHandler.Target.Name.Equals("Robin") && itemHandler.Item.Name.Equals("Lost Axe")) { // Robin's Lost Axe itemHandler.RemoveFromInventory(1); npcHandler.Update(250, true, null); Update(quest, 250); } else if (quest.id.Value == 102 && npcHandler.Target.Name.Equals("Lewis") && itemHandler.Item.Name.Equals("Lucky Purple Shorts")) { // Mayor's "Shorts" itemHandler.RemoveFromInventory(1); npcHandler.Update(250, true, null); Update(quest, 750); } else if (quest.id.Value == 107 && npcHandler.Target.Name.Equals("Linus") && itemHandler.Item.Name.Equals("Berry Basket")) { // Blackberry Basket itemHandler.RemoveFromInventory(1); npcHandler.Update(250, true, null); Update(quest, 0); } }
private void UpdateFishingQuest(NpcHandler npcHandler, ItemHandler itemHandler, Quest quest) { FishingQuest request = (FishingQuest)quest; bool isValidObjective = ParseOneByObjective(itemHandler.Item.ParentSheetIndex, request.whichFish.Value); bool isValidRecipient = ParseOneByRecipient(npcHandler.Target.Name, request.target.Value); if (isValidObjective && isValidRecipient) { int numberItemsOwed = Config.LazyItemChecking ? request.numberToFish.Value : request.numberToFish.Value - request.numberFished.Value; bool isValidAmount = Game1.player.hasItemInInventory(itemHandler.Item.ParentSheetIndex, numberItemsOwed); if (isValidAmount) { // Remove none npcHandler.Update(0, true, null); Update(quest, request.reward.Value); } else { // Remove none and warn WarnAmountLow(request.target.Value.ToString(), numberItemsOwed); } } }