예제 #1
0
        public static bool Household_ImportContent(Household _this, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            if (_this == null)
            {
                throw new NullReferenceException("if (this == null)");
            }

            reader.ReadString(1357107804u, out _this.mName, "");
            reader.ReadInt32(867787827u, out _this.mFamilyFunds, 0);
            reader.ReadString(3647669240u, out _this.mBioText, "");
            reader.ReadInt32(145720536u, out _this.mUnpaidBills, 0);
            reader.ReadInt32(3338514733u, out _this.mLotHomeWorth, 0);

            long exportTime = DateTime.Now.ToBinary();

            reader.ReadInt64(1669643236u, out exportTime, DateTime.Now.ToBinary());
            _this.mExportTime = DateTime.FromBinary(exportTime);

            reader.ReadBool(571722353u, out _this.mbLifetimeHappinessNotificationShown, false);
            IPropertyStreamReader child = reader.GetChild(2449095374u);

            if (child != null)
            {
                HMembers_ImportContent(_this.mMembers, resKeyTable, objIdTable, child);
            }

            try
            {
                foreach (SimDescription allSimDescription in _this.mMembers.AllSimDescriptionList)
                {
                    allSimDescription.OnHouseholdChanged(_this, true);
                    allSimDescription.CareerManager.OnLoadFixup();
                    Sims3.Gameplay.Careers.Occupation occupation = allSimDescription.CareerManager.Occupation;
                    if (occupation != null)
                    {
                        occupation.RepairLocation();
                    }
                }

                foreach (SimDescription allSimDescription2 in _this.mMembers.AllSimDescriptionList)
                {
                    if (allSimDescription2.Pregnancy != null)
                    {
                        SimDescription value2;
                        if (Household.sOldIdToNewSimDescriptionMap != null && Household.sOldIdToNewSimDescriptionMap.TryGetValue(allSimDescription2.Pregnancy.DadDescriptionId, out value2))
                        {
                            allSimDescription2.Pregnancy.DadDescriptionId = value2.SimDescriptionId;
                        }
                        else if (!Household.IsTravelImport && _this.mMembers.GetSimDescriptionFromId(allSimDescription2.Pregnancy.DadDescriptionId) == null)
                        {
                            allSimDescription2.Pregnancy.DadDescriptionId = 0uL;
                        }
                    }
                }

                child = reader.GetChild(2706303414u);
                if (child != null)
                {
                    //_this.ImportRelationships(resKeyTable, objIdTable, child);
                    //_this.ImportRelationships(resKeyTable, objIdTable, child);
                    Household_ImportRelationships(_this, resKeyTable, objIdTable, child);
                }
            }
            catch (StackOverflowException) { throw; }
            catch (ResetException) { throw; }
            catch (Exception)
            { }


            reader.ReadInt32(141731785u, out _this.mAncientCoinCount, 0);

            ulong uniqueObjectsObtained;

            reader.ReadUint64(1193523264u, out uniqueObjectsObtained, 0uL);
            _this.UniqueObjectsObtained = (UniqueObjectKey)uniqueObjectsObtained;

            _this.mKeystonePanelsUsed = new PairedListDictionary <WorldName, List <string> >();

            int KeystonePanelsUsedCount;

            reader.ReadInt32(129814813u, out KeystonePanelsUsedCount, 0);
            int checkloop = 0; // Fix Loop 12:48 20/05/2019

            for (uint num = 0u; num < KeystonePanelsUsedCount; num++)
            {
                int keystonePanelsUsed;
                reader.ReadInt32(146578516 + num, out keystonePanelsUsed, -1);
                WorldName key = (WorldName)keystonePanelsUsed;

                string[] keystonePanelsList;
                reader.ReadString(163369191 + num, out keystonePanelsList);
                _this.mKeystonePanelsUsed[key] = new List <string>(keystonePanelsList ?? new string[0]);

                if (checkloop++ > 500)
                {
                    break;
                }
            }

            _this.mCompletedHouseholdOpportunities.Clear();

            ulong[] completedHouseholdOpportunities;
            reader.ReadUint64(149611345u, out completedHouseholdOpportunities);

            foreach (ulong key in completedHouseholdOpportunities)
            {
                _this.mCompletedHouseholdOpportunities.Add(key, true);
            }

            reader.ReadUint32(149611346u, out _this.mMoneySaved);
            if (_this.mMoneySaved == null || _this.mMoneySaved.Length != 3)
            {
                _this.mMoneySaved = new uint[3];
            }

            ulong[] wardrobeCasParts;
            reader.ReadUint64(153835052u, out wardrobeCasParts);
            foreach (ulong item in wardrobeCasParts)
            {
                _this.mWardrobeCasParts.Add(item);
            }

            ulong serviceUniform;

            reader.ReadUint64(156333552u, out serviceUniform, 0uL);
            _this.AddServiceUniforms((ServiceType)serviceUniform);

            return(true);
        }
예제 #2
0
        public static bool ImportContent(Household me, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            ulong num2;
            int   num3;

            ulong[] numArray;
            ulong[] numArray2;
            ulong   num8;

            reader.ReadString(0x50e3d25c, out me.mName, "");
            reader.ReadInt32(0x33b96433, out me.mFamilyFunds, 0x0);
            reader.ReadString(0xd96b03f8, out me.mBioText, "");
            reader.ReadInt32(0x8af84d8, out me.mUnpaidBills, 0x0);
            reader.ReadInt32(0xc6fdb12d, out me.mLotHomeWorth, 0x0);
            long num = DateTime.Now.ToBinary();

            reader.ReadInt64(0x6384bbe4, out num, DateTime.Now.ToBinary());
            me.mExportTime = DateTime.FromBinary(num);
            reader.ReadBool(0x2213ca71, out me.mbLifetimeHappinessNotificationShown, false);
            IPropertyStreamReader child = reader.GetChild(0x91fa3ace);

            if (child != null)
            {
                me.mMembers.ImportContent(resKeyTable, objIdTable, child);

                // Custom to handle import of custom careers
                HouseholdMemberEx.ImportContent(me.mMembers, resKeyTable, objIdTable, child);
            }

            foreach (SimDescription description in Households.All(me))
            {
                try
                {
                    // Custom
                    if (Household.sOldIdToNewSimDescriptionMap != null)
                    {
                        if ((description.mOldSimDescriptionId != 0) &&
                            (!Household.sOldIdToNewSimDescriptionMap.ContainsKey(description.mOldSimDescriptionId)))
                        {
                            Household.sOldIdToNewSimDescriptionMap.Add(description.mOldSimDescriptionId, description);
                        }
                        if (!Household.sOldIdToNewSimDescriptionMap.ContainsKey(description.mSimDescriptionId))
                        {
                            Household.sOldIdToNewSimDescriptionMap.Add(description.mSimDescriptionId, description);
                        }
                    }

                    description.OnHouseholdChanged(me, true);
                    description.CareerManager.OnLoadFixup();

                    Occupation occupation = description.CareerManager.Occupation;
                    if (occupation != null)
                    {
                        occupation.RepairLocation();
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(description, e);
                }
            }

            foreach (SimDescription description2 in Households.All(me))
            {
                try
                {
                    if (description2.Pregnancy != null)
                    {
                        SimDescription description3;
                        if ((Household.sOldIdToNewSimDescriptionMap != null) && Household.sOldIdToNewSimDescriptionMap.TryGetValue(description2.Pregnancy.DadDescriptionId, out description3))
                        {
                            description2.Pregnancy.DadDescriptionId = description3.SimDescriptionId;
                        }
                        else if (!Household.IsTravelImport && (me.mMembers.GetSimDescriptionFromId(description2.Pregnancy.DadDescriptionId) == null))
                        {
                            description2.Pregnancy.DadDescriptionId = 0x0L;
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(description2, e);
                }
            }

            child = reader.GetChild(0xa14ee9b6);
            if (child != null)
            {
                // Custom Function
                ImportRelationships(me, resKeyTable, objIdTable, child);
            }

            reader.ReadInt32(0x872a7c9, out me.mAncientCoinCount, 0x0);
            reader.ReadUint64(0x4723b840, out num2, 0x0L);
            me.UniqueObjectsObtained = (UniqueObjectKey)num2;
            me.mKeystonePanelsUsed   = new PairedListDictionary <WorldName, List <string> >();
            reader.ReadInt32(0x7bcd11d, out num3, 0x0);
            for (uint i = 0x0; i < num3; i++)
            {
                int      num5;
                string[] strArray;
                reader.ReadInt32(0x8bc9c54 + i, out num5, -1);
                WorldName name = (WorldName)num5;
                reader.ReadString(0x9bcd0e7 + i, out strArray);
                me.mKeystonePanelsUsed[name] = new List <string>(strArray);
            }
            me.mCompletedHouseholdOpportunities.Clear();
            reader.ReadUint64(0x8eae351, out numArray);
            foreach (ulong num6 in numArray)
            {
                me.mCompletedHouseholdOpportunities.Add(num6, true);
            }
            reader.ReadUint32(0x8eae352, out me.mMoneySaved);
            reader.ReadUint64(0x92b562c, out numArray2);
            foreach (ulong num7 in numArray2)
            {
                me.mWardrobeCasParts.Add(num7);
            }
            reader.ReadUint64(0x95175f0, out num8, 0x0L);
            me.AddServiceUniforms((ServiceType)((int)num8));
            return(true);
        }
예제 #3
0
        public static bool ImportContent(Household me, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            ulong num2;
            int num3;
            ulong[] numArray;
            ulong[] numArray2;
            ulong num8;

            reader.ReadString(0x50e3d25c, out me.mName, "");
            reader.ReadInt32(0x33b96433, out me.mFamilyFunds, 0x0);
            reader.ReadString(0xd96b03f8, out me.mBioText, "");
            reader.ReadInt32(0x8af84d8, out me.mUnpaidBills, 0x0);
            reader.ReadInt32(0xc6fdb12d, out me.mLotHomeWorth, 0x0);
            long num = DateTime.Now.ToBinary();
            reader.ReadInt64(0x6384bbe4, out num, DateTime.Now.ToBinary());
            me.mExportTime = DateTime.FromBinary(num);
            reader.ReadBool(0x2213ca71, out me.mbLifetimeHappinessNotificationShown, false);
            IPropertyStreamReader child = reader.GetChild(0x91fa3ace);
            if (child != null)
            {
                me.mMembers.ImportContent(resKeyTable, objIdTable, child);

                // Custom to handle import of custom careers
                HouseholdMemberEx.ImportContent(me.mMembers, resKeyTable, objIdTable, child);
            }

            foreach (SimDescription description in Households.All(me))
            {
                try
                {
                    // Custom
                    if (Household.sOldIdToNewSimDescriptionMap != null)
                    {
                        if ((description.mOldSimDescriptionId != 0) &&
                            (!Household.sOldIdToNewSimDescriptionMap.ContainsKey(description.mOldSimDescriptionId)))
                        {
                            Household.sOldIdToNewSimDescriptionMap.Add(description.mOldSimDescriptionId, description);
                        }
                        if (!Household.sOldIdToNewSimDescriptionMap.ContainsKey(description.mSimDescriptionId))
                        {
                            Household.sOldIdToNewSimDescriptionMap.Add(description.mSimDescriptionId, description);
                        }
                    }

                    description.OnHouseholdChanged(me, true);
                    description.CareerManager.OnLoadFixup();

                    Occupation occupation = description.CareerManager.Occupation;
                    if (occupation != null)
                    {
                        occupation.RepairLocation();
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(description, e);
                }
            }

            foreach (SimDescription description2 in Households.All(me))
            {
                try
                {
                    if (description2.Pregnancy != null)
                    {
                        SimDescription description3;
                        if ((Household.sOldIdToNewSimDescriptionMap != null) && Household.sOldIdToNewSimDescriptionMap.TryGetValue(description2.Pregnancy.DadDescriptionId, out description3))
                        {
                            description2.Pregnancy.DadDescriptionId = description3.SimDescriptionId;
                        }
                        else if (!Household.IsTravelImport && (me.mMembers.GetSimDescriptionFromId(description2.Pregnancy.DadDescriptionId) == null))
                        {
                            description2.Pregnancy.DadDescriptionId = 0x0L;
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(description2, e);
                }
            }

            child = reader.GetChild(0xa14ee9b6);
            if (child != null)
            {
                // Custom Function
                ImportRelationships(me, resKeyTable, objIdTable, child);
            }

            reader.ReadInt32(0x872a7c9, out me.mAncientCoinCount, 0x0);
            reader.ReadUint64(0x4723b840, out num2, 0x0L);
            me.UniqueObjectsObtained = (UniqueObjectKey)num2;
            me.mKeystonePanelsUsed = new PairedListDictionary<WorldName, List<string>>();
            reader.ReadInt32(0x7bcd11d, out num3, 0x0);
            for (uint i = 0x0; i < num3; i++)
            {
                int num5;
                string[] strArray;
                reader.ReadInt32(0x8bc9c54 + i, out num5, -1);
                WorldName name = (WorldName)num5;
                reader.ReadString(0x9bcd0e7 + i, out strArray);
                me.mKeystonePanelsUsed[name] = new List<string>(strArray);
            }
            me.mCompletedHouseholdOpportunities.Clear();
            reader.ReadUint64(0x8eae351, out numArray);
            foreach (ulong num6 in numArray)
            {
                me.mCompletedHouseholdOpportunities.Add(num6, true);
            }
            reader.ReadUint32(0x8eae352, out me.mMoneySaved);
            reader.ReadUint64(0x92b562c, out numArray2);
            foreach (ulong num7 in numArray2)
            {
                me.mWardrobeCasParts.Add(num7);
            }
            reader.ReadUint64(0x95175f0, out num8, 0x0L);
            me.AddServiceUniforms((ServiceType)((int)num8));
            return true;
        }