Ejemplo n.º 1
0
        private void doStrChooser(ComboBox scope, pjse.GS.GlobalStr instance, TextBox tbVal, TextBox strText)
        {
            Scope[] s = { Scope.Private, Scope.SemiGlobal, Scope.Global };
            pjse.FileTable.Entry[] items = (scope.SelectedIndex < 0) ? null :
                                           pjse.FileTable.GFT[(uint)SimPe.Data.MetaData.STRING_FILE, inst.Parent.GroupForScope(s[scope.SelectedIndex]), (uint)instance];

            if (items == null || items.Length == 0)
            {
                MessageBox.Show(pjse.Localization.GetString("bow_noStrings")
                                + " (" + pjse.Localization.GetString(s[scope.SelectedIndex].ToString()) + ")");
                return; // eek!
            }

            SimPe.PackedFiles.Wrapper.StrWrapper str = new StrWrapper();
            str.ProcessData(items[0].PFD, items[0].Package);

            int i = (new StrChooser(true)).Strnum(str);

            if (i >= 0)
            {
                bool savedState = internalchg;
                internalchg = true;
                tbVal.Text  = "0x" + SimPe.Helper.HexString((ushort)i);
                doStrValue(scope, instance, (ushort)i, strText);
                internalchg = savedState;
            }
        }
Ejemplo n.º 2
0
        private void doStrChooser(TextBox tbVal, TextBox strText)
        {
            pjse.FileTable.Entry[] items =
                pjse.FileTable.GFT[(uint)SimPe.Data.MetaData.STRING_FILE, inst.Parent.GroupForScope(AnimScope()), (uint)AnimInstance()];

            if (items == null || items.Length == 0)
            {
                MessageBox.Show(pjse.Localization.GetString("bow_noStrings")
                                + " (" + pjse.Localization.GetString(AnimScope().ToString()) + ")");
                return; // eek!
            }

            SimPe.PackedFiles.Wrapper.StrWrapper str = new StrWrapper();
            str.ProcessData(items[0].PFD, items[0].Package);

            int i = (new StrChooser(true)).Strnum(str);

            if (i >= 0)
            {
                bool savedState = internalchg;
                internalchg = true;
                tbVal.Text  = "0x" + SimPe.Helper.HexString((ushort)i);
                doStrValue((ushort)i, strText);
                internalchg = savedState;
            }
        }
Ejemplo n.º 3
0
        private void doStrChooser()
        {
            pjse.FileTable.Entry[] items = pjse.FileTable.GFT[(uint)SimPe.Data.MetaData.STRING_FILE, inst.Parent.GroupForScope(this.Scope), (uint)GS.GlobalStr.MakeAction];

            if (items == null || items.Length == 0)
            {
                MessageBox.Show(pjse.Localization.GetString("bow_noStrings")
                                + " (" + pjse.Localization.GetString(this.Scope.ToString()) + ")");
                return; // eek!
            }

            SimPe.PackedFiles.Wrapper.StrWrapper str = new StrWrapper();
            str.ProcessData(items[0].PFD, items[0].Package);

            int i = (new StrChooser(true)).Strnum(str);

            if (i >= 0)
            {
                this.tbStrIndex.Text     = "0x" + SimPe.Helper.HexString((byte)(i + 1));
                this.lbActionString.Text = ((BhavWiz)inst).readStr(this.Scope, GS.GlobalStr.MakeAction, (ushort)i, -1, pjse.Detail.ErrorNames);
            }
        }
Ejemplo n.º 4
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"));
        }
Ejemplo n.º 5
0
        void AddHood(string outPath, string dir, StreamWriter w1, StreamWriter w2)
        {
            string hood     = Path.GetFileName(dir);
            string hoodFile = Path.Combine(dir, hood + "_Neighborhood.package");

            if (!File.Exists(hoodFile))
            {
                return;
            }

            SimPe.Packages.File pkg = SimPe.Packages.File.LoadFromFile(hoodFile);
            if (pkg == null)
            {
                return;
            }

            string hoodName = Localization.GetString("Unknown");

            IPackedFileDescriptor[] pfds = pkg.FindFiles(SimPe.Data.MetaData.CTSS_FILE);
            StrWrapper ctss = null;

            if (pfds.Length == 1)
            {
                ctss = new StrWrapper();
                ctss.ProcessData(pfds[0], pkg);
                hoodName = ctss[1, 0];
            }


            if (!Directory.Exists(Path.Combine(outPath, "SimImage")))
            {
                Directory.CreateDirectory(Path.Combine(outPath, "SimImage"));
            }

            System.Windows.Forms.Application.DoEvents();
            splash("Loading Neighborhood " + hood + ": " + hoodName);
            SetProvider(pkg);

            dt     = new DateTime(0);
            wasUnk = true;
            pfds   = pkg.FindFiles(SimPe.Data.MetaData.SIM_DESCRIPTION_FILE);
            foreach (IPackedFileDescriptor spfd in pfds)
            {
                ExtSDesc sdsc = new ExtSDesc();
                sdsc.ProcessData(spfd, pkg);

                AddSim(outPath, hood, hoodName, w1, sdsc);
            }


            if (!Directory.Exists(Path.Combine(outPath, "LotImage")))
            {
                Directory.CreateDirectory(Path.Combine(outPath, "LotImage"));
            }

            System.Windows.Forms.Application.DoEvents();
            splash("Loading Neighborhood " + hood + ": " + hoodName);
            SetProvider(pkg);

            dt     = new DateTime(0);
            wasUnk = true;
            pfds   = pkg.FindFiles(SimPe.Plugin.Ltxt.Ltxttype);
            foreach (IPackedFileDescriptor spfd in pfds)
            {
                Ltxt ltxt = new Ltxt();
                ltxt.ProcessData(spfd, pkg);

                AddLot(outPath, hood, hoodName, w2, ltxt);
            }
        }