public static void GenerateMgsv(string MgsvFile, string ModName, string SourceFolder) { ModEntry metaData = new ModEntry(); metaData.Name = ModName; metaData.Author = "SnakeBite"; metaData.MGSVersion.Version = "0.0.0.0"; metaData.SBVersion.Version = "0.8.0.0"; metaData.Version = "[QM]"; metaData.Description = "[Generated by SnakeBite]"; metaData.Website = ""; List<ModFpkEntry> fpkEntries = new List<ModFpkEntry>(); List<ModQarEntry> qarEntries = new List<ModQarEntry>(); foreach(var File in Directory.GetFiles(SourceFolder, "*", SearchOption.AllDirectories)) { string ShortFileName = File.Substring(SourceFolder.Length + 1); if(File.ToLower().Contains(".fpk")) { // do fpk var fpkCont = GzsLib.ListArchiveContents<FpkFile>(File); foreach(var fpkFile in fpkCont) { fpkEntries.Add(new ModFpkEntry() { FpkFile = ShortFileName, FilePath = fpkFile, SourceType = FileSource.Mod }); } } else { // do qar qarEntries.Add(new ModQarEntry() { FilePath = ShortFileName, SourceType = FileSource.Mod }); } } metaData.ModQarEntries = qarEntries; metaData.ModFpkEntries = fpkEntries; metaData.SaveToFile(Path.Combine(SourceFolder, "metadata.xml")); FastZip makeZip = new FastZip(); makeZip.CreateZip(MgsvFile, SourceFolder, true, ".*"); }
public override string GetTitle() { return(ModEntry.GetHelper().Reflection.GetField <string>((stardewMenu as LetterViewerMenu), "mailTitle").GetValue()); }
static void OnSaveGUI(ModEntry modEntry) { settings.Save(modEntry); }
public override void Save(ModEntry modEntry) { ModSettings.Save <Settings>(this, modEntry); }
internal SaveLoadHandler(ModEntry entry) { Entry = entry; }
internal static void LoadData(object s, EventArgs e) { // Only allow the host player to load Adopt & Skin data if (!Context.IsMainPlayer) { SMonitor.Log("Multiplayer Farmhand detected. Adopt & Skin has been disabled.", LogLevel.Debug); return; } // Load skin and category maps ModEntry.SkinMap = SHelper.Data.ReadSaveData <Dictionary <long, int> >("skin-map") ?? new Dictionary <long, int>(); ModEntry.IDToCategory = SHelper.Data.ReadSaveData <Dictionary <long, ModEntry.CreatureCategory> >("id-to-category") ?? new Dictionary <long, ModEntry.CreatureCategory>(); // Load Short ID maps ModEntry.AnimalLongToShortIDs = SHelper.Data.ReadSaveData <Dictionary <long, int> >("animal-long-to-short-ids") ?? new Dictionary <long, int>(); ModEntry.AnimalShortToLongIDs = SHelper.Data.ReadSaveData <Dictionary <int, long> >("animal-short-to-long-ids") ?? new Dictionary <int, long>(); // Set up maps if save data is from an older A&S if (ModEntry.SkinMap.Count == 0) { LoadSkinsOldVersion(); } // Load received first pet/horse status ModEntry.Creator.FirstHorseReceived = bool.Parse(SHelper.Data.ReadSaveData <string>("first-horse-received") ?? "false"); ModEntry.Creator.FirstPetReceived = bool.Parse(SHelper.Data.ReadSaveData <string>("first-pet-received") ?? "false"); Entry.CheckForFirstPet(null, null); Entry.CheckForFirstHorse(null, null); // Refresh skins via skinmap LoadCreatureSkins(); // Make sure Marnie's cows put some clothes on foreach (GameLocation loc in Game1.locations) { if (loc is Forest forest) { foreach (FarmAnimal animal in forest.marniesLivestock) { string type = ModApi.GetInternalType(animal); if (ModApi.HasSkins(type)) { int[] spriteInfo = ModApi.GetSpriteInfo(animal); AnimalSkin skin = ModEntry.GetSkin(type, ModEntry.GetRandomSkin(type)); animal.Sprite = new AnimatedSprite(skin.AssetKey, spriteInfo[0], spriteInfo[1], spriteInfo[2]); } } } } // Set configuration for walk-through pets foreach (Pet pet in ModApi.GetPets()) { if (!ModApi.IsStray(pet)) { if (ModEntry.Config.WalkThroughPets) { pet.farmerPassesThrough = true; } else { pet.farmerPassesThrough = false; } } } // Set last known animal count ModEntry.AnimalCount = Game1.getFarm().getAllFarmAnimals().Count; // Add Adopt & Skin to the update loop StartUpdateChecks(); }
public CategorizeChestsModule(ModEntry modEntry) : base(modEntry) { }
public static void Initialize(ModEntry main) { Main = main; }
public virtual void OnModToggle(ModEntry modEntry, bool value) { }
public HarvestableCropHoeDirtGrabber(ModEntry mod, GameLocation location) : base(mod, location) { }
/// <summary> /// Constructor. /// </summary> /// <param name="entry">Instance of ModEntry.</param> /// <param name="packHelper">Instance of ContentPackHelper</param> /// <param name="asset">Current asset being edited.</param> public HairEditor(ModEntry entry, ContentPackHelper packHelper, IAssetData asset) { Entry = entry; PackHelper = packHelper; Asset = asset; }
/// <summary>Image Injectors Constructor</summary> /// <param name="entry"></param> /// <param name="packHelper"></param> public ImageInjector(ModEntry entry, ContentPackHelper packHelper) { //Set the vars to the instances Entry = entry; PackHelper = packHelper; }
public ModAPI(ModEntry mod) { Mod = mod; }
/// <summary>AccessoryPatch's Constructor</summary> /// <param name="entry">The instance of ModEntry</param> public AccessoryPatch(ModEntry entry) { //Set the field Entry = entry; }
public static void AddMod(ModEntry Mod) { Settings settings = new Settings(); settings.Load(); foreach (ModFpkEntry f in Mod.ModFpkEntries) { f.SourceType = FileSource.Mod; f.FpkFile = Tools.ToQarPath(f.FpkFile); f.FilePath = Tools.ToQarPath(f.FilePath); } foreach (ModQarEntry q in Mod.ModQarEntries) { q.SourceType = FileSource.Mod; q.FilePath = Tools.ToQarPath(q.FilePath); } settings.ModEntries.Add(Mod); settings.Save(); }
private string GetTranslation(string key) { return(ModEntry.GetInstance().Helper.Translation.Get(key)); }
public FarmCaveMushroomGrabber(ModEntry mod, GameLocation location) : base(mod, location) { GetMushroomHarvest = Mod.Api.GetMushroomHarvest ?? DefaultGetMushroomHarvest; }
private ContextMenu CreateModListContextMenu(ModEntry m, ModTag tag) { var menu = new ContextMenu(); if (m?.ID == null || tag == null) { return(menu); } // change color var changeColorItem = new MenuItem("Change color"); var editColor = new MenuItem("Edit"); editColor.Click += (sender, e) => { var colorPicker = new ColorDialog { AllowFullOpen = true, Color = tag.Color, AnyColor = true, FullOpen = true }; if (colorPicker.ShowDialog() == DialogResult.OK) { tag.Color = colorPicker.Color; } }; changeColorItem.MenuItems.Add(editColor); var makePastelItem = new MenuItem("Make pastel"); makePastelItem.Click += (sender, e) => tag.Color = tag.Color.GetPastelShade(); changeColorItem.MenuItems.Add(makePastelItem); var changeShadeItem = new MenuItem("Random shade"); changeShadeItem.Click += (sender, e) => tag.Color = tag.Color.GetRandomShade(0.33, 1.0); changeColorItem.MenuItems.Add(changeShadeItem); var randomColorItem = new MenuItem("Random color"); randomColorItem.Click += (sender, e) => tag.Color = ModTag.RandomColor(); changeColorItem.MenuItems.Add(randomColorItem); menu.MenuItems.Add(changeColorItem); menu.MenuItems.Add("-"); // renaming tags var renameTagItem = new MenuItem($"Rename '{tag.Label}'"); renameTagItem.Click += (sender, e) => RenameTagPrompt(m, tag, false); menu.MenuItems.Add(renameTagItem); var renameAllTagItem = new MenuItem($"Rename all '{tag.Label}'"); renameAllTagItem.Click += (sender, e) => RenameTagPrompt(m, tag, true); menu.MenuItems.Add(renameAllTagItem); menu.MenuItems.Add("-"); // removing tags var removeTagItem = new MenuItem($"Remove '{tag.Label}'"); removeTagItem.Click += (sender, args) => m.Tags.Remove(tag.Label); menu.MenuItems.Add(removeTagItem); var removeAllTagItem = new MenuItem($"Remove all '{tag.Label}'"); removeAllTagItem.Click += (sender, args) => { if (MessageBox.Show($@"Are you sure you want to remove all instances of tag '{tag.Label}'?", @"Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } foreach (var mod in Mods.All) { for (int i = 0; i < mod.Tags.Count; ++i) { if (mod.Tags[i].ToLower().Equals(tag.Label.ToLower())) { mod.Tags.RemoveAt(i--); } } } }; menu.MenuItems.Add(removeAllTagItem); return(menu); }
private ContextMenu CreateModListContextMenu(ModEntry m, OLVListItem currentItem) { var menu = new ContextMenu(); if (m?.ID == null) { return(menu); } var selectedMods = ModList.SelectedObjects.ToList(); MenuItem renameItem = null; MenuItem showInExplorerItem = null; MenuItem showOnSteamItem = null; MenuItem showInBrowser = null; MenuItem fetchWorkshopTagsItem = null; MenuItem enableAllItem = null; MenuItem disableAllItem = null; MenuItem disableDuplicates = null; MenuItem restoreDuplicates = null; // create items that appear only when a single mod is selected if (selectedMods.Count == 1) { renameItem = new MenuItem("Rename"); renameItem.Click += (a, b) => { modlist_ListObjectListView.EditSubItem(currentItem, olvcName.Index); }; showInExplorerItem = new MenuItem("Show in Explorer", delegate { m.ShowInExplorer(); }); menu.MenuItems.Add(showInExplorerItem); if (m.WorkshopID > 0) { showOnSteamItem = new MenuItem("Show on Steam", delegate { m.ShowOnSteam(); }); menu.MenuItems.Add(showOnSteamItem); showInBrowser = new MenuItem("Show in Browser", delegate { m.ShowInBrowser(); }); menu.MenuItems.Add(showInBrowser); } var duplicateMods = Mods.All.Where(mod => mod.ID == m.ID && mod != m).ToList(); if (duplicateMods.Any()) { if (!m.State.HasFlag(ModState.DuplicatePrimary)) { disableDuplicates = new MenuItem("Prefer this duplicate"); disableDuplicates.Click += delegate { // disable all other duplicates foreach (var duplicate in duplicateMods) { duplicate.DisableModFile(); duplicate.RemoveState(ModState.DuplicateID); duplicate.RemoveState(ModState.DuplicatePrimary); duplicate.AddState(ModState.DuplicateDisabled); duplicate.isActive = false; modlist_ListObjectListView.RefreshObject(duplicate); } // mark selected mod as primary duplicate m.EnableModFile(); m.RemoveState(ModState.DuplicateID); m.RemoveState(ModState.DuplicateDisabled); m.AddState(ModState.DuplicatePrimary); m.isActive = true; modlist_ListObjectListView.RefreshObject(m); ProcessModListItemCheckChanged(m); }; } if (m.State.HasFlag(ModState.DuplicatePrimary) || m.State.HasFlag(ModState.DuplicateDisabled)) { restoreDuplicates = new MenuItem("Restore duplicates"); restoreDuplicates.Click += delegate { // restore normal duplicate state foreach (var duplicate in duplicateMods) { duplicate.EnableModFile(); duplicate.RemoveState(ModState.DuplicateDisabled); duplicate.RemoveState(ModState.DuplicatePrimary); duplicate.AddState(ModState.DuplicateID); duplicate.isActive = false; modlist_ListObjectListView.RefreshObject(duplicate); } // mark selected mod as primary duplicate m.EnableModFile(); m.RemoveState(ModState.DuplicateDisabled); m.RemoveState(ModState.DuplicatePrimary); m.AddState(ModState.DuplicateID); m.isActive = false; modlist_ListObjectListView.RefreshObject(m); ProcessModListItemCheckChanged(m); }; } } } MenuItem addTagItem = new MenuItem("Add tag(s)..."); addTagItem.Click += (sender, args) => { var newTag = Interaction.InputBox($"Please specify one or more tags (separated by a semicolon) that should be added to {selectedMods.Count} selected mod(s).", "Add tag(s)"); if (newTag == "") { return; } var tags = newTag.Split(';'); foreach (ModEntry mod in modlist_ListObjectListView.SelectedObjects) { foreach (string tag in tags) { AddTag(mod, tag.Trim()); } } }; // Move to ... var moveToCategoryItem = new MenuItem("Move to category..."); // ... new category moveToCategoryItem.MenuItems.Add("New category", delegate { var category = Interaction.InputBox("Please enter the name of the new category", "Create category", "New category"); if (string.IsNullOrEmpty(category)) { return; } MoveSelectedModsToCategory(category); }); moveToCategoryItem.MenuItems.Add("-"); // ... existing category foreach (var category in Settings.Mods.CategoryNames.OrderBy(c => c)) { if (category == Mods.GetCategory(m)) { continue; } moveToCategoryItem.MenuItems.Add(category, delegate { MoveSelectedModsToCategory(category); }); } // Hide/unhide var toggleVisibility = new MenuItem { Text = m.isHidden ? "Unhide" : "Hide" }; toggleVisibility.Click += delegate { // save as new list so we can remove mods if they are being hidden foreach (var mod in selectedMods) { mod.isHidden = !m.isHidden; if (!Settings.ShowHiddenElements && mod.isHidden) { modlist_ListObjectListView.RemoveObject(mod); } else { modlist_ListObjectListView.RefreshObject(mod); } } }; // Update mods var updateItem = new MenuItem("Update", delegate { if (IsModUpdateTaskRunning) { ShowModUpdateRunningMessageBox(); return; } UpdateMods(selectedMods); }); if (selectedMods.Any(mod => mod.WorkshopID > 0)) { List <ModEntry> modsToUpdate = new List <ModEntry>(selectedMods.Where(mod => mod.WorkshopID > 0)); fetchWorkshopTagsItem = new MenuItem("Use workshop tags"); fetchWorkshopTagsItem.Click += delegate { if (modsToUpdate.Count > 1) { var result = MessageBox.Show($"Tags from the workshop will replace the existing tags for {modsToUpdate.Count} mods." + Environment.NewLine + "Do you want to continue?", "Use workshop tags", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result != DialogResult.Yes) { return; } } Log.Info($"Using workshop tags for {modsToUpdate.Count} mods."); foreach (var selItem in modsToUpdate) { var tags = selItem.SteamTags; if (tags.Any()) { selItem.Tags.Clear(); foreach (string tag in tags) { AddTag(selItem, tag); } } } }; } if (selectedMods.Any(mod => !mod.isActive)) { enableAllItem = new MenuItem("Enable"); enableAllItem.Click += delegate { Cursor.Current = Cursors.WaitCursor; foreach (var mod in selectedMods) { modlist_ListObjectListView.CheckObject(mod); } Cursor.Current = Cursors.Default; }; } if (selectedMods.Any(mod => mod.isActive)) { disableAllItem = new MenuItem("Disable"); disableAllItem.Click += delegate { Cursor.Current = Cursors.WaitCursor; foreach (var mod in selectedMods) { modlist_ListObjectListView.UncheckObject(mod); } Cursor.Current = Cursors.Default; }; } var deleteItem = new MenuItem("Delete / Unsubscribe", delegate { DeleteMods(); }); // create menu structure if (enableAllItem != null) { menu.MenuItems.Add(enableAllItem); } if (disableAllItem != null) { menu.MenuItems.Add(disableAllItem); } if (renameItem != null) { menu.MenuItems.Add(renameItem); } menu.MenuItems.Add(updateItem); menu.MenuItems.Add("-"); menu.MenuItems.Add(addTagItem); if (fetchWorkshopTagsItem != null) { menu.MenuItems.Add(fetchWorkshopTagsItem); } menu.MenuItems.Add(moveToCategoryItem); menu.MenuItems.Add("-"); if (showInExplorerItem != null) { menu.MenuItems.Add(showInExplorerItem); } if (showOnSteamItem != null) { menu.MenuItems.Add(showOnSteamItem); } if (showInBrowser != null) { menu.MenuItems.Add(showInBrowser); } // prevent double separator if (menu.MenuItems[menu.MenuItems.Count - 1].Text != @"-") { menu.MenuItems.Add("-"); } menu.MenuItems.Add(toggleVisibility); menu.MenuItems.Add(deleteItem); if (Settings.EnableDuplicateModIdWorkaround) { if (disableDuplicates != null) { menu.MenuItems.Add("-"); menu.MenuItems.Add(disableDuplicates); } if (restoreDuplicates != null) { // prevent double separator if (menu.MenuItems[menu.MenuItems.Count - 1] != disableDuplicates) { menu.MenuItems.Add("-"); } menu.MenuItems.Add(restoreDuplicates); } } return(menu); }
private void CheckSteamForNewMods() { status_toolstrip_label.Text = "Checking for new mods..."; ulong[] subscribedIDs; try { subscribedIDs = Workshop.GetSubscribedItems(); } catch (InvalidOperationException) { // Steamworks not initialized? // Game taking over? status_toolstrip_label.Text = "Error checking for new mods."; return; } var change = false; foreach (var id in subscribedIDs) { var status = Workshop.GetDownloadStatus(id); if (status.HasFlag(EItemState.k_EItemStateInstalled)) { // already installed continue; } if (Downloads.Any(d => d.WorkshopID == (long)id)) { // already observing continue; } // Get info var detailsRequest = new ItemDetailsRequest(id).Send().WaitForResult(); var details = detailsRequest.Result; var link = detailsRequest.GetPreviewURL(); var downloadMod = new ModEntry { Name = details.m_rgchTitle, DateCreated = DateTimeOffset.FromUnixTimeSeconds(details.m_rtimeCreated).DateTime, DateUpdated = DateTimeOffset.FromUnixTimeSeconds(details.m_rtimeUpdated).DateTime, //Path = Path.Combine(Settings.GetWorkshopPath(), "" + id), Image = link, Source = ModSource.SteamWorkshop, WorkshopID = (int)id, State = ModState.New | ModState.NotInstalled }; // Start download Workshop.DownloadItem(id); // Downloads.Add(downloadMod); change = true; } if (change) { RefreshModList(); } status_toolstrip_label.Text = StatusBarIdleString; }
public InternalTarget(RefinementItem item) : base(-1, false, TargetFlags.None) { m_Item = item; m_Entry = item.Entry; }
/// <summary>Adds creatures into the system based on the data from older versions' save files or for files new to A&S.</summary> internal static void LoadSkinsOldVersion() { Dictionary <Character, int> creaturesToAdd = new Dictionary <Character, int>(); // Load pet information stored from older version formats Dictionary <long, int> petSkinMap = SHelper.Data.ReadSaveData <Dictionary <long, int> >("pet-skin-map") ?? new Dictionary <long, int>(); foreach (Pet pet in ModApi.GetPets()) { if (ModApi.IsStray(pet)) { Game1.removeThisCharacterFromAllLocations(pet); continue; } long longID = ModEntry.GetLongID(pet); // Pet unregistered if (longID == 0) { creaturesToAdd.Add(pet, 0); } // Pet registered in previous system else if (petSkinMap.ContainsKey(longID)) { creaturesToAdd.Add(pet, petSkinMap[longID]); } // Reset any previous known ShortID pet.Manners = 0; } // Load horse information stored from older version formats Dictionary <long, int> horseSkinMap = SHelper.Data.ReadSaveData <Dictionary <long, int> >("horse-skin-map") ?? new Dictionary <long, int>(); foreach (Horse horse in ModApi.GetHorses()) { if (ModApi.IsWildHorse(horse)) { Game1.removeThisCharacterFromAllLocations(horse); continue; } else if (!ModApi.IsNotATractor(horse)) { continue; } long longID = ModEntry.GetLongID(horse); // Horse unregistered if (longID == 0) { creaturesToAdd.Add(horse, 0); } // Horse registered in previous system else if (horseSkinMap.ContainsKey(longID)) { creaturesToAdd.Add(horse, horseSkinMap[longID]); } // Reset any previous known ShortID horse.Manners = 0; } // Load animal information stored from older version formats Dictionary <long, int> animalSkinMap = SHelper.Data.ReadSaveData <Dictionary <long, int> >("animal-skin-map") ?? new Dictionary <long, int>(); ModEntry.AnimalLongToShortIDs = new Dictionary <long, int>(); ModEntry.AnimalShortToLongIDs = new Dictionary <int, long>(); foreach (FarmAnimal animal in ModApi.GetAnimals()) { long longID = ModEntry.GetLongID(animal); // Animal registered in previous system if (animalSkinMap.ContainsKey(longID)) { creaturesToAdd.Add(animal, animalSkinMap[longID]); } // Animal unregistered else { creaturesToAdd.Add(animal, 0); } } // Add in all creatures from older systems foreach (KeyValuePair <Character, int> creatureInfo in creaturesToAdd) { Entry.AddCreature(creatureInfo.Key, creatureInfo.Value); } }
public RefinementGump(RefinementItem item) : base(50, 50) { m_Item = item; m_Entry = item.Entry; if (m_Entry == null) { return; } AddBackground(0, 0, 400, 350, 83); int y = 70; m_CanRefine = true; AddHtmlLocalized(10, 10, 200, 20, 1154094, DarkGreen, false, false); // Refinement Crafting Options AddHtmlLocalized(10, 35, 200, 20, 1153967, m_Item.GetNameArgs(), DarkGreen, false, false); for (int i = 0; i < m_Item.ModAmount; i++) { AddButton(15, y, 4005, 4007, i + 100, GumpButtonType.Reply, 0); AddHtmlLocalized(55, y, 150, 16, 1154097 + i, WhiteLabel, false, false); // CHOOSE RESIST #1 AddHtmlLocalized(230, y, 150, 16, GetResistanceLabel(m_Entry.Resists[i], m_Entry.Values[i]), WhiteLabel, false, false); if (!m_Item.CheckBonus && i == m_Item.ModAmount - 1 && m_Item.GetBonusChance() > 0) { if (Utility.Random(100) <= m_Item.GetBonusChance()) { m_Item.ModAmount++; } m_Item.CheckBonus = true; } if (m_CanRefine && m_Entry.Values[i] == 0) { m_CanRefine = false; } y += 20; } y += 50; AddHtmlLocalized(10, y, 150, 16, 1154106, Yellow, false, false); // MODIFICATIONS: AddHtmlLocalized(170, y, 10, 16, 1114057, m_Item.ModAmount.ToString(), Yellow, false, false); if (m_CanRefine) { AddHtmlLocalized(230, y, 150, 16, 1154105, WhiteLabel, false, false); // REFINE ITEM AddButton(360, y, 4014, 4016, 1, GumpButtonType.Reply, 0); } else { AddHtmlLocalized(230, y, 150, 16, 1154108, WhiteLabel, false, false); // SELECT RESISTS } y += 25; AddHtmlLocalized(10, y, 200, 16, 1154107, WhiteLabel, false, false); // BONUS MOD CHANCE: AddHtmlLocalized(170, y, 15, 16, 1114057, m_Item.GetBonusChance().ToString() + "%", WhiteLabel, false, false); AddButton(10, 320, 4017, 4019, 0, GumpButtonType.Reply, 0); AddHtmlLocalized(50, 320, 100, 16, 3002084, WhiteLabel, false, false); // Close AddHtmlLocalized(250, 320, 100, 16, 3000391, WhiteLabel, false, false); // Help AddButton(360, 320, 4011, 4013, 2, GumpButtonType.Reply, 0); }
public static bool Prefix(NPC __instance, int timeOfDay, ref Point ___previousEndPoint, ref string ___extraDialogueMessageToAddThisMorning, ref SchedulePathDescription ___directionsToNewLocation, ref Rectangle ___lastCrossroad, ref NetString ___endOfRouteBehaviorName) { if (!ModEntry.IsChildNPC(__instance)) { return(true); } var scheduleTimeToTry = ModEntry.helper.Reflection.GetField <int>(__instance, "scheduleTimeToTry"); __instance.updatedDialogueYet = false; ___extraDialogueMessageToAddThisMorning = null; if (__instance.ignoreScheduleToday || __instance.Schedule == null) { return(false); } __instance.Schedule.TryGetValue(scheduleTimeToTry.GetValue() == 9999999 ? timeOfDay : scheduleTimeToTry.GetValue(), out SchedulePathDescription schedulePathDescription); //If I have curfew, override the normal behavior if (ModEntry.Config.DoChildrenHaveCurfew && !__instance.currentLocation.Equals(Game1.getLocationFromName("FarmHouse"))) { //Send child home for curfew if (timeOfDay == ModEntry.Config.CurfewTime) { object[] pathfindParams = { __instance.currentLocation.Name, __instance.getTileX(), __instance.getTileY(), "BusStop", -1, 23, 3, null, null }; schedulePathDescription = ModEntry.helper.Reflection.GetMethod(__instance, "pathfindToNextScheduleLocation", true).Invoke <SchedulePathDescription>(pathfindParams); } //Ignore scheduled events after curfew else if (timeOfDay > ModEntry.Config.CurfewTime) { schedulePathDescription = null; } } if (schedulePathDescription == null) { return(false); } //Normally I would see a IsMarried check here, but FarmHouse may be better? //(I think this section is meant for handling when the character is still walking) if (!__instance.currentLocation.Equals(Game1.getLocationFromName("FarmHouse")) || !__instance.IsWalkingInSquare || ___lastCrossroad.Center.X / 64 != ___previousEndPoint.X && ___lastCrossroad.Y / 64 != ___previousEndPoint.Y) { if (!___previousEndPoint.Equals(Point.Zero) && !___previousEndPoint.Equals(__instance.getTileLocationPoint())) { if (scheduleTimeToTry.GetValue() == 9999999) { scheduleTimeToTry.SetValue(timeOfDay); } return(false); } } ___directionsToNewLocation = schedulePathDescription; //__instance.prepareToDisembarkOnNewSchedulePath(); ModEntry.helper.Reflection.GetMethod(__instance, "prepareToDisembarkOnNewSchedulePath", true).Invoke(null); if (__instance.Schedule == null) { return(false); } if (___directionsToNewLocation != null && ___directionsToNewLocation.route != null && ___directionsToNewLocation.route.Count > 0 && (Math.Abs(__instance.getTileLocationPoint().X - ___directionsToNewLocation.route.Peek().X) > 1 || Math.Abs(__instance.getTileLocationPoint().Y - ___directionsToNewLocation.route.Peek().Y) > 1) && __instance.temporaryController == null) { scheduleTimeToTry.SetValue(9999999); return(false); } __instance.controller = new PathFindController(___directionsToNewLocation.route, __instance, Utility.getGameLocationOfCharacter(__instance)) { finalFacingDirection = ___directionsToNewLocation.facingDirection, //endBehaviorFunction = this.getRouteEndBehaviorFunction(this.directionsToNewLocation.endOfRouteBehavior, this.directionsToNewLocation.endOfRouteMessage) endBehaviorFunction = ModEntry.helper.Reflection.GetMethod(__instance, "getRouteEndBehaviorFunction", true).Invoke <PathFindController.endBehavior>(new object[] { __instance.DirectionsToNewLocation.endOfRouteBehavior, __instance.DirectionsToNewLocation.endOfRouteMessage }) }; scheduleTimeToTry.SetValue(9999999); if (___directionsToNewLocation != null && ___directionsToNewLocation.route != null) { ___previousEndPoint = ___directionsToNewLocation.route.Count > 0 ? ___directionsToNewLocation.route.Last() : Point.Zero; } return(false); }
public virtual void Save(ModEntry modEntry) { Save(this, modEntry); }
public static bool OnToggle(ModEntry modEntry, bool value) { enabled = value; return(true); }
public virtual string GetPath(ModEntry modEntry) { return(Path.Combine(modEntry.Path, "Settings.xml")); }
private void WhatFlagIsHoisted(Farmer who) { string flagName = AncientFlag.GetFlagName(ModEntry.GetHoistedFlag()); if (ModEntry.modHelper.Translation.LocaleEnum == LocalizedContentManager.LanguageCode.en) { flagName = flagName.Replace("The", "the"); if (!flagName.Contains("the")) { flagName = String.Concat("the", " ", flagName); } } this.CurrentDialogue.Push(new Dialogue(GetDialogue("dialogue.what_flag_is_hoisted" + (ModEntry.GetHoistedFlag() == FlagType.Unknown ? "_None" : ""), flagName), this)); Game1.drawDialogue(this); }
public static void Save <T>(T data, ModEntry modEntry) where T : ModSettings, new() { Save <T>(data, modEntry, null); }
/// <summary> /// SaveLoadMenuPatcher's Constructor. /// </summary> /// <param name="entry">The instance of ModEntry</param> /// <param name="playerLoader">The instance of CharacterLoader</param> public SaveLoadMenuPatcher(ModEntry entry, CharacterLoader playerLoader) { Entry = entry; PlayerLoader = playerLoader; }
public SeedTreeGrabber(ModEntry mod, GameLocation location) : base(mod, location) { }
public static void RemoveMod(ModEntry Mod) { Settings settings = new Settings(); settings.Load(); ModEntry remMod = settings.ModEntries.Find(entry => entry.Name == Mod.Name); settings.ModEntries.Remove(remMod); settings.Save(); }
public string Get(string key) { return(ModEntry.GetInstance().Helper.Translation.Get(key)); }