Esempio n. 1
0
 // Load config and other one-off data
 private void SaveEvents_AfterLoad(object sender, EventArgs e)
 {
     SecondaryNpcs = new Dictionary <string, bool>
     {
         { "Kent", false },
         { "Marlon", false },
         { "Merchant", false },
         { "Sandy", false },
         { "Wizard", false }
     };
     CustomHandler.UpdateCustomNpcs();
     NpcNames   = CustomHandler.GetNpcNames();
     MarkerCrop = CustomHandler.GetMarkerCrop();
     UpdateFarmBuildingLocs();
 }
Esempio n. 2
0
        // Load config and other one-off data
        private void GameLoop_SaveLoaded(object sender, SaveLoadedEventArgs e)
        {
            this.Helper.Data.WriteJsonFile($"config/default.json", Config);
            Config = Helper.Data.ReadJsonFile <ModConfig>($"config/{Constants.SaveFolderName}.json") ?? Config;
            CustomHandler.LoadConfig(Config);
            CustomMapLocations = CustomHandler.GetCustomMapLocations();
            DEBUG_MODE         = Config.DEBUG_MODE;
            locationContexts   = new Dictionary <string, LocationContext>();
            foreach (var location in Game1.locations)
            {
                MapRootLocations(location, null, false);
            }

            SecondaryNpcs = new Dictionary <string, bool>
            {
                { "Kent", false },
                { "Marlon", false },
                { "Merchant", false },
                { "Sandy", false },
                { "Wizard", false }
            };
            CustomHandler.UpdateCustomNpcs();
            CustomNames        = CustomHandler.GetNpcNames();
            MarkerCropOffsets  = CustomHandler.GetMarkerCropOffsets();
            CustomMapLocations = CustomHandler.GetCustomMapLocations();
            MapVectors         = ModConstants.MapVectors;

            foreach (var locVectors in CustomMapLocations)
            {
                if (MapVectors.TryGetValue(locVectors.Key, out var mapVectors))
                {
                    MapVectors[locVectors.Key] = locVectors.Value;
                }
                else
                {
                    MapVectors.Add(locVectors.Key, locVectors.Value);
                }
            }

            UpdateFarmBuildingLocs();
            alertFlags = new List <string>();
        }
Esempio n. 3
0
        // Load config and other one-off data
        private void SaveEvents_AfterLoad(object sender, EventArgs e)
        {
            SecondaryNpcs = new Dictionary <string, bool>
            {
                { "Kent", false },
                { "Marlon", false },
                { "Merchant", false },
                { "Sandy", false },
                { "Wizard", false }
            };
            CustomHandler.UpdateCustomNpcs();
            NpcNames   = CustomHandler.GetNpcNames();
            MarkerCrop = CustomHandler.GetMarkerCrop();

            // Preload
            UpdateFarmBuildingLocs();
            ResetMarkers();
            UpdateMarkers(true);
            ModMapPage = new ModMapPage(NpcMarkers, NpcNames, FarmerMarkers, Helper, Config);
        }
Esempio n. 4
0
        // Load config and other one-off data
        private void GameLoop_SaveLoaded(object sender, SaveLoadedEventArgs e)
        {
            this.Helper.Data.WriteJsonFile($"config/default.json", Config);
            Config = Helper.Data.ReadJsonFile <ModConfig>($"config/{Constants.SaveFolderName}.json") ?? Config;
            CustomHandler.LoadConfig(Config);
            CustomMapLocations = CustomHandler.GetCustomMapLocations();
            Season             = Config.UseSeasonalMaps ? Game1.currentSeason : "spring";
            DEBUG_MODE         = Config.DEBUG_MODE;
            shouldShowMinimap  = Config.ShowMinimap;

            locationContexts = new Dictionary <string, LocationContext>();
            foreach (var location in Game1.locations)
            {
                MapRootLocations(location, null, false);
            }

            SecondaryNpcs = new Dictionary <string, bool>
            {
                { "Kent", false },
                { "Marlon", false },
                { "Merchant", false },
                { "Sandy", false },
                { "Wizard", false }
            };
            CustomHandler.UpdateCustomNpcs();
            CustomNames       = CustomHandler.GetNpcNames();
            MarkerCropOffsets = CustomHandler.GetMarkerCropOffsets();
            MapVectors        = ModConstants.MapVectors;

            foreach (var locVectors in CustomMapLocations)
            {
                if (MapVectors.TryGetValue(locVectors.Key, out var mapVectors))
                {
                    MapVectors[locVectors.Key] = locVectors.Value;
                }
                else
                {
                    MapVectors.Add(locVectors.Key, locVectors.Value);
                }
            }

            UpdateFarmBuildingLocs();
            alertFlags = new List <string>();

            // Log warning if host does not have mod installed
            if (Context.IsMultiplayer)
            {
                var hostHasMod = false;

                foreach (IMultiplayerPeer peer in this.Helper.Multiplayer.GetConnectedPlayers())
                {
                    if (peer.GetMod("Bouhm.NPCMapLocations") != null && peer.IsHost)
                    {
                        hostHasMod = true;
                        break;
                    }
                }

                if (!hostHasMod && !Context.IsMainPlayer)
                {
                    Monitor.Log("Since the server host does not have NPCMapLocations installed, NPC locations cannot be synced and updated.", LogLevel.Warn);
                }
            }
        }