public static SceneFileMobPatrolRoute Parse(string line)
        {
            var columns = line.Split(',');
            var route   = new SceneFileMobPatrolRoute(
                int.Parse(columns[0]),
                int.Parse(columns[columns.Length - 3]),
                columns[columns.Length - 2],
                columns[columns.Length - 1]
                );

            for (var i = 1; i < columns.Length - 1; i += SceneFileMobPatrolEntry.FieldCount)
            {
                // No more spots on this route
                if (columns[i] == "0" && columns[i + 1] == "0")
                {
                    break;
                }

                // Read fields
                var entryColumns = new string[SceneFileMobPatrolEntry.FieldCount];
                Array.Copy(columns, i, entryColumns, 0, entryColumns.Length);
                var entry = SceneFileMobPatrolEntry.Parse(entryColumns);
                if (entry == null)
                {
                    continue;
                }

                route.Add(entry);
            }

            return(route);
        }
Exemple #2
0
        protected object ParseBlockMonsterPatrol(string line, int iLine)
        {
            var route = SceneFileMobPatrolRoute.Parse(line);

            if (route == null || route.RouteID == 0)
            {
                return(null);
            }

            if (MobRoutes.ContainsKey(route.RouteID))
            {
                throw new Exception("Invalid route data in line " + iLine + ", duplicate id " + route.RouteID);
            }

            MobRoutes.Add(route);

            return(route);
        }