Beispiel #1
0
    public void MapSelected(string mapName)
    {
        UIManager.GetComponent <MinimapHandler>().ClearMinimaps();
        string mapPath     = null;
        string minimapPath = null;

        // Parse WDT //
        if (!WDT.Flags.ContainsKey(mapName))
        {
            string wdtPath = @"world\maps\" + mapName + @"\";
            WDT.Load(wdtPath, mapName);
        }

        if (Settings.Data[2] == "2") // extracted //
        {
            mapPath     = Settings.Data[8] + @"\" + @"world\maps\" + mapName + @"\";
            minimapPath = Settings.Data[8] + @"\" + @"world\minimaps\" + mapName + @"\";
        }
        else if (Settings.Data[2] == "0") // game //
        {
            mapPath     = @"world\maps\" + mapName;
            minimapPath = @"world\minimaps\" + mapName;
        }
        bool MinimapsExist = CheckForMinimaps(minimapPath);

        if (CheckForADTs(mapPath))
        {
            if (CheckForMinimaps(minimapPath))
            {
                PanelErrorMessage.SetActive(false);
                // load minimaps //
                UIManager.GetComponent <MinimapHandler>().LoadMinimaps(minimapPath, mapName);
            }
            else
            {
                PanelErrorMessage.SetActive(true);
                ErrorMessageText.text = "No minimaps available.";
                // load blank minimaps //
                UIManager.GetComponent <MinimapHandler>().LoadBlankMinimaps(mapPath, mapName);
            }
        }
        else
        {
            if (CheckForMinimaps(minimapPath))
            {
                PanelErrorMessage.SetActive(true);
                ErrorMessageText.text = "WMO Only Zone.";
                // load minimaps //
                UIManager.GetComponent <MinimapHandler>().LoadMinimaps(minimapPath, mapName);
            }
            else
            {
                PanelErrorMessage.SetActive(true);
                ErrorMessageText.text = "WMO Only Zone." + "\n" + "No minimaps available.";
            }
        }
    }
Beispiel #2
0
    // Build an array of available minimaps and maps //
    public static void CompileMapList(string mapName)
    {
        MinimapData.dataExists.WDT = false;
        if (!WDT.Flags.ContainsKey(mapName))
        {
            MinimapData.dataExists.WDT = WDT.Load(@"world\maps\" + mapName + @"\", mapName);
        }
        else
        {
            MinimapData.dataExists.WDT = true;
        }
        MinimapData.dataExists.ADT     = Casc.FolderExists(@"world\maps\" + mapName);
        MinimapData.dataExists.Minimap = Casc.FolderExists(@"world\minimaps\" + mapName);
        // sort data //
        MinimapData.mapAvailability = new MinimapData.MapAvailability[64, 64];
        List <string> ADTs     = new List <string>();
        List <string> Minimaps = new List <string>();

        if (MinimapData.dataExists.ADT)
        {
            ADTs = Casc.GetFileListFromFolder(@"world\maps\" + mapName);
        }
        if (MinimapData.dataExists.Minimap)
        {
            Minimaps = Casc.GetFileListFromFolder(@"world\minimaps\" + mapName);
        }
        for (int x = 0; x < 64; x++)
        {
            for (int y = 0; y < 64; y++)
            {
                // WDT data //
                if (MinimapData.dataExists.WDT)
                {
                    MinimapData.mapAvailability[x, y].WDT = WDT.Flags[mapName].HasADT[x, y];
                }
                // ADT files //
                if (MinimapData.dataExists.ADT)
                {
                    if (ADTs.Contains(mapName + "_" + x + "_" + y + ".adt"))
                    {
                        MinimapData.mapAvailability[x, y].ADT = true;
                    }
                    else
                    {
                        MinimapData.mapAvailability[x, y].ADT = false;
                    }
                }
                // Minimap files //
                if (MinimapData.dataExists.Minimap)
                {
                    if (Minimaps.Contains("map" + x + "_" + y + ".blp"))
                    {
                        MinimapData.mapAvailability[x, y].Minimap = true;
                    }
                    else
                    {
                        MinimapData.mapAvailability[x, y].Minimap = false;
                    }
                }
            }
        }
    }