Example #1
0
        /// <summary>
        ///     On server, load saved data on minimap awake
        /// </summary>
        private static void LoadExplorationData(On.Minimap.orig_Awake orig, Minimap self)
        {
            orig(self);

            if (ConfigUtil.Get <bool>("MapServer", "shareMapProgression"))
            {
                if (ZNet.instance.IsServerInstance())
                {
                    Minimap.instance.m_explored = new bool[Minimap.instance.m_textureSize * Minimap.instance.m_textureSize];
                    if (File.Exists(Path.Combine(ConfigUtil.GetConfigPath(), ZNet.instance.GetWorldUID().ToString(), "Explorationdata.bin")))
                    {
                        var mapData = ZPackageExtension.ReadFromFile(Path.Combine(ConfigUtil.GetConfigPath(), ZNet.instance.GetWorldUID().ToString(),
                                                                                  "Explorationdata.bin"));
                        ApplyMapData(mapData);
                    }
                    else
                    {
                        for (var i = 0; i < Minimap.instance.m_explored.Length; i++)
                        {
                            Minimap.instance.m_explored[i] = false;
                        }
                    }
                }
            }
        }
Example #2
0
 public static void LoadExplorationData(Minimap instance)
 {
     if (Configuration.Current.MapServer.IsEnabled && Configuration.Current.MapServer.shareMapProgression)
     {
         if (ZNet.instance.IsServerInstance())
         {
             Minimap.instance.m_explored = new bool[Minimap.instance.m_textureSize * Minimap.instance.m_textureSize];
             if (File.Exists(Path.Combine(Configuration.ConfigIniPath, ZNet.instance.GetWorldUID().ToString(), "Explorationdata.bin")))
             {
                 var mapData = ZPackageExtension.ReadFromFile(Path.Combine(Configuration.ConfigIniPath, ZNet.instance.GetWorldUID().ToString(),
                                                                           "Explorationdata.bin"));
                 ApplyMapData(mapData);
             }
             else
             {
                 for (var i = 0; i < Minimap.instance.m_explored.Length; i++)
                 {
                     Minimap.instance.m_explored[i] = false;
                 }
             }
         }
     }
 }