コード例 #1
0
 void SetProvider(SimPe.Interfaces.Files.IPackageFile pkg)
 {
     FileTable.ProviderRegistry.SimFamilynameProvider.BasePackage  = pkg;
     FileTable.ProviderRegistry.SimDescriptionProvider.BasePackage = pkg;
     FileTable.ProviderRegistry.SimNameProvider.BaseFolder         = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(pkg.FileName), "Characters");
     FileTable.ProviderRegistry.LotProvider.BaseFolder             = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(pkg.FileName), "Lots");
     eft = new ExtFamilyTies();
     IPackedFileDescriptor[] pfds = pkg.FindFiles(SimPe.Data.MetaData.FAMILY_TIES_FILE);
     if (pfds != null && pfds.Length > 0)
     {
         eft.ProcessData(pfds[0], pkg);
     }
 }
コード例 #2
0
        protected void LoadSkinFormPackage(SimPe.Interfaces.Files.IPackageFile package)
        {
            Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(0xEBCF3E27);

            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.PackedFiles.Wrapper.Cpf cpf = new SimPe.PackedFiles.Wrapper.Cpf();
                    cpf.ProcessData(pfd, package);
                    sets.Add(cpf);
                }
                catch (Exception) {}
            }
        }
コード例 #3
0
        protected void LoadSkinImageFormPackage(SimPe.Interfaces.Files.IPackageFile package)
        {
            Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(0xAC506764);
            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.RefFile reffile = new SimPe.Plugin.RefFile();
                    reffile.ProcessData(pfd, package);
                    refs.Add(reffile);
                }
                catch (Exception) {}
            }

            pfds = package.FindFiles(0x49596978);
            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.Rcol matd = new SimPe.Plugin.GenericRcol(null, true);
                    matd.ProcessData(pfd, package);
                    matds.Add(matd);
                }
                catch (Exception) {}
            }

            //Material Files
            Interfaces.Files.IPackedFileDescriptor[] nmap_pfd = package.FindFiles(Data.MetaData.NAME_MAP);
            pfds = package.FindFiles(0x49596978);
            Plugin.Nmap nmap = new SimPe.Plugin.Nmap(null);
            if (nmap_pfd.Length > 0)
            {
                nmap.ProcessData(nmap_pfd[0], package);
            }
            bool check = false;

            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.Rcol matd = new SimPe.Plugin.GenericRcol(null, true);
                    check = false;

                    foreach (Interfaces.Files.IPackedFileDescriptor epfd in nmap.Items)
                    {
                        if (
                            (epfd.Group == pfd.Group) &&
                            (epfd.Instance == pfd.Instance)
                            )
                        {
                            matd.FileDescriptor = pfd;
                            matd.Package        = package;
                            matds.Add(matd);
                            check = true;
                        }
                    }

                    //not found in the FileMap, so process Normally
                    if (!check)
                    {
                        matd.ProcessData(pfd, package);
                        matds.Add(matd);
                    }
                }
                catch (Exception) {}
            }

            //Texture Files
            nmap_pfd = package.FindFiles(Data.MetaData.NAME_MAP);
            pfds     = package.FindFiles(0x1C4A276C);
            check    = false;

            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.Txtr txtr = new SimPe.Plugin.Txtr(null, true);
                    check = false;

                    foreach (Interfaces.Files.IPackedFileDescriptor epfd in nmap.Items)
                    {
                        if (
                            (epfd.Group == pfd.Group) &&
                            (epfd.Instance == pfd.Instance)
                            )
                        {
                            txtr.FileDescriptor = pfd;
                            txtr.Package        = package;
                            txtrs.Add(epfd.Filename, txtr);
                            continue;
                        }
                    }

                    //not found in the FileMap, so process Normally
                    if (!check)
                    {
                        txtr.ProcessData(pfd, package);
                        foreach (SimPe.Plugin.ImageData id in txtr.Blocks)
                        {
                            txtrs.Add(id.NameResource.FileName.ToLower(), txtr);
                        }
                    }
                }
                catch (Exception) {}
            }
        }
コード例 #4
0
        /// <summary>
        /// Adds a Sim to the List
        /// </summary>
        /// <param name="objd"></param>
        /// <param name="ct"></param>
        /// <param name="step"></param>
        /// <returns>The Alias for that Sim</returns>
        /// <remarks>
        /// Alias.Tag has the following Structure:
        /// [0] : FileName of Character File (if NPC, this will be null)
        /// [1] : Thumbnail
        /// [2] : FamilyName
        /// [3] : Contains Age Data
        /// [4] : When NPC, this will get the Filename
        /// </remarks>
        protected Alias AddSim(SimPe.PackedFiles.Wrapper.ExtObjd objd, ref int ct, int step, bool npc)
        {
            //if (objd.Type!=Data.ObjectTypes.Person) return null;

            SimPe.Interfaces.Files.IPackageFile fl = objd.Package;
            //BinaryReader br = new BinaryReader(File.OpenRead(file));//new StreamReader(file)
            bool hasagedata = fl.FindFiles(0xAC598EAC).Length > 0;           //has Age Data

            object[] tags = new object[5];
            tags[0] = fl.FileName;
            tags[1] = null;
            tags[2] = Localization.Manager.GetString("Unknown");
            tags[3] = hasagedata;
            tags[4] = null;

            /*if (Helper.WindowsRegistry.HiddenMode)
             *      tags[5] = (!hasagedata) && (fl.FindFiles(0xAC506764).Length>0); //if this is true, the Sim has a Problem, and the package was probably split
             * else
             *      tags[5] = false;*/

            //set stuff for NPCs
            if (npc)
            {
                tags[4]  = tags[0];
                tags[0]  = "";
                tags[2] += " (NPC)";
            }

            Alias a = null;



            Interfaces.Files.IPackedFileDescriptor str_pfd = fl.FindFile(Data.MetaData.CTSS_FILE, 0, objd.FileDescriptor.Group, objd.CTSSInstance);

            if (str_pfd != null)
            {
                SimPe.PackedFiles.Wrapper.Str str = new SimPe.PackedFiles.Wrapper.Str();
                str.ProcessData(str_pfd, fl);
                SimPe.PackedFiles.Wrapper.StrItemList its = str.FallbackedLanguageItems(Helper.WindowsRegistry.LanguageCode);
                if (its.Length > 0)
                {
#if DEBUG
                    a = new Alias(objd.Guid, its[0].Title, "{name} {2} (0x{id})");
#else
                    a = new Alias(objd.Guid, its[0].Title, "{name} {2} (0x{id})");
#endif
                    if (its.Length > 2)
                    {
                        tags[2] = its[2].Title;
                    }
                }
            }


            if (a != null)
            {
                IPackedFileDescriptor[] piclist = fl.FindFiles(Data.MetaData.SIM_IMAGE_FILE);
                foreach (IPackedFileDescriptor pfd in piclist)
                {
                    if (pfd.Group != objd.FileDescriptor.Group)
                    {
                        continue;
                    }
                    if (pfd.Instance < 0x200)
                    {
                        SimPe.PackedFiles.Wrapper.Picture pic = new SimPe.PackedFiles.Wrapper.Picture();
                        pic.ProcessData(pfd, fl);

                        /*if (Helper.StartedGui==Executable.Classic)
                         *      WaitingScreen.UpdateImage(pic.Image);
                         * else
                         *      Wait.Image = pic.Image;								*/

                        tags[1] = pic.Image;
                        break;
                    }
                }

                a.Tag = tags;
                //if (Helper.StartedGui!=Executable.Classic)
                {
                    ct++;
                    if (ct % step == 1)
                    {
                        Wait.Message  = a.ToString();
                        Wait.Progress = ct;
                    }
                }

                //set stuff for NPCs
                if (npc)
                {
                    a.Tag[2] = a.Tag[2].ToString() + " (NPC)";
                }

                if (names == null)
                {
                    return(null);
                }
                if (!names.Contains(objd.Guid))
                {
                    names.Add(objd.Guid, a);
                }
            }

            return(a);
        }
コード例 #5
0
        void AddSim(string outPath, string hood, string hoodName, StreamWriter w, ExtSDesc sdsc)
        {
            #region desc
            string desc = ",,";
            SimPe.Interfaces.Files.IPackageFile pkg = SimPe.Packages.File.LoadFromFile(sdsc.CharacterFileName);
            if (pkg == null)
            {
                System.Diagnostics.Trace.WriteLine("Could not find character package:\n" + sdsc.CharacterFileName);
                return;// severe problem...
            }
            IPackedFileDescriptor[] pfds = pkg.FindFiles(StrWrapper.CTSStype);
            if (pfds == null || pfds.Length == 0)
            {
                System.Diagnostics.Trace.WriteLine("Could not find CTSS packed file for sim");
                return;// severe problem...
            }
            try
            {
                StrWrapper ctss = new StrWrapper();
                ctss.ProcessData(pfds[0], pkg);
                desc = q(ctss[1, 0]) +       // firstname
                       "," + q(ctss[1, 2]) + // lastname
                       "," + q(ctss[1, 1]) + // description
                       ""
                ;
            }
            catch { }
            #endregion

            #region family
            string family             = ",,";
            IPackedFileDescriptor pfd = sdsc.Package.FindFile(0x46414D49, 0x00000000, 0xffffffff, sdsc.FamilyInstance); // FAMI
            if (pfd != null)
            {
                Fami fami = null;
                fami = new Fami(FileTable.ProviderRegistry.SimNameProvider);
                fami.ProcessData(pfd, sdsc.Package);

                family = sdsc.FamilyInstance +
                         "," + q(sdsc.HouseholdName) +
                         "," + fami.LotInstance +
                         ""
                ;
            }
            #endregion

            #region ties
            string ties = ",,";
            if (eft != null)
            {
                SDesc[] p = eft.ParentSims(sdsc);
                SDesc[] s = eft.SpouseSims(sdsc);
                ties = (p == null || p.Length < 2 ? "," : p[0].Instance + "," + p[1].Instance) +
                       "," + (s == null || s.Length < 1 ? "" : s[0].Instance + "") +
                       ""
                ;
            }
            #endregion

            #region ghost

            /*string ghost = "N(,,,)";
             * if (sdsc.CharacterDescription.GhostFlag.IsGhost)
             * {
             *  ghost = "Y(" + (sdsc.CharacterDescription.GhostFlag.CanPassThroughObjects ? "Y" : "N") +
             *      (sdsc.CharacterDescription.GhostFlag.CanPassThroughWalls ? "Y" : "N") +
             *      (sdsc.CharacterDescription.GhostFlag.CanPassThroughPeople ? "Y" : "N") +
             *      (sdsc.CharacterDescription.GhostFlag.IgnoreTraversalCosts ? "Y" : "N") +
             *      ")";
             * }*/
            #endregion

            #region genetics
            string genetics = sdsc.GeneticCharacter.Active +
                              "," + sdsc.GeneticCharacter.Neat +
                              "," + sdsc.GeneticCharacter.Nice +
                              "," + sdsc.GeneticCharacter.Outgoing +
                              "," + sdsc.GeneticCharacter.Playful +
                              ""
            ;
            #endregion

            #region character
            string character = sdsc.Character.Active +
                               "," + sdsc.Character.Neat +
                               "," + sdsc.Character.Nice +
                               "," + sdsc.Character.Outgoing +
                               "," + sdsc.Character.Playful +
                               ""
            ;
            #endregion

            #region interests
            string interests = sdsc.Interests.Animals +
                               "," + sdsc.Interests.Crime +
                               "," + sdsc.Interests.Culture +
                               "," + sdsc.Interests.Entertainment +
                               "," + sdsc.Interests.Environment +
                               "," + sdsc.Interests.Fashion +
                               "," + sdsc.Interests.FemalePreference +
                               "," + sdsc.Interests.Food +
                               "," + sdsc.Interests.Health +
                               "," + sdsc.Interests.MalePreference +
                               "," + sdsc.Interests.Money +
                               "," + sdsc.Interests.Paranormal +
                               "," + sdsc.Interests.Politics +
                               "," + sdsc.Interests.School +
                               "," + sdsc.Interests.Scifi +
                               "," + sdsc.Interests.Sports +
                               "," + sdsc.Interests.Toys +
                               "," + sdsc.Interests.Travel +
                               "," + sdsc.Interests.Weather +
                               "," + sdsc.Interests.Work +
                               ""
            ;
            #endregion

            #region skills
            string skills = sdsc.Skills.Body +
                            "," + sdsc.Skills.Charisma +
                            "," + sdsc.Skills.Cleaning +
                            "," + sdsc.Skills.Cooking +
                            "," + sdsc.Skills.Creativity +
                            "," + sdsc.Skills.Fatness +
                            "," + sdsc.Skills.Logic +
                            "," + sdsc.Skills.Mechanical +
                            "," + sdsc.Skills.Romance +
                            ""
            ;
            #endregion

            #region university
            string university = "N,,,,,,";
            if (sdsc.University != null && sdsc.University.OnCampus == 0x1)
            {
                university = "Y" +
                             "," + sdsc.University.Effort +
                             "," + sdsc.University.Grade +
                             "," + sdsc.University.Time +
                             "," + sdsc.University.Semester +
                             "," + sdsc.University.Influence +
                             "," + sdsc.University.Major
                ;
            }
            #endregion

            #region freetime
            string freetime = ",,,";
            if (sdsc.Freetime != null)
            {
                freetime = sdsc.Freetime.PrimaryAspiration +
                           "," + sdsc.Freetime.SecondaryAspiration +
                           "," + sdsc.Freetime.HobbyPredistined +
                           "," + sdsc.Freetime.LongtermAspiration // LifetimeWant ?
                ;
                //sdsc.Freetime.BugCollection -- no...
            }
            #endregion

            //sdsc.Business.LotID


            if (dt.Equals(new DateTime(0)) || wasUnk || dt.AddMilliseconds(200).CompareTo(DateTime.UtcNow) < 0)
            {
                System.Windows.Forms.Application.DoEvents();
                if (!((string)(sdsc.SimName + " " + sdsc.SimFamilyName)).Trim().ToLower().Equals("unknown"))
                {
                    dt     = new DateTime(DateTime.UtcNow.Ticks);
                    wasUnk = false;
                    splash("Saving " + sdsc.SimName + " " + sdsc.SimFamilyName);
                }
                else
                {
                    wasUnk = true;
                }
            }
            string csv = hood +
                         "," + q(hoodName) +
                         "," + sdsc.Instance +
                         "," + desc +
                         "," + family +
                         "," + (sdsc.AvailableCharacterData ? "Y" : "N") +
                         "," + (sdsc.Unlinked != 0x00 ? "Y" : "N") +
                         "," + ties +
                         //"," + ghost +
                         "," + (bodyType)(ushort)sdsc.CharacterDescription.BodyFlag +
                         //"," + sdsc.CharacterDescription.AutonomyLevel +
                         "," + sdsc.CharacterDescription.NPCType +
                         //"," + sdsc.CharacterDescription.MotivesStatic +
                         //"," + sdsc.CharacterDescription.VoiceType +
                         "," + sdsc.CharacterDescription.SchoolType +
                         "," + sdsc.CharacterDescription.Grade +
                         "," + sdsc.CharacterDescription.CareerPerformance +
                         "," + sdsc.CharacterDescription.Career +
                         "," + sdsc.CharacterDescription.CareerLevel +
                         "," + sdsc.CharacterDescription.ZodiacSign +
                         "," + sdsc.CharacterDescription.Aspiration +
                         "," + sdsc.CharacterDescription.Gender +
                         "," + sdsc.CharacterDescription.LifeSection +
                         "," + sdsc.CharacterDescription.Age +
                         "," + sdsc.CharacterDescription.PrevAgeDays +
                         "," + sdsc.CharacterDescription.AgeDuration +
                         "," + sdsc.CharacterDescription.BlizLifelinePoints +
                         "," + sdsc.CharacterDescription.LifelinePoints +
                         "," + sdsc.CharacterDescription.LifelineScore +
                         "," + genetics +
                         "," + character +
                         "," + interests +
                         "," + skills +
                         "," + university +
                         "," + (sdsc.Nightlife == null ? "Human" : sdsc.Nightlife.Species.ToString()) +
                         "," + (sdsc.Business == null ? (ushort)0 : sdsc.Business.Salary) +
                         "," + freetime +
                         //";Reputation" +
                         ""
            ;
            w.WriteLine(csv);

            AddImage(sdsc.Image, Path.Combine(Path.Combine(outPath, "SimImage"), hood + "_" + sdsc.Instance + ".png"));
        }