Example #1
0
        public static bool TryToReceiveActiveObject(NPC __instance, ref Farmer who)
        {
            if (__instance.Name.Equals((object)"Willy"))
            {
                if (who.ActiveObject is Object o)
                {
                    if (Enum.IsDefined(typeof(BaitTackle), o.ParentSheetIndex) && o.Quality == 4)
                    {
                        BaitTackle baitTackle = (BaitTackle)o.ParentSheetIndex;
                        foreach (Quest quest in Game1.player.questLog.Where(q => q.questType.Value == 1 && q.questTitle == DataLoader.I18N.Get($"{baitTackle.ToString()}.Name")))
                        {
                            if (baitTackle != BaitTackle.UnbreakableDressedSpinner)
                            {
                                __instance.CurrentDialogue.Push(new Dialogue(DataLoader.I18N.Get("Quest.CompleteDialog"), __instance));
                            }
                            else
                            {
                                __instance.CurrentDialogue.Push(new Dialogue(DataLoader.I18N.Get("Quest.LastCompleteDialog"), __instance));
                            }

                            Game1.drawDialogue(__instance);
                            Game1.player.reduceActiveItemByOne();
                            quest.questComplete();
                            who.mailReceived.Add(baitTackle.GetQuestName());
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
Example #2
0
        public static string GetDescription(this BaitTackle value)
        {
            var field = value.GetType().GetField(value.ToString());

            var attribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute;

            return(attribute == null?value.ToString() : attribute.Description);
        }
        private string GetRecipeString(string recipe, BaitTackle baitTackle)
        {
            var recipeString = $"{recipe}/Home/{(int)baitTackle} 1/false/null";

            if (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.en)
            {
                recipeString += "/" + I18N.Get($"{baitTackle.ToString()}.Name");
            }
            return(recipeString);
        }
        public static void LoadTackleQuest(BaitTackle baitTackle)
        {
            Quest quest = new Quest();

            quest.id.Value        = (int)baitTackle;
            quest.questType.Value = 1;
            LoadQuestText(quest);
            quest.showNew.Value           = true;
            quest.moneyReward.Value       = 0;
            quest.rewardDescription.Value = (string)null;
            quest.canBeCancelled.Value    = false;
            Game1.player.questLog.Add(quest);
            Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Farmer.cs.2011"), 2));
        }
        private static void LoadQuestText(Quest quest)
        {
            BaitTackle baitTackle     = (BaitTackle)quest.id.Value;
            string     baitTackleName = I18N.Get($"{baitTackle.ToString()}.Name");

            quest.questTitle       = baitTackleName;
            quest.questDescription = I18N.Get("Quest.Description", new { Item = baitTackleName });
            string questObjective;

            if (Game1.player.craftingRecipes.ContainsKey(baitTackle.GetDescription()) &&
                Game1.player.craftingRecipes[baitTackle.GetDescription()] > 0)
            {
                questObjective = "Quest.LastObjective";
            }
            else
            {
                questObjective = "Quest.FirstObjective";
            }

            quest.currentObjective = I18N.Get(questObjective, new { Item = baitTackleName });
        }
 private string AddRecipeData(IDictionary <string, string> data, BaitTackle baitTackle, string recipe)
 {
     return(data[baitTackle.GetDescription()] = GetRecipeString(recipe, baitTackle));
 }
 private void AddLetter(BaitTackle baitTackle, Func <Letter, bool> condition, Action <Letter> callback = null, int whichBG = 0)
 {
     MailDao.SaveLetter(new Letter(baitTackle.ToString() + "Recipe", I18N.Get(baitTackle.ToString() + ".Letter"), baitTackle.GetDescription(), condition, callback, whichBG));
 }
Example #8
0
 public static string GetQuestName(this BaitTackle value)
 {
     return("Quest" + value.ToString());
 }