Exemplo n.º 1
0
        public TS1NeighborhoodProvider(Content contentManager)
        {
            ContentManager = contentManager;
            MainResource   = new IffFile(Path.Combine(contentManager.TS1BasePath, "UserData/Neighborhood.iff"));
            LotLocations   = new IffFile(Path.Combine(contentManager.TS1BasePath, "UserData/LotLocations.iff"));
            var lotZoning = new IffFile(Path.Combine(contentManager.TS1BasePath, "UserData/LotZoning.iff"));

            var zones = lotZoning.Get <STR>(1);

            for (int i = 0; i < zones.Length; i++)
            {
                var split = zones.GetString(i).Split(',');
                ZoningDictionary[short.Parse(split[0])] = (short)((split[1] == " community") ? 1 : 0);
            }
            Neighbors    = MainResource.List <NBRS>().FirstOrDefault();
            Neighborhood = MainResource.List <NGBH>().FirstOrDefault();

            FamilyForHouse = new Dictionary <short, FAMI>();
            var families = MainResource.List <FAMI>();

            foreach (var fam in families)
            {
                FamilyForHouse[(short)fam.HouseNumber] = fam;
            }
        }
Exemplo n.º 2
0
 public Neighborhood()
 {
     Families = new List <FAMI>();
     Main     = new NGBH();
     Scores   = new NBRS();
     Tables   = new TATT();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Intializes a specific neighbourhood. Also counts as a save discard, since it unloads the current neighbourhood.
        /// </summary>
        /// <param name="id"></param>
        public void InitSpecific(int id)
        {
            DirtyAvatars.Clear();
            ZoningDictionary.Clear();
            FamilyForHouse.Clear();

            var udName = "UserData" + ((id == 0) ? "" : (id + 1).ToString());
            //simitone shouldn't modify existing ts1 data, since our house saves are incompatible.
            //therefore we should copy to the simitone user data.

            var userPath = FSOEnvironment.ContentDir;


            UserPath = userPath;

            MainResource = new Files.Formats.IFF.IffFile(Path.Combine(UserPath, "Neighborhood.iff"));

            Neighbors    = MainResource.List <NBRS>().FirstOrDefault();
            Neighborhood = MainResource.List <NGBH>().FirstOrDefault();


            //todo: manage avatar iffs here
        }
Exemplo n.º 4
0
        /// <summary>
        /// Intializes a specific neighbourhood. Also counts as a save discard, since it unloads the current neighbourhood.
        /// </summary>
        /// <param name="id"></param>
        public void InitSpecific(int id)
        {
            DirtyAvatars.Clear();
            ZoningDictionary.Clear();
            FamilyForHouse.Clear();

            var udName = "UserData" + ((id == 0) ? "" : (id + 1).ToString());
            //simitone shouldn't modify existing ts1 data, since our house saves are incompatible.
            //therefore we should copy to the simitone user data.

            var userPath = Path.Combine(FSOEnvironment.UserDir, udName + "/");

            if (!Directory.Exists(userPath))
            {
                var source      = Path.Combine(ContentManager.TS1BasePath, udName + "/");
                var destination = userPath;

                //quick and dirty copy.

                foreach (string dirPath in Directory.GetDirectories(source, "*",
                                                                    SearchOption.AllDirectories))
                {
                    Directory.CreateDirectory(dirPath.Replace('\\', '/').Replace(source, destination));
                }

                foreach (string newPath in Directory.GetFiles(source, "*.*",
                                                              SearchOption.AllDirectories))
                {
                    File.Copy(newPath, newPath.Replace('\\', '/').Replace(source, destination), true);
                }
            }

            UserPath = userPath;

            MainResource = new IffFile(Path.Combine(UserPath, "Neighborhood.iff"));
            LotLocations = new IffFile(Path.Combine(UserPath, "LotLocations.iff"));
            var lotZoning = new IffFile(Path.Combine(UserPath, "LotZoning.iff"));

            StreetNames       = new IffFile(Path.Combine(UserPath, "StreetNames.iff"));
            NeighbourhoodDesc = new IffFile(Path.Combine(UserPath, "Houses/NeighborhoodDesc.iff"));
            STDesc            = new IffFile(Path.Combine(UserPath, "Houses/STDesc.iff"));
            MTDesc            = new IffFile(Path.Combine(UserPath, "Houses/MTDesc.iff"));

            var zones = lotZoning.Get <STR>(1);

            for (int i = 0; i < zones.Length; i++)
            {
                var split = zones.GetString(i).Split(',');
                ZoningDictionary[short.Parse(split[0])] = (short)((split[1] == " community") ? 1 : 0);
            }
            Neighbors      = MainResource.List <NBRS>().FirstOrDefault();
            Neighborhood   = MainResource.List <NGBH>().FirstOrDefault();
            TypeAttributes = MainResource.List <TATT>().FirstOrDefault();

            FamilyForHouse = new Dictionary <short, FAMI>();
            var families = MainResource.List <FAMI>();

            foreach (var fam in families)
            {
                FamilyForHouse[(short)fam.HouseNumber] = fam;
            }

            LoadCharacters(true);

            //todo: manage avatar iffs here
        }