public static void load(IModHelper helper, bool cm) { Instrument.allInstruments = new Dictionary <string, Instrument>(); SheetMusic.allSheets = new Dictionary <string, SheetMusic>(); Texture2D texture = loadTexture(helper, "tilesheet.png"); List <SheetMusic> sheets = new List <SheetMusic>(); var harpOfYoba = new Instrument("harp", texture, "Harp of Yoba", "Add Sheet Music to play.", new HarpAnimation()); sheets.Add(new SheetMusic("thunder", texture, "Serenade of Thunder", "Rain on me", Microsoft.Xna.Framework.Color.Blue, !cm ? "AbigailFluteDuet" : "cm:HOY-SerenadeOfThunder:AbigailFluteDuet", 15000, new RainMagic())); sheets.Add(new SheetMusic("birthday", texture, "Birthday Sonata", "Popular on birthdays", Microsoft.Xna.Framework.Color.DarkBlue, !cm ? "shimmeringbastion" : "cm:HOY-BirthdaySonata:shimmeringbastion", 11000, new BirthdayMagic())); sheets.Add(new SheetMusic("wanderer", texture, "Ballad of the Wanderer", "Wander off and return", Microsoft.Xna.Framework.Color.Orange, !cm ? "honkytonky" : "cm:HOY-BalladOfTheWanderer:honkytonky", 12000, new TeleportMagic())); sheets.Add(new SheetMusic("yoba", texture, "Prelude to Yoba", "Can you hear the trees sing along", Microsoft.Xna.Framework.Color.ForestGreen, !cm ? "wedding" : "cm:HOY-PreludeToYoba:wedding", 14000, new TreeMagic())); sheets.Add(new SheetMusic("fisher", texture, "The Fisherman's Lament", "The old mariners lucky melody", Microsoft.Xna.Framework.Color.DarkMagenta, !cm ? "poppy" : "cm:HOY-FishermentsLament:poppy", 10000, new FisherMagic())); sheets.Add(new SheetMusic("dark", texture, "Ode to the Dark", "All monsters are created equal", Microsoft.Xna.Framework.Color.Red, !cm ? "tribal" : "cm:HOY-OdeToTheDark:tribal", 10000, new MonsterMagic())); sheets.Add(new SheetMusic("animals", texture, "Animals' Aria", "Beloved by Farmanimals", Microsoft.Xna.Framework.Color.Brown, !cm ? "tinymusicbox" : "cm:HOY-AnimalsAria:tinymusicbox", 11000, new AnimalMagic())); sheets.Add(new SheetMusic("adventure", texture, "Adventurer's Allegro", "An energizing tune", Microsoft.Xna.Framework.Color.LightCoral, !cm ? "aerobics" : "cm:HOY-AdventurersAllegro:aerobics", 11000, new BoosterMagic())); sheets.Add(new SheetMusic("granpa", texture, "Farmer's Lullaby", "Stand on fertile ground", Microsoft.Xna.Framework.Color.Magenta, !cm ? "grandpas_theme" : "cm:HOY-FarmersLullaby:grandpas_theme", 12000, new SeedMagic())); sheets.Add(new SheetMusic("time", texture, "Rondo of Time", "Play ahead to pass the time", Microsoft.Xna.Framework.Color.LightCyan, !cm ? "50s" : "cm:HOY-RondoOfTime:50s", 30000, new TimeMagic())); sheets.Add(new SheetMusic("lua", texture, "Lua Crescendo", "Play lua", Microsoft.Xna.Framework.Color.BlueViolet, HarpOfYobaReduxMod.config.luamusic, 10000, new LuaMagic(helper))); Texture2D sheetTexture = texture.getArea(new Rectangle(0, 0, 16, 16)); Texture2D harpTexture = texture.getArea(new Rectangle(32, 0, 16, 16)); CustomObjectData.newObject("Platonymous.HarpOfYoba." + harpOfYoba.instrumentID, harpTexture, Color.White, "Harp of Yoba", "Add Sheet Music to play.", customType: typeof(Instrument)); foreach (SheetMusic sheet in sheets) { CustomObjectData.newObject("Platonymous.HarpOfYoba." + sheet.sheetMusicID, sheetTexture, Color.White, sheet.Name, sheet.getDescription(), customType: typeof(SheetMusic)); } loadLetters(); }
private void testing() { CustomObjectData.newBigObject("Platonymous.BigTest", Game1.bigCraftableSpriteSheet.clone().setSaturation(0), Color.Aquamarine, "Test Machine", "Test Description", 24, craftingData: new CraftingData("Test Machine")); CustomObjectData.newObject("Platonymous.Rubici", Game1.objectSpriteSheet.clone().setSaturation(0), Color.Yellow, "Rubici", "Rubici Test", 16, "Rubici", "Minerals -2", 50, -300); new CustomObjectData("Platonymous.Rubico" + Color.Red.ToString(), "Rubico/250/-300/Minerals -2/Rubico/A precious stone that is sought after for its rich color and beautiful fluster.", Game1.objectSpriteSheet.clone().setSaturation(0), Color.Red, 16); Keys.K.onPressed(() => Monitor.Log($"Played: {Game1.currentGameTime.TotalGameTime.Minutes} min")); ButtonClick.UseToolButton.onTerrainClick <Grass>(o => Monitor.Log($"Number of Weeds: {o.numberOfWeeds}", LogLevel.Info)); new InventoryItem(new Chest(true), 100).addToNPCShop("Pierre"); new ItemSelector <SObject>(p => p.name == "Chest").whenAddedToInventory(l => l.useAll(i => i.name = "Test")); Helper.Content.Load <Texture2D>($"Maps/MenuTiles", ContentSource.GameContent).setSaturation(0).injectAs($"Maps/MenuTiles"); Game1.objectSpriteSheet.clone().setSaturation(0).injectTileInto($"Maps/springobjects", 74); Game1.objectSpriteSheet.clone().setSaturation(0).injectTileInto($"Maps/springobjects", new Range(129, 166), new Range(129, 166)); Func <string, GameLocation, Vector2, string, bool> tileActionTest = (s, l, t, ly) => { List <string> strings = s.Split(' ').ToList(); strings.Remove(strings[0]); Game1.activeClickableMenu = new DialogueBox(String.Join(" ", s)); return(true); }; Action mapMergeTest = delegate() { "Beach".toLocation().Map.mergeInto("Town".toLocation().Map, new Vector2(60, 30), new Rectangle(15, 15, 20, 20)).injectAs(@"Maps/Town"); "Town".toLocation().clearArea(new Rectangle(60, 30, 20, 20)); "Town".toLocation().Map.addAction(new Vector2(18, 60), new TileAction("testaction", tileActionTest).register(), "Smells interesting"); }; SaveEvents.AfterLoad += (s, e) => mapMergeTest(); }
public override void Entry(IModHelper helper) { _monitor = Monitor; _helper = helper; SeedBagTool seedbag = new SeedBagTool(); addtoshop = new InventoryItem(seedbag, 30000, 1).addToNPCShop("Pierre"); CustomObjectData.newObject("Platonymous.SeedBag.Tool", SeedBagTool.texture, Color.White, "Seed Bag", "Empty", 0, customType: typeof(SeedBagTool)); }
private void OnGameLaunched(object sender, GameLaunchedEventArgs e) { SeedBagTool seedbag = new SeedBagTool(); CustomObjectData.newObject("Platonymous.SeedBag.Tool", SeedBagTool.texture, Color.White, i18n.Get("Name"), i18n.Get("Empty"), 0, customType: typeof(SeedBagTool)); InventoryItem bag = new InventoryItem(seedbag, config.Price, 1); bag.addToNPCShop(config.Shop); }
private void OnGameLaunched(object sender, GameLaunchedEventArgs e) { IntravenousCoffeeTool tool = new IntravenousCoffeeTool(); CustomObjectData.newObject("mpcomplete.IntravenousCoffee.Tool", IntravenousCoffeeTool.texture, Color.White, tool.Name, tool.description, 0, customType: typeof(IntravenousCoffeeTool)); // Add it to the Hospital shop. new InventoryItem(tool, 10000, 1).addToShop( (ShopMenu shop) => true //(ShopMenu shop) => shop.getForSale().Exists( // (ISalable item) => item.Name == "Energy Tonic" || item.Name == "Muscle Remedy" //) ); }
public void LoadPortalGuns(IContentHelper contentHelper) { for (int i = 0; i < MAX_PORTAL_GUNS; i++) { string portalGunId = "PortalGun" + i + "Id"; Texture2D portalGunTexture = contentHelper.Load <Texture2D>( $"Assets{Path.DirectorySeparatorChar}PortalGun" + (i + 1) + ".png"); PortalGunObjects[i] = CustomObjectData.newObject(portalGunId, portalGunTexture, Color.White, "Portal Gun " + i, "Property of Aperture Science Inc.", 0, "", "Basic", 1, -300, "", craftingData: new CraftingData("Portal Gun " + i, "388 1")); PortalGuns[i] = new PortalGun(portalGunId, i, MAX_PORTALS); } }
private void initExample() { int opalIndex = Game1.objectInformation.getIndexByName("Opal"); Rectangle opalSourceRectangle = Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, opalIndex, 16, 16); Texture2D pillTexture = Game1.objectSpriteSheet.getArea(opalSourceRectangle).setSaturation(0); customObjects = new List <CustomObjectData>(); customObjects.AddRange(new[] { CustomObjectData.newObject("PyTKMod.RedPill", pillTexture, Color.Red, i18n.Get("template.redpill.name"), i18n.Get("template.redpill.description"), edibility: 50), CustomObjectData.newObject("PyTKMod.BluePill", pillTexture, Color.Blue, i18n.Get("template.bluepill.name"), i18n.Get("template.bluepill.description"), edibility: 50) }); config.debugKey.onPressed(() => { if (!Context.IsWorldReady) { return; } Game1.activeClickableMenu = new ItemGrabMenu(customObjects.Select(o => o.getObject()).ToList()); }); }
public void LoadCritters(object sender, UpdateTickedEventArgs e) { BugNetData data = _helper.Data.ReadJsonFile <BugNetData>("Assets/critters.json"); int Id = -666; AllCritters = new List <CritterEntry>(); Dictionary <int, string> AssetData = new Dictionary <int, string>(); foreach (CritterEntry critter in data.AllCritters) { AllCritters.AddOrReplace(critter); CritterEntry.Register(critter); var bugModel = new BugModel(); bugModel = critter.BugModel; //is this V necessary ? bugModel.ParentSheetIndex = Id; AllBugs.AddOrReplace(bugModel); CustomObjectData.newObject(bugModel.FullId, bugModel.SpriteData.getTexture(), Color.White, bugModel.Name, bugModel.Description, bugModel.SpriteData.TileIndex, price: bugModel.Price, customType: typeof(Bug)); //AssetData[bugData.sdvId] = bugModel.QuickItemDataString; Monitor.Log("Added: " + bugModel.Name + " id " + bugModel.FullId.ToString()); Id--; } foreach (NetModel netModel in data.AllNets) { AllNets.AddOrReplace(netModel); //net.ParentSheetIndex = Id; CustomObjectData.newBigObject(netModel.FullId, netModel.getTexture(), Color.White, netModel.Name, netModel.Description, netModel.TileIndex, netModel.Name, false, 0, false, false, "Crafting -9", 0, -300, new CraftingData(netModel.Name, netModel.Recipe), typeof(BugNetTool)); Log.info($"adding {netModel.FullId} with recipe {netModel.Recipe}"); //CustomObjectData.newObject($"{netModel.FullId}.Tool", new BugNetTool(netModel).loadTexture(), Color.White, netModel.Name, netModel.Description, netModel.TileIndex, "", "Net", 1, -300, craftingData: new CraftingData($"{netModel.FullId}.Tool", netModel.Recipe), customType: typeof(BugNetTool)); } //_helper.Data.WriteJsonFile("data\\bugs.json", AssetData); _helper.Events.GameLoop.UpdateTicked -= LoadCritters; }