public static void AddsQuestForTackle(string command, string[] args) { if (Context.IsWorldReady) { if (args.Length > 0) { string tackleName = String.Join(" ", args); BaitTackle?baitTackle = BaitTackleExtension.GetFromDescription(tackleName); if (baitTackle.HasValue) { DataLoader.LoadTackleQuest(baitTackle.Value); ModMonitor.Log($"Quest for {baitTackle.Value.GetDescription()} added to the player.", LogLevel.Info); } else { ModMonitor.Log($"Invalid tackle name: {tackleName}", LogLevel.Info); } } else { ModMonitor.Log($"No tackle name was given to the command.", LogLevel.Info); } } else { ModMonitor.Log("No player add quest for.", LogLevel.Info); } }
public static bool CreateItem(CraftingRecipe __instance, ref Item __result) { BaitTackle?baitTackle = BaitTackleExtension.GetFromDescription(__instance.name); if (baitTackle.HasValue) { Object _Object = new Object(Vector2.Zero, (int)baitTackle.Value, 1); _Object.Quality = 4; __result = _Object; return(false); } return(true); }
public static bool ClickCraftingRecipe(CraftingPage __instance, ref ClickableTextureComponent c) { CraftingRecipe craftingRecipe = DataLoader.Helper.Reflection.GetField <List <Dictionary <ClickableTextureComponent, CraftingRecipe> > >(__instance, "pagesOfCraftingRecipes").GetValue()[DataLoader.Helper.Reflection.GetField <int>(__instance, "currentCraftingPage").GetValue()][c]; BaitTackle?baitTackle = BaitTackleExtension.GetFromDescription(craftingRecipe.name); if (baitTackle.HasValue) { foreach (Quest quest in Game1.player.questLog.Where(q => q.questType.Value == 1 && q.questTitle == craftingRecipe.name)) { quest.currentObjective = DataLoader.I18N.Get("Quest.LastObjective", new { Item = craftingRecipe.DisplayName }); Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Quest.cs.13636"), 2)); } } return(true); }