Example #1
0
        public void AddSpousePatioHere(string spouse_tilesOf, Point cursorLoc)
        {
            string      spouse      = spouse_tilesOf.Split('_')[0];
            string      tilesOf     = spouse_tilesOf.Split('_')[1];
            OutdoorArea outdoorArea = new OutdoorArea()
            {
                useDefaultTiles = true,
                location        = cursorLoc,
                npcOffset       = ModEntry.spousePatioOffsets.ContainsKey(spouse) ? ModEntry.spousePatioOffsets[spouse] : new Point(2, 4),
                useTilesOf      = tilesOf,
            };
            string path = Path.Combine("assets", "outdoor-areas.json");

            if (!File.Exists(Path.Combine(ModEntry.SHelper.DirectoryPath, path)))
            {
                path = "outdoor-areas.json";
            }

            OutdoorAreaData json = ModEntry.SHelper.Data.ReadJsonFile <OutdoorAreaData>(path) ?? new OutdoorAreaData();

            json.areas[spouse] = outdoorArea;
            ModEntry.SHelper.Data.WriteJsonFile(path, json);
            ModEntry.SMonitor.Log($"Added spouse {spouse} to {path}");
            ReloadPatios();
        }
        public void AddSpousePatioHere(string spouse_tilesOf)
        {
            string      spouse         = spouse_tilesOf.Split('_')[0];
            string      tilesOf        = spouse_tilesOf.Split('_')[1];
            Point       playerLocation = Utility.Vector2ToPoint(Game1.player.getTileLocation());
            OutdoorArea outdoorArea    = new OutdoorArea()
            {
                useDefaultTiles = true,
                location        = playerLocation,
                npcOffset       = new Point(playerLocation.X + 2, playerLocation.Y + 4),
                useTilesOf      = tilesOf,
            };
            string path = Path.Combine("assets", "outdoor-areas.json");

            if (!File.Exists(Path.Combine(ModEntry.SHelper.DirectoryPath, path)))
            {
                path = "outdoor-areas.json";
            }

            OutdoorAreaData json = ModEntry.SHelper.Data.ReadJsonFile <OutdoorAreaData>(path) ?? new OutdoorAreaData();

            json.areas[spouse] = outdoorArea;
            ModEntry.SHelper.Data.WriteJsonFile(path, json);
            ModEntry.SMonitor.Log($"Added spouse {spouse} to {path}");
            ReloadPatios();
        }
Example #3
0
        public static void RemoveAllSpouseAreas()
        {
            SMonitor.Log($"Removing all spouse areas {outdoorAreas.Count}");

            Farm farm = Game1.getFarm();

            Point  patio_corner       = Utility.Vector2ToPoint(farm.GetSpouseOutdoorAreaCorner());
            string above_always_layer = "AlwaysFront";

            farm.removeTile(patio_corner.X + 1, patio_corner.Y + 3, "Buildings");
            farm.removeTile(patio_corner.X + 2, patio_corner.Y + 3, "Buildings");
            farm.removeTile(patio_corner.X + 3, patio_corner.Y + 3, "Buildings");
            farm.removeTile(patio_corner.X, patio_corner.Y + 3, "Buildings");
            farm.removeTile(patio_corner.X + 1, patio_corner.Y + 2, "Buildings");
            farm.removeTile(patio_corner.X + 2, patio_corner.Y + 2, "Buildings");
            farm.removeTile(patio_corner.X + 3, patio_corner.Y + 2, "Buildings");
            farm.removeTile(patio_corner.X, patio_corner.Y + 2, "Buildings");
            farm.removeTile(patio_corner.X + 1, patio_corner.Y + 1, "Front");
            farm.removeTile(patio_corner.X + 2, patio_corner.Y + 1, "Front");
            farm.removeTile(patio_corner.X + 3, patio_corner.Y + 1, "Front");
            farm.removeTile(patio_corner.X, patio_corner.Y + 1, "Front");
            farm.removeTile(patio_corner.X + 1, patio_corner.Y, above_always_layer);
            farm.removeTile(patio_corner.X + 2, patio_corner.Y, above_always_layer);
            farm.removeTile(patio_corner.X + 3, patio_corner.Y, above_always_layer);
            farm.removeTile(patio_corner.X, patio_corner.Y, above_always_layer);


            foreach (KeyValuePair <string, object> kvp in outdoorAreas)
            {
                OutdoorArea area = kvp.Value as OutdoorArea;
                int         x    = area.GetLocation().X;
                int         y    = area.GetLocation().Y;

                if (farm.map.Layers[0].LayerWidth <= x + 3 || farm.map.Layers[0].LayerHeight <= y + 3)
                {
                    SMonitor.Log($"Invalid spouse area coordinates {x},{y} for {kvp.Key}", LogLevel.Error);
                    continue;
                }

                farm.removeTile(x + 1, y + 3, "Buildings");
                farm.removeTile(x + 2, y + 3, "Buildings");
                farm.removeTile(x + 3, y + 3, "Buildings");
                farm.removeTile(x, y + 3, "Buildings");
                farm.removeTile(x + 1, y + 2, "Buildings");
                farm.removeTile(x + 2, y + 2, "Buildings");
                farm.removeTile(x + 3, y + 2, "Buildings");
                farm.removeTile(x, y + 2, "Buildings");
                farm.removeTile(x + 1, y + 1, "Front");
                farm.removeTile(x + 2, y + 1, "Front");
                farm.removeTile(x + 3, y + 1, "Front");
                farm.removeTile(x, y + 1, "Front");
                farm.removeTile(x + 1, y, "AlwaysFront");
                farm.removeTile(x + 2, y, "AlwaysFront");
                farm.removeTile(x + 3, y, "AlwaysFront");
                farm.removeTile(x, y, "AlwaysFront");
            }
        }
Example #4
0
        private static void RemoveAllSpouseAreas()
        {
            SMonitor.Log($"Removing all spouse areas", LogLevel.Debug);

            Farm farm = Game1.getFarm();

            farm.removeTile(70, 9, "Buildings");
            farm.removeTile(71, 9, "Buildings");
            farm.removeTile(72, 9, "Buildings");
            farm.removeTile(69, 9, "Buildings");
            farm.removeTile(70, 8, "Buildings");
            farm.removeTile(71, 8, "Buildings");
            farm.removeTile(72, 8, "Buildings");
            farm.removeTile(69, 8, "Buildings");
            farm.removeTile(70, 7, "Front");
            farm.removeTile(71, 7, "Front");
            farm.removeTile(72, 7, "Front");
            farm.removeTile(69, 7, "Front");
            farm.removeTile(70, 6, "AlwaysFront");
            farm.removeTile(71, 6, "AlwaysFront");
            farm.removeTile(72, 6, "AlwaysFront");
            farm.removeTile(69, 6, "AlwaysFront");

            foreach (KeyValuePair <string, OutdoorArea> kvp in outdoorAreas)
            {
                OutdoorArea area = kvp.Value;
                int         x    = area.GetLocation().X;
                int         y    = area.GetLocation().Y;

                if (farm.map.Layers[0].LayerWidth <= x + 3 || farm.map.Layers[0].LayerHeight <= y + 3)
                {
                    SMonitor.Log($"Invalid spouse area coordinates {x},{y} for {kvp.Key}", LogLevel.Error);
                    continue;
                }

                farm.removeTile(x + 1, y + 3, "Buildings");
                farm.removeTile(x + 2, y + 3, "Buildings");
                farm.removeTile(x + 3, y + 3, "Buildings");
                farm.removeTile(x, y + 3, "Buildings");
                farm.removeTile(x + 1, y + 2, "Buildings");
                farm.removeTile(x + 2, y + 2, "Buildings");
                farm.removeTile(x + 3, y + 2, "Buildings");
                farm.removeTile(x, y + 2, "Buildings");
                farm.removeTile(x + 1, y + 1, "Front");
                farm.removeTile(x + 2, y + 1, "Front");
                farm.removeTile(x + 3, y + 1, "Front");
                farm.removeTile(x, y + 1, "Front");
                farm.removeTile(x + 1, y, "AlwaysFront");
                farm.removeTile(x + 2, y, "AlwaysFront");
                farm.removeTile(x + 3, y, "AlwaysFront");
                farm.removeTile(x, y, "AlwaysFront");
            }
        }
Example #5
0
        public static void ShowSpouseAreas()
        {
            SMonitor.Log($"ShowSpouseAreas Total outdoor spouse areas: {outdoorAreas.Count}");

            Farm farm = Game1.getFarm();

            Farmer f = Game1.MasterPlayer;


            List <string> customAreaSpouses = new List <string>();
            string        aSpouse           = null;

            foreach (KeyValuePair <string, Friendship> spouse in f.friendshipData.Pairs.Where(s => s.Value.IsMarried()))
            {
                if (outdoorAreas.ContainsKey(spouse.Key))
                {
                    customAreaSpouses.Add(spouse.Key);
                }
                aSpouse = spouse.Key;
            }

            if (customAreaSpouses.Count == 0)
            {
                SMonitor.Log($"no custom spouse areas", LogLevel.Debug);
                if (f.spouse != null)
                {
                    aSpouse = f.spouse;
                }
                if (aSpouse != null)
                {
                    customAreaSpouses.Add(aSpouse);
                    SMonitor.Log($"Adding spouse {aSpouse} for default area", LogLevel.Debug);
                }
            }

            foreach (string spouse in customAreaSpouses)
            {
                bool               useDefaultTiles = true;
                OutdoorArea        area            = new OutdoorArea();
                List <SpecialTile> specialTiles    = new List <SpecialTile>();
                int x = DefaultSpouseAreaLocation.X;
                int y = DefaultSpouseAreaLocation.Y;
                if (outdoorAreas.ContainsKey(spouse))
                {
                    area            = outdoorAreas[spouse] as OutdoorArea;
                    x               = area.GetLocation().X;
                    y               = area.GetLocation().Y;
                    useDefaultTiles = area.useDefaultTiles;
                    specialTiles    = new List <SpecialTile>(area.specialTiles);
                }

                SMonitor.Log($"Adding spouse area for {spouse}: use default tiles: {useDefaultTiles}, special tiles: {specialTiles.Count}");

                if (farm.map.Layers[0].LayerWidth <= x + 3 || farm.map.Layers[0].LayerHeight <= y + 3)
                {
                    SMonitor.Log($"Invalid spouse area coordinates {x},{y} for {spouse}", LogLevel.Error);
                    continue;
                }

                /*
                 * farm.removeTile(x + 1, y + 3, "Buildings");
                 * farm.removeTile(x + 2, y + 3, "Buildings");
                 * farm.removeTile(x + 3, y + 3, "Buildings");
                 * farm.removeTile(x, y + 3, "Buildings");
                 * farm.removeTile(x + 1, y + 2, "Buildings");
                 * farm.removeTile(x + 2, y + 2, "Buildings");
                 * farm.removeTile(x + 3, y + 2, "Buildings");
                 * farm.removeTile(x, y + 2, "Buildings");
                 * farm.removeTile(x + 1, y + 1, "Front");
                 * farm.removeTile(x + 2, y + 1, "Front");
                 * farm.removeTile(x + 3, y + 1, "Front");
                 * farm.removeTile(x, y + 1, "Front");
                 * farm.removeTile(x + 1, y, "AlwaysFront");
                 * farm.removeTile(x + 2, y, "AlwaysFront");
                 * farm.removeTile(x + 3, y, "AlwaysFront");
                 * farm.removeTile(x, y, "AlwaysFront");
                 */
                if (useDefaultTiles)
                {
                    TileSheet defaultTilesheet = farm.Map.GetTileSheet("zzz_custom_spouse_default_patio");
                    int       sheetIdx         = farm.Map.TileSheets.IndexOf(defaultTilesheet);
                    SMonitor.Log($"Default custom tilesheet index: {sheetIdx}");
                    if (sheetIdx == -1)
                    {
                        AddTileSheets();
                        sheetIdx = farm.Map.TileSheets.IndexOf(defaultTilesheet);
                    }

                    string which = area.useTilesOf != null ? area.useTilesOf : spouse;

                    switch (which)
                    {
                    case "Sam":
                        farm.setMapTileIndex(x, y + 2, 1173, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 2, 1174, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 1, y + 2, 1198, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 2, y + 2, 1199, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x, y + 1, 1148, "Front", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 1, 1149, "Front", sheetIdx);
                        break;

                    case "Penny":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", sheetIdx);
                        break;

                    case "Sebastian":
                        farm.setMapTileIndex(x + 1, y + 2, 1927, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 2, y + 2, 1928, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 2, 1929, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 1, y + 1, 1902, "Front", sheetIdx);
                        farm.setMapTileIndex(x + 2, y + 1, 1903, "Front", sheetIdx);
                        break;

                    case "Shane":
                        farm.setMapTileIndex(x + 1, y + 3, 1940, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 2, y + 3, 1941, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 3, 1942, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 1, y + 2, 1915, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 2, y + 2, 1916, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 2, 1917, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 1, y + 1, 1772, "Front", sheetIdx);
                        farm.setMapTileIndex(x + 2, y + 1, 1773, "Front", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 1, 1774, "Front", sheetIdx);
                        farm.setMapTileIndex(x + 1, y, 1747, "AlwaysFront", sheetIdx);
                        farm.setMapTileIndex(x + 2, y, 1748, "AlwaysFront", sheetIdx);
                        farm.setMapTileIndex(x + 3, y, 1749, "AlwaysFront", sheetIdx);
                        break;

                    case "Alex":
                        farm.setMapTileIndex(x, y + 2, 1099, "Buildings", sheetIdx);
                        break;

                    case "Maru":
                        farm.setMapTileIndex(x + 2, y + 2, 1124, "Buildings", sheetIdx);
                        break;

                    case "Emily":
                        farm.setMapTileIndex(x, y + 2, 1867, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 2, 1867, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x, y + 1, 1842, "Front", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 1, 1842, "Front", sheetIdx);
                        farm.setMapTileIndex(x, y + 3, 1866, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 2, y + 2, 1866, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 3, 1967, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 1, y + 2, 1967, "Buildings", sheetIdx);
                        break;

                    case "Haley":
                        farm.setMapTileIndex(x, y + 2, 1074, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x, y + 1, 1049, "Front", sheetIdx);
                        farm.setMapTileIndex(x, y, 1024, "AlwaysFront", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 2, 1074, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 1, 1049, "Front", sheetIdx);
                        farm.setMapTileIndex(x + 3, y, 1024, "AlwaysFront", sheetIdx);
                        break;

                    case "Harvey":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", sheetIdx);
                        break;

                    case "Elliott":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", sheetIdx);
                        break;

                    case "Leah":
                        farm.setMapTileIndex(x + 1, y + 2, 1122, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 1, y + 1, 1097, "Front", sheetIdx);
                        break;

                    case "Abigail":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", sheetIdx);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", sheetIdx);
                        break;

                    default:
                        SMonitor.Log($"No default tiles for {spouse}", LogLevel.Warn);
                        break;
                    }
                }

                foreach (SpecialTile tile in area.specialTiles)
                {
                    TileSheet tilesheet = farm.Map.GetTileSheet("zzz_custom_spouse_patio_" + tile.tilesheet);
                    int       idx       = farm.Map.TileSheets.IndexOf(tilesheet);
                    SMonitor.Log($"Adding specialTile at {tile.location}, {tile.tilesheet}, tilesheet idx {idx}");
                    farm.setMapTileIndex(tile.location.X, tile.location.Y, tile.tileIndex, tile.layer, idx);
                }
            }
        }
Example #6
0
        public bool MoveSpousePatio(string spouse_dir, Point cursorLoc)
        {
            Game1.getFarm().loadMap(Game1.getFarm().mapPath.Value, true);
            string      spouse      = spouse_dir.Split('_')[0];
            string      dir         = spouse_dir.Split('_')[1];
            bool        success     = false;
            OutdoorArea outdoorArea = (OutdoorArea)ModEntry.outdoorAreas[spouse];

            switch (dir)
            {
            case "cursorLoc":
                outdoorArea.location = cursorLoc;
                success = true;
                break;

            case "up":
                if (outdoorArea.location.Y <= 0)
                {
                    break;
                }
                outdoorArea.location.Y--;
                success = true;
                break;

            case "down":
                if (outdoorArea.location.Y >= Game1.getFarm().map.Layers[0].LayerHeight - 1)
                {
                    break;
                }
                outdoorArea.location.Y++;
                success = true;
                break;

            case "left":
                if (outdoorArea.location.X == 0)
                {
                    break;
                }
                outdoorArea.location.X--;
                success = true;
                break;

            case "right":
                if (outdoorArea.location.X >= Game1.getFarm().map.Layers[0].LayerWidth - 1)
                {
                    break;
                }
                outdoorArea.location.X++;
                success = true;
                break;
            }
            string path = Path.Combine("assets", "outdoor-areas.json");

            if (!File.Exists(Path.Combine(ModEntry.SHelper.DirectoryPath, path)))
            {
                path = "outdoor-areas.json";
            }

            OutdoorAreaData json = ModEntry.SHelper.Data.ReadJsonFile <OutdoorAreaData>(path) ?? new OutdoorAreaData();

            json.areas[spouse] = outdoorArea;
            ModEntry.SHelper.Data.WriteJsonFile(path, json);

            ReloadSpouseAreaData();
            AddTileSheets();
            ShowSpouseAreas();
            PlaceSpouses();
            ModEntry.SMonitor.Log($"Added spouse {spouse} to {path}");
            return(success);
        }
Example #7
0
        private static void SetupSpouseAreas()
        {
            Farm farm = Game1.getFarm();

            Farmer f = Game1.MasterPlayer;

            foreach (KeyValuePair <string, TileSheetInfo> kvp in tileSheetsToAdd)
            {
                if (farm.map.TileSheets.FirstOrDefault(s => s.Id == kvp.Key) == null)
                {
                    farm.map.AddTileSheet(new TileSheet(kvp.Key, farm.map, kvp.Value.realPath, new Size(kvp.Value.width, kvp.Value.height), new Size(kvp.Value.tileWidth, kvp.Value.tileHeight)));
                    SMonitor.Log($"Added tilesheet {kvp.Key} to farm map", LogLevel.Debug);
                }
            }

            farm.removeTile(70, 9, "Buildings");
            farm.removeTile(71, 9, "Buildings");
            farm.removeTile(72, 9, "Buildings");
            farm.removeTile(69, 9, "Buildings");
            farm.removeTile(70, 8, "Buildings");
            farm.removeTile(71, 8, "Buildings");
            farm.removeTile(72, 8, "Buildings");
            farm.removeTile(69, 8, "Buildings");
            farm.removeTile(70, 7, "Front");
            farm.removeTile(71, 7, "Front");
            farm.removeTile(72, 7, "Front");
            farm.removeTile(69, 7, "Front");
            farm.removeTile(70, 6, "AlwaysFront");
            farm.removeTile(71, 6, "AlwaysFront");
            farm.removeTile(72, 6, "AlwaysFront");
            farm.removeTile(69, 6, "AlwaysFront");

            foreach (KeyValuePair <string, Friendship> spouse in f.friendshipData.Pairs.Where(s => s.Value.IsMarried()))
            {
                if (!outdoorAreas.ContainsKey(spouse.Key))
                {
                    SMonitor.Log($"no spouse area for {spouse.Key}", LogLevel.Warn);
                    continue;
                }
                SMonitor.Log($"Adding spouse area for {spouse.Key}", LogLevel.Debug);

                OutdoorArea area = outdoorAreas[spouse.Key];

                int x = area.GetLocation().X;
                int y = area.GetLocation().Y;

                if (farm.map.Layers[0].LayerWidth <= x + 3 || farm.map.Layers[0].LayerHeight <= y + 3)
                {
                    SMonitor.Log($"Invalid spouse area coordinates {x},{y} for {spouse.Key}", LogLevel.Error);
                    return;
                }

                farm.removeTile(x + 1, y + 3, "Buildings");
                farm.removeTile(x + 2, y + 3, "Buildings");
                farm.removeTile(x + 3, y + 3, "Buildings");
                farm.removeTile(x, y + 3, "Buildings");
                farm.removeTile(x + 1, y + 2, "Buildings");
                farm.removeTile(x + 2, y + 2, "Buildings");
                farm.removeTile(x + 3, y + 2, "Buildings");
                farm.removeTile(x, y + 2, "Buildings");
                farm.removeTile(x + 1, y + 1, "Front");
                farm.removeTile(x + 2, y + 1, "Front");
                farm.removeTile(x + 3, y + 1, "Front");
                farm.removeTile(x, y + 1, "Front");
                farm.removeTile(x + 1, y, "AlwaysFront");
                farm.removeTile(x + 2, y, "AlwaysFront");
                farm.removeTile(x + 3, y, "AlwaysFront");
                farm.removeTile(x, y, "AlwaysFront");

                if (area.useDefaultTiles)
                {
                    switch (spouse.Key)
                    {
                    case "Sam":
                        farm.setMapTileIndex(x, y + 2, 1173, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1174, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1198, "Buildings", 1);
                        farm.setMapTileIndex(x + 2, y + 2, 1199, "Buildings", 1);
                        farm.setMapTileIndex(x, y + 1, 1148, "Front", 1);
                        farm.setMapTileIndex(x + 3, y + 1, 1149, "Front", 1);
                        break;

                    case "Penny":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", 1);
                        break;

                    case "Sebastian":
                        farm.setMapTileIndex(x + 1, y + 2, 1927, "Buildings", 1);
                        farm.setMapTileIndex(x + 2, y + 2, 1928, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1929, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 1, 1902, "Front", 1);
                        farm.setMapTileIndex(x + 2, y + 1, 1903, "Front", 1);
                        break;

                    case "Shane":
                        farm.setMapTileIndex(x + 1, y + 3, 1940, "Buildings", 1);
                        farm.setMapTileIndex(x + 2, y + 3, 1941, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 3, 1942, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1915, "Buildings", 1);
                        farm.setMapTileIndex(x + 2, y + 2, 1916, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1917, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 1, 1772, "Front", 1);
                        farm.setMapTileIndex(x + 2, y + 1, 1773, "Front", 1);
                        farm.setMapTileIndex(x + 3, y + 1, 1774, "Front", 1);
                        farm.setMapTileIndex(x + 1, y, 1747, "AlwaysFront", 1);
                        farm.setMapTileIndex(x + 2, y, 1748, "AlwaysFront", 1);
                        farm.setMapTileIndex(x + 3, y, 1749, "AlwaysFront", 1);
                        break;

                    case "Alex":
                        farm.setMapTileIndex(x, y + 2, 1099, "Buildings", 1);
                        break;

                    case "Maru":
                        farm.setMapTileIndex(x + 2, y + 2, 1124, "Buildings", 1);
                        break;

                    case "Emily":
                        farm.setMapTileIndex(x, y + 2, 1867, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1867, "Buildings", 1);
                        farm.setMapTileIndex(x, y + 1, 1842, "Front", 1);
                        farm.setMapTileIndex(x + 3, y + 1, 1842, "Front", 1);
                        farm.setMapTileIndex(x, y + 3, 1866, "Buildings", 1);
                        farm.setMapTileIndex(x + 2, y + 2, 1866, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 3, 1967, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1967, "Buildings", 1);
                        break;

                    case "Haley":
                        farm.setMapTileIndex(x, y + 2, 1074, "Buildings", 1);
                        farm.setMapTileIndex(x, y + 1, 1049, "Front", 1);
                        farm.setMapTileIndex(x, y, 1024, "AlwaysFront", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1074, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 1, 1049, "Front", 1);
                        farm.setMapTileIndex(x + 3, y, 1024, "AlwaysFront", 1);
                        break;

                    case "Harvey":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", 1);
                        break;

                    case "Elliott":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", 1);
                        break;

                    case "Leah":
                        farm.setMapTileIndex(x + 1, y + 2, 1122, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 1, 1097, "Front", 1);
                        break;

                    case "Abigail":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", 1);
                        break;
                    }
                }

                SMonitor.Log($"Adding {area.specialTiles.Count} specialTiles for {spouse.Key}", LogLevel.Debug);

                foreach (SpecialTile tile in area.specialTiles)
                {
                    TileSheet tilesheet = farm.Map.GetTileSheet("z_" + tile.tilesheet);
                    int       idx       = farm.Map.TileSheets.IndexOf(tilesheet);
                    SMonitor.Log($"Adding specialTile at {tile.location}, {tile.tilesheet}, idx {idx}");
                    farm.setMapTileIndex(tile.location.X, tile.location.Y, tile.tileIndex, tile.layer, idx);
                }
            }
        }
Example #8
0
        private static void ShowSpouseAreas()
        {
            Farm farm = Game1.getFarm();

            Farmer f = Game1.MasterPlayer;

            foreach (KeyValuePair <string, Friendship> spouse in f.friendshipData.Pairs.Where(s => s.Value.IsMarried()))
            {
                if (!outdoorAreas.ContainsKey(spouse.Key))
                {
                    SMonitor.Log($"no spouse area for {spouse.Key}", LogLevel.Warn);
                    continue;
                }
                OutdoorArea area = outdoorAreas[spouse.Key];

                SMonitor.Log($"Adding spouse area for {spouse.Key}: use default tiles: {area.useDefaultTiles}, special tiles: {area.specialTiles.Count}", LogLevel.Debug);


                int x = area.GetLocation().X;
                int y = area.GetLocation().Y;

                if (farm.map.Layers[0].LayerWidth <= x + 3 || farm.map.Layers[0].LayerHeight <= y + 3)
                {
                    SMonitor.Log($"Invalid spouse area coordinates {x},{y} for {spouse.Key}", LogLevel.Error);
                    continue;
                }

                /*
                 * farm.removeTile(x + 1, y + 3, "Buildings");
                 * farm.removeTile(x + 2, y + 3, "Buildings");
                 * farm.removeTile(x + 3, y + 3, "Buildings");
                 * farm.removeTile(x, y + 3, "Buildings");
                 * farm.removeTile(x + 1, y + 2, "Buildings");
                 * farm.removeTile(x + 2, y + 2, "Buildings");
                 * farm.removeTile(x + 3, y + 2, "Buildings");
                 * farm.removeTile(x, y + 2, "Buildings");
                 * farm.removeTile(x + 1, y + 1, "Front");
                 * farm.removeTile(x + 2, y + 1, "Front");
                 * farm.removeTile(x + 3, y + 1, "Front");
                 * farm.removeTile(x, y + 1, "Front");
                 * farm.removeTile(x + 1, y, "AlwaysFront");
                 * farm.removeTile(x + 2, y, "AlwaysFront");
                 * farm.removeTile(x + 3, y, "AlwaysFront");
                 * farm.removeTile(x, y, "AlwaysFront");
                 */
                if (area.useDefaultTiles)
                {
                    switch (spouse.Key)
                    {
                    case "Sam":
                        farm.setMapTileIndex(x, y + 2, 1173, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1174, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1198, "Buildings", 1);
                        farm.setMapTileIndex(x + 2, y + 2, 1199, "Buildings", 1);
                        farm.setMapTileIndex(x, y + 1, 1148, "Front", 1);
                        farm.setMapTileIndex(x + 3, y + 1, 1149, "Front", 1);
                        break;

                    case "Penny":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", 1);
                        break;

                    case "Sebastian":
                        farm.setMapTileIndex(x + 1, y + 2, 1927, "Buildings", 1);
                        farm.setMapTileIndex(x + 2, y + 2, 1928, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1929, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 1, 1902, "Front", 1);
                        farm.setMapTileIndex(x + 2, y + 1, 1903, "Front", 1);
                        break;

                    case "Shane":
                        farm.setMapTileIndex(x + 1, y + 3, 1940, "Buildings", 1);
                        farm.setMapTileIndex(x + 2, y + 3, 1941, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 3, 1942, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1915, "Buildings", 1);
                        farm.setMapTileIndex(x + 2, y + 2, 1916, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1917, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 1, 1772, "Front", 1);
                        farm.setMapTileIndex(x + 2, y + 1, 1773, "Front", 1);
                        farm.setMapTileIndex(x + 3, y + 1, 1774, "Front", 1);
                        farm.setMapTileIndex(x + 1, y, 1747, "AlwaysFront", 1);
                        farm.setMapTileIndex(x + 2, y, 1748, "AlwaysFront", 1);
                        farm.setMapTileIndex(x + 3, y, 1749, "AlwaysFront", 1);
                        break;

                    case "Alex":
                        farm.setMapTileIndex(x, y + 2, 1099, "Buildings", 1);
                        break;

                    case "Maru":
                        farm.setMapTileIndex(x + 2, y + 2, 1124, "Buildings", 1);
                        break;

                    case "Emily":
                        farm.setMapTileIndex(x, y + 2, 1867, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1867, "Buildings", 1);
                        farm.setMapTileIndex(x, y + 1, 1842, "Front", 1);
                        farm.setMapTileIndex(x + 3, y + 1, 1842, "Front", 1);
                        farm.setMapTileIndex(x, y + 3, 1866, "Buildings", 1);
                        farm.setMapTileIndex(x + 2, y + 2, 1866, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 3, 1967, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1967, "Buildings", 1);
                        break;

                    case "Haley":
                        farm.setMapTileIndex(x, y + 2, 1074, "Buildings", 1);
                        farm.setMapTileIndex(x, y + 1, 1049, "Front", 1);
                        farm.setMapTileIndex(x, y, 1024, "AlwaysFront", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1074, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 1, 1049, "Front", 1);
                        farm.setMapTileIndex(x + 3, y, 1024, "AlwaysFront", 1);
                        break;

                    case "Harvey":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", 1);
                        break;

                    case "Elliott":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", 1);
                        break;

                    case "Leah":
                        farm.setMapTileIndex(x + 1, y + 2, 1122, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 1, 1097, "Front", 1);
                        break;

                    case "Abigail":
                        farm.setMapTileIndex(x, y + 2, 1098, "Buildings", 1);
                        farm.setMapTileIndex(x + 1, y + 2, 1123, "Buildings", 1);
                        farm.setMapTileIndex(x + 3, y + 2, 1098, "Buildings", 1);
                        break;

                    default:
                        SMonitor.Log($"No default tiles for {spouse.Key}", LogLevel.Warn);
                        break;
                    }
                }

                foreach (SpecialTile tile in area.specialTiles)
                {
                    TileSheet tilesheet = farm.Map.GetTileSheet("z_" + tile.tilesheet);
                    int       idx       = farm.Map.TileSheets.IndexOf(tilesheet);
                    SMonitor.Log($"Adding specialTile at {tile.location}, {tile.tilesheet}, tilesheet idx {idx}");
                    farm.setMapTileIndex(tile.location.X, tile.location.Y, tile.tileIndex, tile.layer, idx);
                }
            }
        }