private void installDefaultHighlights() { if (config.ShowJunimoRange) { api.AddBuildingRangeHighlighter("jltaylor-us.RangeHighlight/junimoHut", config.ShowJunimoRangeKey, blueprint => { if (blueprint.name == "Junimo Hut") { return(new Tuple <Color, bool[, ], int, int>(config.JunimoRangeTint, defaultShapes.junimoHut, 1, 1)); } else { return(null); } }, building => { if (building is JunimoHut) { return(new Tuple <Color, bool[, ], int, int>(config.JunimoRangeTint, defaultShapes.junimoHut, 1, 1)); } else { return(null); } }); } if (config.ShowScarecrowRange) { api.AddItemRangeHighlighter("jltaylor-us.RangeHighlight/scarecrow", config.ShowScarecrowRangeKey, config.ShowOtherScarecrowsWhenHoldingScarecrow, (item, itemID, itemName) => { if (itemName.Contains("arecrow")) { return(new Tuple <Color, bool[, ]>(config.ScarecrowRangeTint, itemName.Contains("deluxe") ? defaultShapes.deluxeScarecrow : defaultShapes.scarecrow)); } else { if ((item is StardewValley.Object) && (item as StardewValley.Object).IsScarecrow()) { int r = (item as StardewValley.Object).GetRadiusForScarecrow() - 1; if (r < 0) { return(null); // shouldn't happen? } return(new Tuple <Color, bool[, ]>(config.ScarecrowRangeTint, r == DefaultShapes.scarecrowRadius ? defaultShapes.scarecrow : r == DefaultShapes.deluxeScarecrowRadius ? defaultShapes.deluxeScarecrow : api.GetCartesianCircleWithTruncate((uint)r))); } else { return(null); } } }); } if (config.ShowSprinklerRange) { api.AddItemRangeHighlighter("jltaylor-us.RangeHighlight/sprinkler", config.ShowSprinklerRangeKey, config.ShowOtherSprinklersWhenHoldingSprinkler, GetDefaultSprinklerHighlight); } if (config.ShowBeehouseRange) { api.AddItemRangeHighlighter("jltaylor-us.RangeHighlight/beehouse", config.ShowBeehouseRangeKey, config.ShowOtherBeehousesWhenHoldingBeehouse, (item, itemID, itemName) => { if (itemName.Contains("bee house")) { return(new Tuple <Color, bool[, ]>(config.BeehouseRangeTint, defaultShapes.beehouse)); } else { return(null); } }); } if (config.ShowBombRange) { if (config.showHeldBombRange) { api.AddItemRangeHighlighter("jltaylor-us.RangeHighlight/bomb", new KeybindList(), true, (item, itemID, itemName) => { if (!Utility.IsNormalObjectAtParentSheetIndex(item, item.ParentSheetIndex)) { return(null); } DefaultShapes.BombRange range; switch (itemID) { case 286: range = defaultShapes.cherryBomb; break; case 287: range = defaultShapes.bomb; break; case 288: range = defaultShapes.megaBomb; break; default: return(null); } // This relies on the fact that placed bombs are not an item, so this // can use the cursor position for the location var cursorTile = highlighter.GetCursorTile(); return(bombHelper(range, (int)cursorTile.X, (int)cursorTile.Y)); }); } if (config.showPlacedBombRange) { // not sure about this API yet, so keeping it private for now highlighter.AddTemporaryAnimatedSpriteHighlighter("jltaylor-us.RangeHighlight/bomb", sprite => { DefaultShapes.BombRange range; switch (sprite.initialParentTileIndex) { case 286: range = defaultShapes.cherryBomb; break; case 287: range = defaultShapes.bomb; break; case 288: range = defaultShapes.megaBomb; break; default: if (sprite.bombRadius > 0) { range = new DefaultShapes.BombRange(api.GetCartesianCircleWithRound((uint)sprite.bombRadius, false), new bool[0, 0], api.GetSquareCircle((uint)sprite.bombRadius, false)); break; } else { return(null); } } return(bombHelper(range, (int)(sprite.position.X / Game1.tileSize), (int)(sprite.position.Y / Game1.tileSize))); }); } } }
private void installDefaultHighlights() { if (config.ShowJunimoRange) { api.AddBuildingRangeHighlighter("jltaylor-us.RangeHighlight/junimoHut", config.ShowJunimoRangeKey, blueprint => { if (blueprint.name == "Junimo Hut") { return(new Tuple <Color, bool[, ], int, int>(config.JunimoRangeTint, defaultShapes.junimoHut, 1, 1)); } else { return(null); } }, building => { if (building is JunimoHut) { return(new Tuple <Color, bool[, ], int, int>(config.JunimoRangeTint, defaultShapes.junimoHut, 1, 1)); } else { return(null); } }); } if (config.ShowScarecrowRange) { api.AddItemRangeHighlighter("jltaylor-us.RangeHighlight/scarecrow", config.ShowScarecrowRangeKey, config.ShowOtherScarecrowsWhenHoldingScarecrow, (item, itemID, itemName) => { if (itemName.Contains("arecrow")) { return(new Tuple <Color, bool[, ]>(config.ScarecrowRangeTint, itemName.Contains("deluxe") ? defaultShapes.deluxeScarecrow : defaultShapes.scarecrow)); } else { return(null); } }); } if (config.ShowSprinklerRange) { api.AddItemRangeHighlighter("jltaylor-us.RangeHighlight/sprinkler", config.ShowSprinklerRangeKey, config.ShowOtherSprinklersWhenHoldingSprinkler, (item, itemID, itemName) => { if (itemName.Contains("sprinkler")) { return(new Tuple <Color, bool[, ]>(config.SprinklerRangeTint, defaultShapes.GetSprinkler(itemName))); } else { return(null); } }); } if (config.ShowBeehouseRange) { api.AddItemRangeHighlighter("jltaylor-us.RangeHighlight/beehouse", config.ShowBeehouseRangeKey, config.ShowOtherBeehousesWhenHoldingBeehouse, (item, itemID, itemName) => { if (itemName.Contains("bee house")) { return(new Tuple <Color, bool[, ]>(config.BeehouseRangeTint, defaultShapes.beehouse)); } else { return(null); } }); } if (config.ShowBombRange) { api.AddItemRangeHighlighter("jltaylor-us.RangeHighlight/bomb", null, true, (item, itemID, itemName) => { DefaultShapes.BombRange range; switch (itemID) { case 286: range = defaultShapes.cherryBomb; break; case 287: range = defaultShapes.bomb; break; case 288: range = defaultShapes.megaBomb; break; default: return(null); } // This relies on the fact that placed bombs are not an item, so this // can use the cursor position for the location var cursorTile = highlighter.GetCursorTile(); return(bombHelper(range, (int)cursorTile.X, (int)cursorTile.Y)); }); if (config.showPlacedBombRange) { // not sure about this API yet, so keeping it private for now highlighter.AddTemporaryAnimatedSpriteHighlighter("jltaylor-us.RangeHighlight/bomb", sprite => { DefaultShapes.BombRange range; switch (sprite.initialParentTileIndex) { case 286: range = defaultShapes.cherryBomb; break; case 287: range = defaultShapes.bomb; break; case 288: range = defaultShapes.megaBomb; break; default: return(null); } return(bombHelper(range, (int)(sprite.position.X / Game1.tileSize), (int)(sprite.position.Y / Game1.tileSize))); }); } } }