Ejemplo n.º 1
0
        /// <summary>
        /// Fix occurance where Stormwind and Stormwind city didn't match
        /// </summary>
        /// <param name="area"></param>
        /// <param name="s"></param>
        /// <returns></returns>
        private bool Matches(WorldMapArea area, string[] s)
        {
            var areaname  = s[0].Replace(" ", "").Replace("'", "");
            var areaname1 = area.AreaName.Replace(" ", "").Replace("'", "");

            return(areaname.StartsWith(areaname1, StringComparison.InvariantCultureIgnoreCase) ||
                   areaname1.StartsWith(areaname, StringComparison.InvariantCultureIgnoreCase));
        }
Ejemplo n.º 2
0
        public void PopulateUIMap(WorldMapArea area, IEnumerable <string[]> uimapLines)
        {
            var kalimdor = uimapLines.Where(s => s[0] == "Kalimdor").Select(s => s[1]).FirstOrDefault();

            // two outland occurrences need the last one
            var outland = uimapLines.Where(s => s[0] == "Outland").Select(s => s[1]).LastOrDefault();

            var matches = uimapLines.Where(s => Matches(area, s))
                          .ToList();

            if (matches.Count > 1)
            {
                Console.WriteLine($"\n- WARN [{area.AreaName}] has more than one matches:\n {string.Join(",\n ", matches.Select(t => new { AreaName = t[0], UIMapId = t[1] }))}");
            }

            if (matches.Count == 0)
            {
                Console.WriteLine($"\n- WARN [{area.AreaName}] has no matches!");
            }

            matches.ForEach(a =>
            {
                if (area.UIMapId == 0 || acceptedOverride.Contains(area.AreaName))
                {
                    if (area.UIMapId != 0 && acceptedOverride.Contains(area.AreaName))
                    {
                        Console.WriteLine($" - Accepted override [{area.AreaName}] from [{area.UIMapId}] to [{int.Parse(a[1])}]");
                    }

                    area.UIMapId = int.Parse(a[1]);
                }
                else
                {
                    Console.WriteLine($" - Prevented override [{area.AreaName}] from [{area.UIMapId}] to [{int.Parse(a[1])}]");
                }

                area.Continent = a[2] == outland ? "Expansion01" : (a[2] == kalimdor ? "Kalimdor" : "Azeroth");
            });
        }