public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Strings/Events")) { var data = asset.AsDictionary <string, string>().Data; data[nameof(AnimalBirth)] = Helper.Translation.Get("Strings.Events.AnimalBirth"); data["AnimalNamingTitle"] = Content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11357"); } if (!asset.AssetNameEquals("Strings/Locations")) { return; } var data1 = asset.AsDictionary <string, string>().Data; data1["AnimalHouse_Incubator_Hatch_RegularEgg"] = Helper.Translation.Get("Strings.Locations.AnimalHouse_Incubator_Hatch"); data1["AnimalHouse_Incubator_Hatch_VoidEgg"] = Helper.Translation.Get("Strings.Locations.AnimalHouse_Incubator_Hatch"); data1["AnimalHouse_Incubator_Hatch_DuckEgg"] = Helper.Translation.Get("Strings.Locations.AnimalHouse_Incubator_Hatch"); data1["AnimalHouse_Incubator_Hatch_DinosaurEgg"] = Helper.Translation.Get("Strings.Locations.AnimalHouse_Incubator_Hatch"); data1["AnimalHouse_Incubator_Hatch_OstrichEgg"] = Helper.Translation.Get("Strings.Locations.AnimalHouse_Incubator_Hatch"); }
/// <summary> /// Edits the assets to be reconstructed to their proper form for SVE. Edits the disposition and the /// gift taste of the targeted NPCs. /// </summary> /// <typeparam name="T">The generic asset type.</typeparam> /// <param name="asset">The asset data to edit.</param> public void Edit <T>(IAssetData asset) { var data = asset.AsDictionary <string, string>().Data; if (asset.AssetNameEquals("Data/NPCDispositions")) { data["Marlon"] = "adult/neutral/neutral/positive/male/not-datable/null/Town/winter 5//AdventureGuild 6 13/Marlon"; if (Game1.MasterPlayer != null && !Game1.MasterPlayer.hasCompletedCommunityCenter()) { data["Morris"] = "adult/polite/neutral/negative/male/not-datable/null/Town/summer 1//JojaMart 27 26/Morris"; } } else if (asset.AssetNameEquals("Data/NPCGiftTastes")) { data["Marlon"] = "This is a mighty gift, @. Thank you./244 413 437 439 680/Thanks. I'll find some use of this./346 303 348 459 205 422 287 288/Hmmm... that will be a hard pass. My apologies./-81/This unfortunately doesn't suit me./-80 283 233/Thanks./286 424 426 436 438 803 184 186 420 -28/"; if (Game1.MasterPlayer != null && !Game1.MasterPlayer.hasCompletedCommunityCenter()) { data["Morris"] = "Ah! A gift worthy of my attention. Thank you, @./730 727 432 578/This is delightful!/72 348 430 428/I don't like this.../346 459 303 -81/What a despicable gift. Get this away from me./167 -74/That's generous of you./-75 -79 -80/"; } } //Throw an error to the smapi console if we can't edit the assets else { throw new InvalidOperationException($"Unexpected asset '{asset.AssetName}'"); } }
/// <summary>Edit a matched asset.</summary> /// <param name="asset">A helper which encapsulates metadata about an asset and enables changes to it.</param> public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Data/NPCDispositions")) { var data = asset.AsDictionary <string, string>().Data; data["Marlon"] = "adult/neutral/outgoing/neutral/male/not-datable/Marnie/Town/fall 8/Wizard ''/AdventureGuild 8 4/Marlon"; data["Gunther"] = "adult/polite/neutral/negative/male/not-datable/null/Town/spring 22/Marlon ''/ArchaeologyHouse 12 32/Gunther"; } else if (asset.AssetNameEquals("Data/Events/Mine")) { var data = asset.AsDictionary <string, string>().Data; data["734039/f Marlon 1750/t 1000 1400"] = "MarlonsTheme/21 9/farmer 19 0 0 Marlon 23 6 2/skippable/pause 1000/warp farmer 18 13/move farmer 0 -5 0/faceDirection farmer 1/speak Marlon \"*sigh*... \"/pause 500/move farmer 0 -2 1/move farmer 4 0 1/pause 500/showFrame Marlon 0/pause 500/speak Marlon \"I was just thinking about something that happened a long time ago.#$b#Did you know that I used to have a family? A wife, a son, even a dog.\"/pause 500/showFrame Marlon 4/speak Marlon \"We were all adventurous, of course. My son and I would go down to the bottom of the mines once a week to explore.#$b#It was the best time of my life.\"/pause 500/showFrame Marlon 0/pause 500/speak Marlon \"But then he was swarmed by shadow beasts, one day. They ripped him apart right in front of me...\"/pause 500/speak Marlon \"I still can't bear to think about it. I lost my leg trying to save him, but it was too late.\"/pause 500/speak Marlon \"As if my life wasn't already destroyed, my wife blamed me for his death and left me.#$b#For a long time, I avoided the mines. No one else used them, so they fell into ruin and more and more monsters came.#$b#But then you came along, and you started exploring them.\"/pause 1000/speak Marlon \"I finally got over my fear of the mines, so I've been exploring them too.#$b#I can't thank you enough for finally showing me how to live again.\"/pause 300/speak Marlon \"Anyway, I'll let you go. That was just on my mind so I wanted to share it.\"/pause 500/end"; } else if (asset.AssetNameEquals("Data/Events/ArchaeologyHouse")) { var data = asset.AsDictionary <string, string>().Data; data["5478328/f Gunther 2000/t 1600 1800/e 66"] = "libraryTheme/43 5/farmer 47 8 0 Gunther 47 4 2/skippable/pause 1000/move farmer 0 -2 0/speak Gunther \"Oh, greetings @. \"/pause 500/speak Gunther \"I'm just taking in the fact that I finally fulfilled my dream.#$b#I honestly didn't expect this museum would be successful once I learned that the other curator took all the artifacts.#$b#And it wouldn't have been, if it wasn't for your help.\"/pause 500/speak Gunther \"I hope the key proved useful. I really don't know how else I can thank you. This museum means the world to me.#$b#I used to live in the city, working at an insurance company. I hurt so many people.#$b#Apologies for my harsh language, but I absolutely despise big corporations like Joja. They ruin people's lives just to keep shareholders happy.#$b#I was working for a company like that. We didn't help people. I left because I wanted to do something good for the world.\"/pause 500/faceDirection Gunther 3/pause 1000/faceDirection Gunther 2/speak Gunther \"I've always loved history, and I strongly believe that we can improve our world today by learning about our past.#$b#I was also having a bit of a midlife crisis, if I'm being honest.#$b#When I heard that there was a museum for sale, I decided to spend all of the money I had made from my insurance job to purchase it.#$b#Of course, it had a full collection of artifacts and books at the time. I learned soon after I paid for it that they were gone.#$b#No one came here, so I was constantly in the red. That's why I haven't been able to make any improvements around here, and why I don't even have somewhere to sleep.#$b#But that's all changed, thanks to you. The museum is thriving now. So thank you.#$b#I'm glad I've made a friend here. Have a good evening, @.\"/pause 500/end"; } else if (asset.AssetNameEquals("Data/NPCGiftTastes")) { var data = asset.AsDictionary <string, string>().Data; data["Marlon"] = "Wow, you're giving this to me? I can't believe it./559 560 561 562 563/Thanks for the great gift!/542 543 544 545 546/This isn't the best gift I've ever received.../450 436 420 384 382/I'd rather lose my other eye than look at this./226 203 196 80 24/Thanks!// "; data["Gunther"] = "I love this. I'll definitely add it to my personal collection./101 102 103 104 105 106 107 108 109 110/I appreciate that you got me this./80 82 84 86/I already have this in my collection, but thanks./60 62 64 68/Honestly, I really don't like this./2 4 75 76 77 78/Thank you./378 380 384 386/ "; } else { throw new InvalidOperationException($"Unexpected asset '{asset.AssetName}'."); } }
/// <summary>Edit a matched asset.</summary> /// <param name="asset">A helper which encapsulates metadata about an asset and enables changes to it.</param> public void Edit <T>(IAssetData asset) { // change crop seasons; based on user config if (asset.AssetNameEquals("Data/Crops")) { asset .AsDictionary <int, string>() .Set((id, data) => { string[] fields = data.Split('/'); if (!this.Config.WinterAliveEnabled) { fields[1] = "spring summer fall"; } else { fields[1] = "spring summer fall winter"; } return(string.Join("/", fields)); }); } // change dirt texture else if (asset.AssetNameEquals("TerrainFeatures/hoeDirtSnow") && this.Config.WinterHoeSnow) //Allows users to set plowed snow or dirt in winter { asset.ReplaceWith(this.Helper.Content.Load <Texture2D>("TerrainFeatures/hoeDirt", ContentSource.GameContent)); } }
// Actually editing said asset data public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Data/NPCDispositions")) { asset.AsDictionary <string, string>().Data["Astra"] = "adult/neutral/neutral/negative/female/datable/null/Town/summer 2/Maru ''/Saloon 33 6/Astra"; } if (asset.AssetNameEquals("Data/NPCGiftTastes")) { IDictionary <string, string> NPCGiftTastes = asset.AsDictionary <string, string>().Data; NPCGiftTastes["Astra"] = "I'm not sure what I've done to deserve this, but thank you very much. This is amazing./206 211 395" + "/For me? That is very nice of you, thank you./109 305 578" + "/You're giving this to me? I suppose I could find a purpose for it.../346 773" + "/I'd rather you not give that to me. The garbage can is over there./60 548 560" + "/Oh, thank you./203 303 348 388 390 403 459/"; } if (asset.AssetNameEquals("Characters/Dialogue/rainy")) { IDictionary <string, string> rainy = asset.AsDictionary <string, string>().Data; rainy["Astra"] = "Ah, rain.#$e#What a beautiful sign of a healthy planet."; } if (asset.AssetNameEquals("Data/EngagementDialogue")) { IDictionary <string, string> EngagementDialogue = asset.AsDictionary <string, string>().Data; EngagementDialogue["Astra"] = "You want to get married? To me?#$e#Yes. Yes, I accept. I just never thought...#$e#It doesn't matter. Don't worry, @, I'll take care of everything. We'll marry in 3 days time."; } }
public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Maps\\springobjects")) { Texture2D data = ((IAssetData <Texture2D>)asset.AsImage()).Data; Texture2D texture2D = new Texture2D(Game1.graphics.GraphicsDevice, data.Width, Math.Max(data.Height, 4096)); ((IAssetData <object>)asset).ReplaceWith((object)texture2D); asset.AsImage().PatchImage(data, new Rectangle?(), new Rectangle?(), (PatchMode)0); try { asset.AsImage().PatchImage(TextureSet.voidShroomSpore, new Rectangle?(), new Rectangle?(this.objectRect(spore.ParentSheetIndex)), (PatchMode)0); } catch (Exception) { } } else if (asset.AssetNameEquals("Data\\ObjectInformation")) { IDictionary <int, string> data = ((IAssetData <IDictionary <int, string> >)asset.AsDictionary <int, string>()).Data; if (!data.ContainsKey(spore.ParentSheetIndex)) { data.Add(spore.ParentSheetIndex, spore.getObjectData()); } } }
public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Data/Blueprints")) { var editor = asset.AsDictionary <string, string>(); editor.Data[BlueprintId] = getItemCost() + // Footprint, door loc, animal door loc, mapToWarpTo, name, desc, type, upgradeFrom, tilesize, maxOccupants, action (eg MineElevator, how we do this?), BuildableLocation, cost, magical $"/7/3/3/2/-1/-1/VoidShed1/Mysterious Shed/Connects your shed with the void. The interior can be decorated and is changed by setting items./Upgrades/Big Shed/96/96/20/null/Farm/{config.GoldCost}/true"; } else if (asset.AssetNameEquals("Data/Events/Farm")) { editAssetData(asset, FarmEventsData); } else if (asset.AssetNameEquals("Characters/Dialogue/Abigail")) { editAssetData(asset, AbigailDialogueCharacters); } else if (asset.AssetNameEquals("Data/Locations")) { // ///Winter forageables: crystal fruit, crocus, holly///Winter fish depending on location/artifacts editAssetData(asset, new Dictionary <string, string>() { { "WinterDimension", $"-1/-1/-1/418 .9 414 .7 283 .5/{WinterDimension.LocationFishData(asset.AsDictionary<string, string>().Data)}/-1" } }); } }
public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Data\\CraftingRecipes")) { if (ja == null) { return; } var dict = asset.AsDictionary <string, string>().Data; dict.Add("Frosty Stardrop", ja.GetObjectId("Frosty Stardrop Piece") + " 5/Field/434/false/null"); } else if (asset.AssetNameEquals("Strings\\StringsFromMaps")) { var dict = asset.AsDictionary <string, string>().Data; dict.Add("FrostDungeon.LockedEntrance", "This door is locked right now."); dict.Add("FrostDungeon.Locked", "This door is locked. It probably needs a key."); dict.Add("FrostDungeon.LockedBoss", "This giant door is locked. Perhaps something nearby can open it."); dict.Add("FrostDungeon.Unlock", "The door has been unlocked."); dict.Add("FrostDungeon.ItemPuzzle", "There seems to be a silhouette on the pedestal."); dict.Add("FrostDungeon.Target", "A target."); dict.Add("FrostDungeon.Trail0", "Some festive lights."); dict.Add("FrostDungeon.Trail1", "A smashed candy cane."); dict.Add("FrostDungeon.Trail2", "Some festive ornaments."); dict.Add("FrostDungeon.Trail3", "A smashed miniature tree."); } }
/// <summary>Edit a matched asset.</summary> /// <param name="asset">A helper which encapsulates metadata about an asset and enables changes to it.</param> public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Maps/springobjects") && CustomOreNodes.Count > 0) { var editor = asset.AsImage(); int extension = (Config.SpriteSheetOffsetRows * 16) + ((CustomOreNodes.Count / (editor.Data.Width / 16) + 1) * 16); editor.ExtendImage(minWidth: editor.Data.Width, minHeight: SpringObjectsHeight + extension); SMonitor.Log($"extended springobjects by {extension}"); for (int i = 0; i < CustomOreNodes.Count; i++) { CustomOreNode node = CustomOreNodes[i]; SMonitor.Log($"Patching springobjects with {node.spritePath}"); Texture2D customTexture; customTexture = node.texture; int x = (i % (editor.Data.Width / 16)) * 16; int y = SpringObjectsHeight + (Config.SpriteSheetOffsetRows * 16) + (i / (editor.Data.Width / 16)) * 16; editor.PatchImage(customTexture, sourceArea: new Rectangle(node.spriteX, node.spriteY, node.spriteW, node.spriteH), targetArea: new Rectangle(x, y, 16, 16)); SMonitor.Log($"patched springobjects with {node.spritePath}"); } } else if (asset.AssetNameEquals("Data/ObjectInformation")) { var editor = asset.AsDictionary <int, string>(); for (int i = 0; i < CustomOreNodes.Count; i++) { editor.Data[i + 816] = $"Stone/0/15/Basic/Stone/{CustomOreNodes[i].nodeDesc}"; } } }
public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Data\\ObjectInformation")) { var data = asset.AsDictionary <int, string>().Data; foreach (BugModel bugModel in BugCatchingMod.AllBugs) { data.Add(bugModel.ParentSheetIndex, bugModel.QuickItemDataString); } } if (asset.AssetNameEquals("TileSheets\\tools")) { Texture2D toolSpriteSheet = asset.AsImage().Data; Color[] originalTools = new Color[toolSpriteSheet.Width * toolSpriteSheet.Height]; toolSpriteSheet.GetData <Color>(originalTools); Texture2D bugNetToolSpriteSheet = ToolsSprites; Color[] addonTools = new Color[bugNetToolSpriteSheet.Width * bugNetToolSpriteSheet.Height]; bugNetToolSpriteSheet.GetData <Color>(addonTools); Texture2D newSpriteSheet = new Texture2D(Game1.game1.GraphicsDevice, toolSpriteSheet.Width, toolSpriteSheet.Height + bugNetToolSpriteSheet.Height, false, SurfaceFormat.Color); var allTools = new Color[originalTools.Length + addonTools.Length]; originalTools.CopyTo(allTools, 0); addonTools.CopyTo(allTools, originalTools.Length); newSpriteSheet.SetData(allTools); asset.ReplaceWith(newSpriteSheet); } }
public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Data/Furniture")) { foreach (ItemFrameData ifd in ItemFrameMod.itemFrameDatum) { string lw = $"{(int)(ifd.texture.Width / 16)} {(int)(ifd.texture.Height / 16)}"; string bb = $"{(int)(ifd.texture.Width / 16)} {Math.Min(2, (int)(ifd.texture.Height / 16))}"; string entry = $"'{ifd.displayName}'/painting/{lw}/{bb}/1/100"; this.Monitor.Log($"Adding {ifd.id} {entry}", LogLevel.Trace); asset.AsDictionary <int, string>().Data.Add(ifd.id, entry); } } else if (asset.AssetNameEquals("TileSheets/furniture")) { //int newHeight = this.nextID/16 + 32; //this.Monitor.Log($"Setting Tilesheet height to {newHeight} based on last tile {this.nextID}", LogLevel.Debug); var oldTex = asset.AsImage().Data; Texture2D newTex = new Texture2D(Game1.graphics.GraphicsDevice, oldTex.Width, Math.Max(oldTex.Height, 4096)); asset.ReplaceWith(newTex); asset.AsImage().PatchImage(oldTex); foreach (ItemFrameData ifd in ItemFrameMod.itemFrameDatum) { Rectangle target = furnitureRect(ifd.id, ifd.texture); this.Monitor.Log($"Inserting texture at ({target.X}, {target.Y})", LogLevel.Trace); asset.AsImage().PatchImage(ifd.texture, targetArea: target); } } }
public void Edit <T>(IAssetData asset) { var option = config.HutchInterior == 1 ? (int)currentHutchType : config.HutchInterior - 1; if (asset.AssetNameEquals("Maps/SlimeHutch")) { var editor = asset.AsMap(); var newVal = maps[option]; if (newVal != null) { editor.ReplaceWith(newVal); } } if (asset.AssetNameEquals("Maps/townInterior")) { var editor = asset.AsImage(); var newVal = waterTextures[option]; if (newVal != null) { editor.PatchImage(newVal, targetArea: new Rectangle(352, 1056, 32, 16)); } } }
public void Edit <T>(IAssetData asset) { int id = ModEntry.JsonAssets.GetObjectId(ModEntry.PufferChickName); if (asset.AssetNameEquals("Data\\Fish")) { var data = asset.AsDictionary <int, string>().Data; string localizedName = Game1.objectInformation[id].Split('/')[4]; data.Add(id, $"{localizedName}/95/mixed/28/28/0 2600/spring summer fall winter/both/688 .05/5/0/0/0"); } else if (asset.AssetNameEquals("Data\\AquariumFish")) { var data = asset.AsDictionary <int, string>().Data; data.Add(id, "20/float"); } else if (asset.AssetNameEquals("LooseSprites\\AquariumFish")) { var editor = asset.AsImage(); Texture2D sourceImage = _helper.Content.Load <Texture2D>("data\\Objects\\Pufferchick\\object.png", ContentSource.ModFolder); editor.PatchImage(sourceImage, targetArea: new Rectangle(4, 52, 16, 16)); } else if (asset.AssetNameEquals("Data\\Locations")) { var data = asset.AsDictionary <string, string>().Data; data[ModEntry.Data.ExteriorMapName] = data["Beach"]; } }
/// <summary>Implements <see cref="IAssetEditor.Edit"/>.</summary> public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Characters/Haley") || asset.AssetNameEquals("Portraits/Haley")) { this.Monitor.Log($"Edit asset {asset.AssetName}"); IAssetDataForImage baseImage = asset.AsImage(); // Support for Cold Wether Haley. Texture2D overlay = hasColdWeatherHaley_ && Game1.IsWinter ? this.Helper.Content.Load <Texture2D>($"assets/{asset.AssetName}_winter_overlay_hair_gray.png") : this.Helper.Content.Load <Texture2D>($"assets/{asset.AssetName}_overlay_hair_gray.png"); // Workaround for the missing sleeping sprite of Cold Weather Haley. if (hasColdWeatherHaley_ && Game1.IsWinter && asset.AssetNameEquals("Characters/Haley")) { Texture2D sleepingHaley = this.Helper.Content.Load <Texture2D>($"assets/{asset.AssetName}_sleeping.png"); baseImage.PatchImage(sleepingHaley, patchMode: PatchMode.Overlay); } baseImage.PatchImage(ColorBlend(overlay, actualHairColor_), patchMode: PatchMode.Overlay); } else { throw new ArgumentException($"Invalid asset {asset.AssetName}"); } }
public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Data/Bundles")) { asset.AsDictionary <string, string>().ReplaceWith(Bundles.Data()); Bundles.Fix(false); } if (asset.AssetNameEquals("Strings/UI")) { Func <string, Translation> t = Helper.Translation.Get; var dict = asset.AsDictionary <string, string>().Data; foreach (var room in new string[] { "Boiler", "Crafts", "Pantry", "Vault", "FishTank" }) { var key = "JunimoNote_Reward" + room; var r = room; if (room == "Crafts" || room == "Boiler") { r += "Room"; } VanillaRewards[r] = dict[key]; dict[key] = t(key); } } if (asset.AssetNameEquals("LooseSprites/JunimoNote")) { var tex = Helper.Content.Load <Texture2D>("assets/icons.png", ContentSource.ModFolder); asset.AsImage().PatchImage(tex, targetArea: new Rectangle(0, 180, 640, 64)); } }
/// <summary>Edit a matched asset.</summary> /// <param name="asset">A helper which encapsulates metadata about an asset and enables changes to it.</param> public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Maps/Mines/mine") || asset.AssetNameEquals("Maps/Mines/mine_dark") || asset.AssetNameEquals("Maps/Mines/mine_dino") || asset.AssetNameEquals("Maps/Mines/mine_frost") || asset.AssetNameEquals("Maps/Mines/mine_lava") || asset.AssetNameEquals("Maps/Mines/mine_frost_dark") || asset.AssetNameEquals("Maps/Mines/minequarryshaft") || asset.AssetNameEquals("Maps/Mines/mine_lava_dark") || asset.AssetNameEquals("Maps/Mines/mine_slime") || asset.AssetNameEquals("Maps/Mines/mine") || asset.AssetNameEquals("Maps/Mines/mine_dark")) { Texture2D customTexture = this.Helper.Content.Load <Texture2D>("Maps/Mines/mine_desert", ContentSource.GameContent); asset .AsImage() .PatchImage(customTexture, sourceArea: new Rectangle(224, 160, 16, 16), targetArea: new Rectangle(224, 160, 16, 16)); } else if (asset.AssetNameEquals("TileSheets/Craftables")) { Texture2D customTexture = this.Helper.Content.Load <Texture2D>("Maps/Mines/mine_desert", ContentSource.GameContent); asset .AsImage() .PatchImage(customTexture, sourceArea: new Rectangle(224, 160, 16, 16), targetArea: new Rectangle(112, 144, 16, 16)); } else if (asset.AssetNameEquals("Data/CraftingRecipes")) { IDictionary <string, string> data = asset.AsDictionary <string, string>().Data; data.Add("Mine Shaft", $"{Config.ShaftCost}/Field/39/true/{Config.SkillReq}"); } else if (asset.AssetNameEquals("Data/BigCraftablesInformation")) { IDictionary <int, string> data = asset.AsDictionary <int, string>().Data; data.Add(39, "Mine Shaft/0/-300/Crafting -9/Use this to move down several levels in the mines./true/false/1/Mine Shaft"); } }
/// <summary>Edit a matched asset.</summary> /// <param name="asset">A helper which encapsulates metadata about an asset and enables changes to it.</param> public void Edit <T>(IAssetData asset) { // recalculate sprinkler crafting resources if (asset.AssetNameEquals(SprinklerMod.RecipeDataKey)) { IDictionary <string, string> data = asset.AsDictionary <string, string>().Data; foreach (KeyValuePair <string, string> pair in data.ToArray()) { if (!pair.Key.Contains("prinkler")) { continue; } // get field info string[] fields = pair.Value.Split('/'); int sprinklerID = int.Parse(fields[2]); string[] ingredients = fields[0].Split(' '); if (!this.Config.SprinklerPrices.TryGetValue(sprinklerID, out int multiplier)) { continue; } // multiply ingredients for (int i = 1; i < ingredients.Length; i += 2) { ingredients[i] = (int.Parse(ingredients[i]) * multiplier).ToString(); } fields[0] = string.Join(" ", ingredients); // save data[pair.Key] = string.Join("/", fields); } } // recalculate sale price else if (asset.AssetNameEquals(SprinklerMod.ObjectDataKey)) { IDictionary <int, string> data = asset.AsDictionary <int, string>().Data; foreach (KeyValuePair <int, string> pair in data.ToArray()) { if (!this.Config.SprinklerPrices.TryGetValue(pair.Key, out int multiplier)) { continue; } // multiply cost string[] fields = pair.Value.Split('/'); fields[1] = (int.Parse(fields[1]) * multiplier).ToString(); // save data[pair.Key] = string.Join("/", fields); } } else { throw new InvalidOperationException($"Unexpected asset {asset.AssetName}"); } }
public void Edit <T>(IAssetData asset) { Log.T($"Editing {asset.AssetName}.", _isDebugging); var data = asset.AsDictionary <string, string>().Data; // Event 0000: Robin // Pre-Demetrius-event dialogue if (asset.AssetNameEquals(@"Characters/Dialogue/Robin")) { const string key = "event.4637.0000.0000"; if (!data.ContainsKey(key)) { data.Add(key, ModEntry.Instance.i18n.Get(key)); } } // Event 0001: Farm, Demetrius // Receive Propagator recipe after house upgrade level 3 if (asset.AssetNameEquals(@"Data/Events/Farm")) { var json = ModEntry.Instance.Helper.Content.Load <IDictionary <string, string> > (ModValues.EventsPath); foreach (var key in json.Keys) { if (key.StartsWith("46370001")) { if (Game1.player.HouseUpgradeLevel >= 3) { Log.D("Event conditions:" + $" disabled=[{ModEntry.Instance.Config.DisabledForFruitCave}]" + $" caveChoice=[{Game1.MasterPlayer.caveChoice}]", _isDebugging); if (ModEntry.Instance.Config.DisabledForFruitCave && Game1.MasterPlayer.caveChoice.Value != 2) { return; } if (!data.ContainsKey(key)) { var value = string.Format( json[key], ModEntry.Instance.i18n.Get("event.4637.0001.0000"), ModEntry.Instance.i18n.Get("event.4637.0001.0001"), ModEntry.Instance.i18n.Get("event.4637.0001.0002"), ModEntry.Instance.i18n.Get("event.4637.0001.0003"), ModValues.PropagatorInternalName); Log.D($"Injecting event.", _isDebugging); data.Add(key, value); } } } } } }
public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Data\\ObjectInformation")) { var data = asset.AsDictionary <int, string>().Data; foreach (var crop_ in CropData.crops) { var crop = crop_.Value; Log.trace($"Injecting to objects: {crop.GetProductId()}: {crop.GetProductObjectInformation()}"); data.Add(crop.GetProductId(), crop.GetProductObjectInformation()); Log.trace($"Injecting to objects: {crop.GetSeedId()}: {crop.GetSeedObjectInformation()}"); data.Add(crop.GetSeedId(), crop.GetSeedObjectInformation()); } } else if (asset.AssetNameEquals("Data\\Crops")) { var data = asset.AsDictionary <int, string>().Data; foreach (var crop_ in CropData.crops) { var crop = crop_.Value; Log.trace($"Injecting to crops: {crop.GetSeedId()}: {crop.GetCropInformation()}"); data.Add(crop.GetSeedId(), crop.GetCropInformation()); } } else if (asset.AssetNameEquals("Maps\\springobjects")) { var oldTex = asset.AsImage().Data; Texture2D newTex = new Texture2D(Game1.graphics.GraphicsDevice, oldTex.Width, Math.Max(oldTex.Height, 4096)); asset.ReplaceWith(newTex); asset.AsImage().PatchImage(oldTex); foreach (var crop_ in CropData.crops) { var crop = crop_.Value; Log.trace($"Injecting {crop.Id} sprites"); asset.AsImage().PatchImage(Mod.instance.Helper.Content.Load <Texture2D>($"Crops/{crop.Id}/product.png"), null, objectRect(crop.GetProductId())); if (crop.Colors != null && crop.Colors.Count > 0) { asset.AsImage().PatchImage(Mod.instance.Helper.Content.Load <Texture2D>($"Crops/{crop.Id}/product-color.png"), null, objectRect(crop.GetProductId() + 1)); } asset.AsImage().PatchImage(Mod.instance.Helper.Content.Load <Texture2D>($"Crops/{crop.Id}/seeds.png"), null, objectRect(crop.GetSeedId())); } } else if (asset.AssetNameEquals("TileSheets\\crops")) { var oldTex = asset.AsImage().Data; Texture2D newTex = new Texture2D(Game1.graphics.GraphicsDevice, oldTex.Width, Math.Max(oldTex.Height, 4096)); asset.ReplaceWith(newTex); asset.AsImage().PatchImage(oldTex); foreach (var crop_ in CropData.crops) { var crop = crop_.Value; Log.trace($"Injecting {crop.Id} crop images"); asset.AsImage().PatchImage(Mod.instance.Helper.Content.Load <Texture2D>($"Crops/{crop.Id}/crop.png"), null, cropRect(crop.GetCropSpriteIndex())); } } }
// "918": "Hyper Speed-Gro/70/-300/Basic -19/Hyper Speed-Gro/Greatly stimulates leaf production. Guaranteed to increase growth rate by at least 33%. Mix into tilled soil.", // "466": "Deluxe Speed-Gro/40/-300/Basic -19/Deluxe Speed-Gro/Stimulates leaf production. Guaranteed to increase growth rate by at least 25%. Mix into tilled soil.", public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Maps/springobjects")) { Texture2D sprinkler = ModEntry.ModHelper.Content.Load <Texture2D>("assets/radioactiveSprinkler.png"); //Texture2D rfertimg = ModEntry.ModHelper.Content.Load<Texture2D>("assets/radioactiveFertilizer.png"); Texture2D old = asset.AsImage().Data; asset.ReplaceWith(new Texture2D(Game1.graphics.GraphicsDevice, old.Width, System.Math.Max(old.Height, 1200 / 24 * 16))); asset.AsImage().PatchImage(old); asset.AsImage().PatchImage(sprinkler, targetArea: this.GetRectangle(RadioactiveSprinklerItem.INDEX)); //asset.AsImage().PatchImage(rfertimg, targetArea: this.GetRectangle(RadioactiveFertilizerItem.INDEX)); } else if (asset.AssetNameEquals("Data/ObjectInformation")) { asset.AsDictionary <int, string>().Data.Add(RadioactiveSprinklerItem.INDEX, $"{this.sprinklerName}/{RadioactiveSprinklerItem.PRICE}/{RadioactiveSprinklerItem.EDIBILITY}/{RadioactiveSprinklerItem.TYPE} {RadioactiveSprinklerItem.CATEGORY}/{this.sprinklerName}/{this.sprinklerDesc}"); //asset.AsDictionary<int, string>().Data.Add(RadioactiveFertilizerItem.INDEX, $"{this.rfertName}/{RadioactiveFertilizerItem.PRICE}/{RadioactiveFertilizerItem.EDIBILITY}/{RadioactiveFertilizerItem.TYPE} {RadioactiveFertilizerItem.CATEGORY}/{this.rfertName}/{this.rfertDesc}"); } else if (asset.AssetNameEquals("Data/CraftingRecipes")) { IAssetDataForDictionary <string, string> oldDict = asset.AsDictionary <string, string>(); Dictionary <string, string> newDict = new Dictionary <string, string>(); // somehow the Dictionary maintains ordering, so reconstruct it with new sprinkler recipe immediately after radioactive foreach (string key in oldDict.Data.Keys) { newDict.Add(key, oldDict.Data[key]); if (key.Equals("Iridium Sprinkler")) { if (asset.Locale != "en") { newDict.Add("Radioactive Sprinkler", $"910 2 787 2/Home/{RadioactiveSprinklerItem.INDEX}/false/Farming {RadioactiveSprinklerItem.CRAFTING_LEVEL}/{this.sprinklerName}"); //newDict.Add("Radioactive Fertilizer", $"910 2 787 2/Home/{RadioactiveFertilizerItem.INDEX}/false/Farming {RadioactiveFertilizerItem.CRAFTING_LEVEL}/{this.rfertName}"); } else { newDict.Add("Radioactive Sprinkler", $"910 2 787 2/Home/{RadioactiveSprinklerItem.INDEX}/false/Farming {RadioactiveSprinklerItem.CRAFTING_LEVEL}"); //newDict.Add("Radioactive Fertilizer", $"910 2 787 2/Home/{RadioactiveFertilizerItem.INDEX}/false/Farming {RadioactiveFertilizerItem.CRAFTING_LEVEL}"); } } } asset.AsDictionary <string, string>().Data.Clear(); foreach (string key in newDict.Keys) { asset.AsDictionary <string, string>().Data.Add(key, newDict[key]); } } else if (asset.AssetNameEquals("TileSheets\\tools")) { asset.AsImage().PatchImage(ModEntry.ToolsTexture, null, null, PatchMode.Overlay); } else if (asset.AssetNameEquals("TileSheets\\weapons")) { //asset.AsImage().PatchImage(ModEntry.WeaponsTexture, null, null, PatchMode.Overlay); } }
public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Data\\ObjectInformation")) { //int id = Enumerable.Last(Game1.objectInformation).Key + 1; //asset.AsDictionary<int, string>().Data.Add(ChanceCube.ID, $"{ChanceCube.NAME}/{ChanceCube.PRICE}/{ChanceCube.EDIBILITY}/{ChanceCube.TYPE} {ChanceCube.CATEGORY}/{ChanceCube.NAME}/{ChanceCube.DESCRIPTION}"); } else if (asset.AssetNameEquals("Data\\CraftingRecipes")) { //asset.AsDictionary<string, string>().Data.Add("Cobalt Sprinkler", $"645 1 {CobaltBarItem.INDEX} 1/Home/{CobaltSprinklerObject.INDEX} 1/false/null"); } }
public void Edit <_T> (IAssetData asset) { var data = asset.AsDictionary <string, string> ().Data; if (asset.AssetNameEquals($"Characters\\Dialogue\\{GarbageChannel.DialogueCharacter}")) { applyDialogue("garbage", data, GarbageChannel.Dialogue); } if (asset.AssetNameEquals($"Characters\\Dialogue\\{TrainsChannel.DialogueCharacter}")) { applyDialogue("trains", data, TrainsChannel.Dialogue); } }
public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals(StringsFromCSFiles)) { IDictionary <string, string> data = asset.AsDictionary <string, string>().Data; data["Utility.cs.5682"] = "Autumn"; data["Utility.cs.5746"] = "Autumn (The Smell Of Mushroom)"; data["Utility.cs.5748"] = "Autumn (Ghost Synth)"; data["Utility.cs.5750"] = "Autumn (Raven's Descent)"; data["Seeds.cs.14237"] = "Autumn Mix"; data["fall"] = "autumn"; } else if (asset.AssetNameEquals(ObjectInformation)) { IDictionary <int, string> data = asset.AsDictionary <int, string>().Data; foreach (int id in new List <int>(data.Keys)) { string[] array = data[id].Split('/'); string descr = array[5]; if (descr.Contains("falling")) { continue; } data[id] = data[id].Replace("fall", "autumn"); if (id == 497) //fall seeds { data[id] = data[id].Replace("Fall", "Autumn"); //the word "Fall" appears as an internal reference in other places } } } else if (asset.AssetNameEquals(Pierre)) { IDictionary <string, string> data = asset.AsDictionary <string, string>().Data; data["fall_Mon"] = data["fall_Mon"].Replace("Fall", "Autumn"); } else if (asset.AssetNameEquals(TV)) { IDictionary <string, string> data = asset.AsDictionary <string, string>().Data; data["53"] = data["53"].Replace("Fall", "Autumn"); foreach (string id in new List <string>() { "36", "67", "78", "116", "186" }) { data[id] = data[id].Replace("fall", "autumn"); } } }
public void Edit <_T> (IAssetData asset) { var data = asset.AsDictionary <string, string> ().Data; if (asset.AssetNameEquals($"Strings\\Events")) { applyDialogue(Events, data); } if (asset.AssetNameEquals($"Strings\\StringsFromCSFiles")) { applyDialogue(StringsFromCSFiles, data); } }
public void Edit <T>(IAssetData asset) { int[] validItems = { 305, 308, 174, 176, 180, 182, 184, 186, 442, 436, 438, 440, 444, 446, 306, 307, 424, 426, 428, 769, 795 }; int[] validItemsVanilla = { 305, 308, 769, 795 }; bool isVoidRanchLoaded = this.Helper.ModRegistry.IsLoaded("Taelende.VoidRanch"); this.Config = this.Helper.ReadConfig <ModConfig>(); float priceIncrease = this.Config.VoidItemPriceIncrease; if (asset.AssetNameEquals("Data/ObjectInformation")) { if (isVoidRanchLoaded && modEnabled) { IDictionary <int, string> data = asset.AsDictionary <int, string>().Data; foreach (int id in validItems) { if (data.TryGetValue(id, out string entry)) { string[] fields = entry.Split('/'); int currentPrice = int.Parse(fields[1]); fields[1] = (currentPrice * priceIncrease).ToString(); data[id] = string.Join("/", fields); } } } else { if (modEnabled) { IDictionary <int, string> data = asset.AsDictionary <int, string>().Data; foreach (int id in validItemsVanilla) { if (data.TryGetValue(id, out string entry)) { string[] fields = entry.Split('/'); int currentPrice = int.Parse(fields[1]); fields[1] = (currentPrice * priceIncrease).ToString(); data[id] = string.Join("/", fields); } } } } } if (asset.AssetNameEquals("Data/mail")) { asset.AsDictionary <string, string>().Data.Add("wizardsInfoOnVoid", "@,^I have been researching strange phenomenon relating to items of dark origin.^It seems to be that if you combine the forces of light and dark into a physical form, you can shield yourself from the aura that is emitted from said dark items!^Yes! I am talking about the Iridium Band!^Seek one of these out and please confirm that my hypothesis is correct.^ -M. Rasmodius, Wizard"); asset.AsDictionary <string, string>().Data.Add("wizardsIntroVoid", "Greetings young adept.^I have detected some kind of dark aura radiating off items of dark origin and it appears to be draining the willpower of my test subjects.^The item that I have tested this with is Void Essence however, I believe that all items of the same origin have the same effects.^Please stay away from these items until I have conducted more research.^ -M. Rasmodius, Wizard"); } }
public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals(LocationsPath)) { var data = asset.AsDictionary <string, string>().Data; data[ModEntry.Data.ExteriorMapName] = data["Beach"]; } else if (asset.AssetNameEquals(UIPath)) { var data = asset.AsDictionary <string, string>().Data; data.Add("Chat_StardewAquarium.FishDonated", _helper.Translation.Get("FishDonatedMP")); data.Add("Chat_StardewAquarium.AchievementUnlocked", _helper.Translation.Get("AchievementUnlockedMP")); } }
/// <summary>Edit a matched asset.</summary> /// <param name="asset">A helper which encapsulates metadata about an asset and enables changes to it.</param> public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Strings/StringsFromCSFiles")) { this.Strings_StringsFromCSFiles(asset); return; } if (asset.AssetNameEquals("LooseSprites/Cursors")) { this.LooseSprites_Cursors(asset); return; } }
public void Edit <_T> (IAssetData asset) { var data = asset.AsDictionary <string, string> ().Data; if (asset.AssetNameEquals($"Data\\Events\\{GarbageChannel.EventMap}")) { applyEvents("garbage", data, GarbageChannel.Events); } if (asset.AssetNameEquals($"Data\\Events\\{TrainsChannel.EventMap}")) { applyEvents("trains", data, TrainsChannel.Events); } }
public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals("Strings\\UI")) { var editor = asset.AsDictionary <string, string>(); editor.Data["Chat_DinoFamiliarEgg"] = Helper.Translation.Get("chat-dino-familiar-egg"); } else if (asset.AssetNameEquals("Data\\Monsters")) { var editor = asset.AsDictionary <string, string>(); editor.Data["Junimo"] = "40/6/0/0/false/1000/382 .5 433 .01 336 .001 84 .02 414 .02 97 .005 99 .001/2/.00/4/3/.00/true/2/Junimo"; editor.Data["Butterfly"] = "24/6/0/0/true/1000/767 .9 767 .4 108 .001 287 .02 96 .005 99 .001/1/.01/4/3/.00/true/3/Butterfly"; } }
/// <summary> /// Utilized by SMAPI to determine what edits should be made to an asset. /// </summary> public void Edit <T>(IAssetData asset) { if (asset.AssetNameEquals(jojaCDForm) && Globals.CurrentValues.Joja.applyValues) { UpdateCDForm(asset); } else if (asset.AssetNameEquals(bundles) && Globals.CurrentValues.Vault.applyValues) { UpdateBundles(asset); } else if (asset.AssetNameEquals(extraDialogue) && Globals.CurrentValues.Joja.applyValues) { UpdateExtraDialogue(asset); } }