Example #1
0
        /// <summary>
        /// Returns all world dirs (zones/, frontiers/, ...)
        /// </summary>
        /// <returns></returns>
        public static IEnumerable <string> AddonPaths(Zone2 zone)
        {
            yield return("newtowns");

            yield return(zone.Region.Addon); // gnihihih

            yield return("");
        }
Example #2
0
 /// <summary>
 /// Finds the specified file amongst common addon paths (or returns null if not found)
 /// </summary>
 public static Stream Find(Zone2 zone, string file, params object[] args)
 {
     if (args.Length > 0)
     {
         file = string.Format(file, args);
     }
     return(OpenFirst(BuildPathPermutations(AddonPaths(zone), new[] { file })));
 }
Example #3
0
        /// <summary>
        /// Generates all possible nif paths relative to the game dir
        /// </summary>
        /// <returns></returns>
        private static IEnumerable <string> DNIFFolders(Zone2 zone)
        {
            yield return("dnifs");

            yield return(Path.Combine("zones", "dnifs"));

            foreach (var f in NIFFolders(zone))
            {
                yield return(f);
            }
        }
Example #4
0
        public Zone2Obj(Zone2 zone)
        {
            Zone = zone;
            if (!Directory.Exists("zones"))
            {
                Directory.CreateDirectory("zones");
            }
            string filename = Path.Combine("zones", string.Format("zone{0:D3}", zone.ID));

            DoorWriter    = new DoorWriter(filename + ".doors");
            GeomSetWriter = new GeomSetWriter(filename + ".geomset");
            ObjWriter     = new WavefrontObjFile(filename + ".obj")
            {
                Scale = MESH_SCALE
            };
            GeomSetWriter.WriteLoadMesh(filename + ".obj");
            FirstPass = !NavmeshMgr.IsPathingEnabled(zone);
        }
Example #5
0
        /// <summary>
        /// Generates all possible nif paths relative to the game dir
        /// </summary>
        /// <returns></returns>
        private static IEnumerable <string> NIFFolders(Zone2 zone)
        {
            yield return(Path.Combine("zones", "nifs"));

            yield return("nifs");
        }
Example #6
0
        /// <summary>
        /// Finds the specified dungeon nif
        /// </summary>
        /// <param name="dnif"></param>
        /// <returns></returns>
        public static Stream FindDNIF(Zone2 zone, string dnif)
        {
            var files = new[] { dnif, Path.Combine(dnif.ToLower().Replace(".nif", ".npk"), dnif) };

            return(OpenFirst(BuildPathPermutations(AddonPaths(zone), DNIFFolders(zone), files)));
        }
Example #7
0
 /// <summary>
 /// Tries to find the specified csv file
 /// </summary>
 /// <param name="nif"></param>
 /// <returns></returns>
 public static Stream FindCSV(Zone2 zone, string file)
 {
     return(OpenFirst(BuildPathPermutations(AddonPaths(zone), new[] { string.Format("zones/zone{0:D3}/csv{0:D3}.mpk", zone.ID), string.Format("zones/zone{0:D3}/dat{0:D3}.mpk", zone.ID) }, new[] { file })));
 }