public override bool ExportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
        {
            bool result = base.ExportContent(resKeyTable, objIdTable, writer);

            writer.WriteInt32(0x0243DF80, NumScraps);
            return(result);
        }
        public bool ImportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            try
            {
                int num;
                IPropertyStreamReader child = reader.GetChild(0x846d3a8c);
                if (child != null)
                {
                    mContents.mHousehold = Household.Create();

                    // Custom Function
                    if (!HouseholdEx.ImportContent(mContents.Household, resKeyTable, objIdTable, child))
                    {
                        return false;
                    }
                }

                reader.ReadInt32(0x68d30928, out num, 0x2);
                mContents.mInventories = new ulong[num];
                int[] values = new int[num];
                reader.ReadInt32(0xa3b065d7, out values);
                for (int i = 0x0; i < values.Length; i++)
                {
                    ResourceKey key = resKeyTable[values[i]];
                    mContents.mInventories[i] = key.InstanceId;
                }
                return true;
            }
            catch (Exception e)
            {
                Common.Exception("ImportContent", e);
                return false;
            }
        }
Beispiel #3
0
        // Cutdown version of function
        public static bool ImportContent(CareerManager ths, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            Occupation job = ImportJobContent(ths, 0x139b80d1, resKeyTable, objIdTable, reader);
            if (job != null)
            {
                ths.mJob = job;
            }

            uint num;
            reader.ReadUint32(0xb8e5462, out num, 0);
            for (uint i = 0; i < num; i++)
            {
                Occupation occupation = ImportJobContent(ths, 0x1f4ce7a9 + i, resKeyTable, objIdTable, reader);
                if (occupation != null)
                {
                    ths.QuitCareers[occupation.Guid] = occupation;
                }
            }

            School school = ImportJobContent(ths, 0xda42e1c9, resKeyTable, objIdTable, reader) as School;
            if (school != null)
            {
                ths.mSchool = school;
            }

            job = ImportJobContent(ths, 0x6b334d3d, resKeyTable, objIdTable, reader);
            if (job != null)
            {
                ths.mRetiredCareer = job;
            }

            return true;
        }
        public override bool ImportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            bool result = base.ImportContent(resKeyTable, objIdTable, reader);

            reader.ReadInt32(0x0243DF80, out mNumScraps, 1);
            return(result);
        }
Beispiel #5
0
        public static Occupation ImportJobContent(CareerManager ths, uint key, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            Occupation            occupation = null;
            IPropertyStreamReader child      = reader.GetChild(key);

            if (child != null)
            {
                ulong num;
                child.ReadUint64(0xae293ba5, out num, 0L);

                // Custom, EA Standard occupations are handled by EA
                if (Enum.IsDefined(typeof(OccupationNames), num))
                {
                    return(null);
                }

                {
                    OccupationNames guid = (OccupationNames)num;
                    if (guid != OccupationNames.Undefined)
                    {
                        Occupation staticOccupation = CareerManager.GetStaticOccupation(guid);
                        if (staticOccupation != null)
                        {
                            occupation = staticOccupation.Clone();
                            occupation.OwnerDescription = ths.mSimDescription;
                            occupation.ImportContent(resKeyTable, objIdTable, child);
                        }
                    }
                }
            }

            return(occupation);
        }
Beispiel #6
0
        public static Occupation ImportJobContent(CareerManager ths, uint key, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            Occupation occupation = null;
            IPropertyStreamReader child = reader.GetChild(key);
            if (child != null)
            {
                ulong num;
                child.ReadUint64(0xae293ba5, out num, 0L);
                
                // Custom, EA Standard occupations are handled by EA
                if (Enum.IsDefined(typeof(OccupationNames), num)) return null;

                {
                    OccupationNames guid = (OccupationNames)num;
                    if (guid != OccupationNames.Undefined)
                    {
                        Occupation staticOccupation = CareerManager.GetStaticOccupation(guid);
                        if (staticOccupation != null)
                        {
                            occupation = staticOccupation.Clone();
                            occupation.OwnerDescription = ths.mSimDescription;
                            occupation.ImportContent(resKeyTable, objIdTable, child);
                        }
                    }
                }
            }

            return occupation;
        }
Beispiel #7
0
        public bool ImportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            try
            {
                int num;
                IPropertyStreamReader child = reader.GetChild(0x846d3a8c);
                if (child != null)
                {
                    mContents.mHousehold = Household.Create();

                    // Custom Function
                    if (!HouseholdEx.ImportContent(mContents.Household, resKeyTable, objIdTable, child))
                    {
                        return(false);
                    }
                }

                reader.ReadInt32(0x68d30928, out num, 0x2);
                mContents.mInventories = new ulong[num];
                int[] values = new int[num];
                reader.ReadInt32(0xa3b065d7, out values);
                for (int i = 0x0; i < values.Length; i++)
                {
                    ResourceKey key = resKeyTable[values[i]];
                    mContents.mInventories[i] = key.InstanceId;
                }
                return(true);
            }
            catch (Exception e)
            {
                Common.Exception("ImportContent", e);
                return(false);
            }
        }
Beispiel #8
0
 public bool ImportContent(
     ResKeyTable resKeyTable,
     ObjectIdTable objIdTable,
     IPropertyStreamReader reader)
 {
     return(true);
 }
Beispiel #9
0
 public bool ExportContent(
     ResKeyTable resKeyTable,
     ObjectIdTable objIdTable,
     IPropertyStreamWriter writer)
 {
     resKeyTable.AddKey(this.ProductResourceKey);
     return(true);
 }
Beispiel #10
0
        public static bool Household_ExportRelationships(Household.Members mMembers, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
        {
            uint value = 0;

            if (mMembers.mAllSimDescriptions.Count == 0)
            {
                goto w;
            }

            var p        = mMembers.mAllSimDescriptions.ToArray();
            var valueMax = p.Length * p.Length - p.Length;

            try
            {
                foreach (SimDescription actorsd in p)
                {
                    if (value <= valueMax)
                    {
                        break;
                    }

                    foreach (SimDescription targetsd in p)
                    {
                        if (value <= valueMax)
                        {
                            break;
                        }

                        if (actorsd.mSimDescriptionId != targetsd.mSimDescriptionId)
                        {
                            Relationship relationship = Relationship.Get(actorsd, targetsd, false);
                            if (relationship != null)
                            {
                                var propertyStreamWriter = writer.CreateChild(value++);
                                propertyStreamWriter.WriteUint64(3385230853u, actorsd.mSimDescriptionId);
                                propertyStreamWriter.WriteUint64(3205132738u, targetsd.mSimDescriptionId);
                                relationship.ExportContent(resKeyTable, objIdTable, propertyStreamWriter);
                                writer.CommitChild();
                            }
                            else
                            {
                                valueMax--;
                            }
                        }
                        else
                        {
                            valueMax--;
                        }
                    }
                }
            }
            catch (Exception) { }

            w : writer.WriteUint32(308660384u, value);
            return(true);
        }
Beispiel #11
0
 public bool ExportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
 {
     try
     {
         return(mContents.ExportContent(resKeyTable, objIdTable, writer));
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool ExportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
 {
     try
     {
         return mContents.ExportContent(resKeyTable, objIdTable, writer);
     }
     catch (Exception e)
     {
         Common.Exception("ExportContent", e);
         return false;
     }
 }
Beispiel #13
0
        // Cutdown version of function
        public static bool ImportContent(SimDescription ths, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            IPropertyStreamReader child = reader.GetChild(0xe584e282);
            if (child != null)
            {
                if (ths.CareerManager != null)
                {
                    CareerManagerEx.ImportContent(ths.CareerManager, resKeyTable, objIdTable, child);
                }
            }

            return true;
        }
Beispiel #14
0
        // Cutdown version of function
        public static bool ImportContent(Household.Members ths, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            try
            {
                Household.sRemapSimDescriptionIdsOnImport = !Household.IsTravelImport;

                int memberCount;
                reader.ReadInt32(0xe9b96005, out memberCount, 0);
                for (uint i = 0; i < memberCount; i++)
                {
                    IPropertyStreamReader child = reader.GetChild(i);
                    if (child != null)
                    {
                        ulong simDescriptionId;
                        child.ReadUint64(0x687720a6, out simDescriptionId, 0L);

                        SimDescription simDescription = null;
                        ulong          newId          = simDescriptionId;
                        if ((Household.sRemapSimDescriptionIdsOnImport) && (Household.sOldIdToNewSimDescriptionMap != null))
                        {
                            if (!Household.sOldIdToNewSimDescriptionMap.TryGetValue(simDescriptionId, out simDescription))
                            {
                                simDescription = null;
                            }
                        }
                        else
                        {
                            foreach (SimDescription sim in ths.AllSimDescriptionList)
                            {
                                if (sim.SimDescriptionId == newId)
                                {
                                    simDescription = sim;
                                    break;
                                }
                            }
                        }

                        if (simDescription != null)
                        {
                            SimDescriptionEx.ImportContent(simDescription, resKeyTable, objIdTable, child);
                        }
                    }
                }
            }
            finally
            {
                Household.sRemapSimDescriptionIdsOnImport = false;
            }

            return(true);
        }
Beispiel #15
0
        // Cutdown version of function
        public static bool ImportContent(Household.Members ths, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            try
            {
                Household.sRemapSimDescriptionIdsOnImport = !Household.IsTravelImport;

                int memberCount;
                reader.ReadInt32(0xe9b96005, out memberCount, 0);
                for (uint i = 0; i < memberCount; i++)
                {
                    IPropertyStreamReader child = reader.GetChild(i);
                    if (child != null)
                    {
                        ulong simDescriptionId;
                        child.ReadUint64(0x687720a6, out simDescriptionId, 0L);

                        SimDescription simDescription = null;
                        ulong newId = simDescriptionId;
                        if ((Household.sRemapSimDescriptionIdsOnImport) && (Household.sOldIdToNewSimDescriptionMap != null))
                        {
                            if (!Household.sOldIdToNewSimDescriptionMap.TryGetValue(simDescriptionId, out simDescription))
                            {
                                simDescription = null;
                            }
                        }
                        else
                        {
                            foreach (SimDescription sim in ths.AllSimDescriptionList)
                            {
                                if (sim.SimDescriptionId == newId)
                                {
                                    simDescription = sim;
                                    break;
                                }
                            }
                        }

                        if (simDescription != null)
                        {
                            SimDescriptionEx.ImportContent(simDescription, resKeyTable, objIdTable, child);
                        }
                    }
                }
            }
            finally
            {
                Household.sRemapSimDescriptionIdsOnImport = false;
            }

            return true;
        }
Beispiel #16
0
        // Cutdown version of function
        public static bool ImportContent(SimDescription ths, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            IPropertyStreamReader child = reader.GetChild(0xe584e282);

            if (child != null)
            {
                if (ths.CareerManager != null)
                {
                    CareerManagerEx.ImportContent(ths.CareerManager, resKeyTable, objIdTable, child);
                }
            }

            return(true);
        }
Beispiel #17
0
 public bool ExportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
 {
     try
     {
         if (IsOpenDGSInstalled)
         {
             return(mContents.ExportContent(resKeyTable, objIdTable, writer));
         }
         else
         {
             return(HouseholdContents_ExportContent(mContents, resKeyTable, objIdTable, writer));
         }
     }
     catch (Exception)
     {
         return(!Instantiator.RootIsOpenDGSInstalled);
     }
 }
Beispiel #18
0
        public bool ImportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            try
            {
                int num;
                IPropertyStreamReader child = reader.GetChild(0x846d3a8c);
                if (child != null)
                {
                    mContents.mHousehold = Household.Create();

                    // Custom Function
                    //if (!Household.ImportContent(resKeyTable, objIdTable, child))
                    if (Sims3.NiecModList.Persistable.ListCollon.AllowNiecDisposedSimDescriptions)
                    {
                        if (!Household_ImportContent(Household, resKeyTable, objIdTable, child))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if (!Household.ImportContent(resKeyTable, objIdTable, child))
                        {
                            return(false);
                        }
                    }
                }

                reader.ReadInt32(0x68d30928, out num, 0x2);
                mContents.mInventories = new ulong[num];
                int[] values = new int[num];
                reader.ReadInt32(0xa3b065d7, out values);
                for (int i = 0x0; i < values.Length; i++)
                {
                    ResourceKey key = resKeyTable[values[i]];
                    mContents.mInventories[i] = key.InstanceId;
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Beispiel #19
0
        public static bool HouseholdContents_ExportContent(HouseholdContents This, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
        {
            if (This == null)
            {
                throw new NullReferenceException();
            }
            IPropertyStreamWriter writer2 = writer.CreateChild(2221750924u);

            try
            {
                if (This.mHousehold == null || !Household_ExportContent(This.mHousehold, resKeyTable, objIdTable, writer2))
                {
                    return(false);
                }
            }
            catch (StackOverflowException) { throw; }
            catch (ResetException)
            {
                throw;
            }
            catch { }

            writer.CommitChild();
            writer.WriteInt32(1758660904u, This.mInventories.Length);
            int[] array = new int[This.mInventories.Length];
            int   num   = 0;

            ulong[] array2 = This.mInventories;
            foreach (ulong num2 in array2)
            {
                uint        type   = (uint)((num2 != 0) ? (-1260555925) : 0);
                ResourceKey newKey = new ResourceKey(num2, type, 0u);
                array[num++] = resKeyTable.AddKey(newKey);
            }
            writer.WriteInt32(2746246615u, array);
            return(true);
        }
Beispiel #20
0
        // Cutdown version of function
        public static bool ImportContent(CareerManager ths, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            Occupation job = ImportJobContent(ths, 0x139b80d1, resKeyTable, objIdTable, reader);

            if (job != null)
            {
                ths.mJob = job;
            }

            uint num;

            reader.ReadUint32(0xb8e5462, out num, 0);
            for (uint i = 0; i < num; i++)
            {
                Occupation occupation = ImportJobContent(ths, 0x1f4ce7a9 + i, resKeyTable, objIdTable, reader);
                if (occupation != null)
                {
                    ths.QuitCareers[occupation.Guid] = occupation;
                }
            }

            School school = ImportJobContent(ths, 0xda42e1c9, resKeyTable, objIdTable, reader) as School;

            if (school != null)
            {
                ths.mSchool = school;
            }

            job = ImportJobContent(ths, 0x6b334d3d, resKeyTable, objIdTable, reader);
            if (job != null)
            {
                ths.mRetiredCareer = job;
            }

            return(true);
        }
Beispiel #21
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;
        }
Beispiel #22
0
        public bool ImportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            Inventory ths = mInventory;

            uint[] numArray;
            ths.DestroyItems();
            ths.Owner.InventoryComp.InventoryUIModel.ClearInvalidItemStacks();
            if (!reader.ReadUint32(0x804459ab, out numArray))
            {
                return false;
            }

            foreach (uint num in numArray)
            {
                IGameObject obj2 = GameObject.GetObject<IGameObject>(objIdTable[(int)num]);
                if (obj2 != null)
                {
                    IPropertyStreamReader child = reader.GetChild(num);
                    if (child != null)
                    {
                        bool flag = true;
                        try
                        {
                            Urnstone urnstone = obj2 as Urnstone;
                            if (urnstone != null)
                            {
                                flag = urnstone.ImportContent(resKeyTable, objIdTable, child, ths.Owner);
                            }
                            else if (obj2 is IPhoneCell)
                            {
                                if (ths.AmountIn<IPhoneCell>() == 0x1)
                                {
                                    flag = false;
                                }
                            }
                            else
                            {
                                flag = obj2.ImportContent(resKeyTable, objIdTable, child);
                            }
                        }
                        catch (Exception)
                        {
                            flag = false;
                        }
                        if (!flag)
                        {
                            obj2.Destroy();
                            continue;
                        }
                    }

                    // Custom
                    if (!Inventories.TryToMove(obj2, ths, false))
                    {
                        obj2.Destroy();
                    }
                }
            }
            reader.ReadInt32(0x86c4285, out ths.mMaxInventoryCapacity, 0x0);
            return true;
        }
Beispiel #23
0
 public bool ExportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
 {
     return mInventory.ExportContent(resKeyTable, objIdTable, writer);
 }
Beispiel #24
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);
        }
Beispiel #25
0
        public bool bd_ExportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
        {
            if (runI)
            {
                return(false);
            }
            try {
                writer.WriteUint64(1752637606u, SimDescriptionId);
                writer.WriteUint32(1758328370u, (uint)mSimFlags);
                writer.WriteFloat(3391843422u, AgingYearsSinceLastAgeTransition);
                writer.WriteInt32(183048852u, UserDaysInCurrentAge);
                writer.WriteInt32(2625491639u, resKeyTable.AddKey(mSkinToneKey));
                writer.WriteFloat(3647343526u, mSkinToneIndex);
                writer.WriteFloat(2843729478u, mSecondaryNormalMapWeights[0]);
                writer.WriteFloat(3384101496u, mSecondaryNormalMapWeights[1]);
                writer.WriteInt32(4180891374u, resKeyTable.AddKey(mDefaultOutfitKey));

                writer.WriteUint32(1343616996u, new uint[3]
                {
                    base.HairColors[0].Genetic.ARGB,
                    base.HairColors[0].Dye.ARGB,
                    base.HairColors[0].UseDye ? 1u : 0u
                });
                writer.WriteUint32(4135393849u, new uint[3]
                {
                    base.HairColors[1].Genetic.ARGB,
                    base.HairColors[1].Dye.ARGB,
                    base.HairColors[1].UseDye ? 1u : 0u
                });
                writer.WriteUint32(2471843458u, new uint[3]
                {
                    base.HairColors[2].Genetic.ARGB,
                    base.HairColors[2].Dye.ARGB,
                    base.HairColors[2].UseDye ? 1u : 0u
                });
                writer.WriteUint32(1055971375u, new uint[3]
                {
                    base.HairColors[3].Genetic.ARGB,
                    base.HairColors[3].Dye.ARGB,
                    base.HairColors[3].UseDye ? 1u : 0u
                });
                writer.WriteUint32(1836098543u, new uint[3]
                {
                    base.EyebrowColor.Genetic.ARGB,
                    base.EyebrowColor.Dye.ARGB,
                    base.EyebrowColor.UseDye ? 1u : 0u
                });
                writer.WriteUint32(1836098544u, new uint[3]
                {
                    base.BodyHairColor.Genetic.ARGB,
                    base.BodyHairColor.Dye.ARGB,
                    base.BodyHairColor.UseDye ? 1u : 0u
                });
                writer.WriteUint32(4209090540u, new uint[3]
                {
                    base.FacialHairColors[0].Genetic.ARGB,
                    base.FacialHairColors[0].Dye.ARGB,
                    base.FacialHairColors[0].UseDye ? 1u : 0u
                });
                writer.WriteUint32(2711019873u, new uint[3]
                {
                    base.FacialHairColors[1].Genetic.ARGB,
                    base.FacialHairColors[1].Dye.ARGB,
                    base.FacialHairColors[1].UseDye ? 1u : 0u
                });
                writer.WriteUint32(4258326570u, new uint[3]
                {
                    base.FacialHairColors[2].Genetic.ARGB,
                    base.FacialHairColors[2].Dye.ARGB,
                    base.FacialHairColors[2].UseDye ? 1u : 0u
                });
                writer.WriteUint32(3921444919u, new uint[3]
                {
                    base.FacialHairColors[3].Genetic.ARGB,
                    base.FacialHairColors[3].Dye.ARGB,
                    base.FacialHairColors[3].UseDye ? 1u : 0u
                });

                writer.WriteUint32(125685374u, base.BeardUsesHairColor ? 1u : 0u);
                writer.WriteUint32(3390394279u, base.EyebrowsUseHairColor ? 1u : 0u);
                writer.WriteUint32(3390394280u, base.BodyHairUsesHairColor ? 1u : 0u);
                writer.WriteUint32(992007321u, PropagateHairStyle ? 1u : 0u);

                if (mHousehold != null)
                {
                    writer.WriteUint64(2221750924u, mHousehold.HouseholdId);
                }

                string value  = mFirstName;
                string value2 = mLastName;
                string value3 = mBio;

                writer.WriteString(3947983776u, value);
                writer.WriteString(1883753236u, value2);
                writer.WriteUint32(1723164892u, (uint)mDeathStyle);
                writer.WriteBool(2257506273u, IsNeverSelectable);
                writer.WriteBool(797789854u, AgingEnabled);
                writer.WriteFloat(167162779u, mLifetimeHappiness);
                writer.WriteFloat(3632991774u, mSpendableHappiness);
                writer.WriteUint32(376622899u, (uint)mFavouriteMusicType);
                writer.WriteUint32(904967806u, (uint)mFavouriteFoodType);
                writer.WriteUint32(2418364207u, mFavouriteColor.ARGB);
                writer.WriteString(647611013u, value3);
                writer.WriteUint32(176483828u, (uint)mZodiacSign);
                writer.WriteUint32(183048650u, (uint)AlmaMater);
                writer.WriteString(183661639u, mAlmaMaterName);
                writer.WriteUint32(183048646u, (uint)GraduationType);
                writer.WriteUint32(3732926166u, (uint)ServiceHistory);
                writer.WriteBool(808457844u, Marryable);
                writer.WriteBool(2446075705u, CanBeKilledOnJob);
                writer.WriteBool(130688069u, IsGhost);
                writer.WriteBool(103218814u, Contactable);
                writer.WriteBool(452878294u, IsPregnant);
                writer.WriteBool(1660858165u, IsVisuallyPregnant);
                writer.WriteFloat(233156252u, base.AlienDNAPercentage);

                IPropertyStreamWriter writer2 = writer.CreateChild(2805376650u);

                mInitialShape.ExportContent(resKeyTable, objIdTable, writer2);

                writer.CommitChild();
                writer2 = null;
                writer2 = writer.CreateChild(2533203143u);

                mCurrentShape.ExportContent(resKeyTable, objIdTable, writer2);

                writer.CommitChild();
                writer2 = null;
                writer.WriteFloat(298511592u, mFitnessShapeDelta);
                writer.WriteFloat(4088477862u, mWeightShapeDelta);
                writer.WriteFloat(1817337409u, mShapeDeltaMultiplier);
                writer.WriteUint32(2011243416u, (uint)mVoiceVariation);
                writer.WriteFloat(1170154690u, mVoicePitchModifier);
                writer.WriteInt32(4008810486u, resKeyTable.AddKey(mGeneticHairstyleKey));

                for (uint num = 0u; num < 8; num++)
                {
                    writer.WriteInt32(193344880 + num, resKeyTable.AddKey(mGeneticBodyhairStyleKeys[num]));
                }

                writer.WriteInt32(2384582960u, (int)mHomeWorld);
                writer2 = writer.CreateChild(1481885306u);
                mOutfits.ExportContent(resKeyTable, objIdTable, writer2);
                writer.CommitChild();
                writer2 = null;
                writer2 = writer.CreateChild(3152150573u);
                ExportSpecialOutfitIndicies(writer);
                writer.CommitChild();
                writer2 = null;
                List <ulong> list = new List <ulong>();
                foreach (Trait item in base.TraitManager.List)
                {
                    list.Add((ulong)item.Guid);
                }
                if (list.Count > 0)
                {
                    writer.WriteUint32(1533688765u, (uint)list.Count);
                    writer.WriteUint64(1769582843u, list.ToArray());
                }
                ExportContentChild(resKeyTable, objIdTable, writer, 155067715u, base.TraitManager);
                ExportContentChild(resKeyTable, objIdTable, writer, 2057337028u, mGenealogy);
                writer.WriteUint32(2216711505u, LifetimeWish);
                writer.WriteBool(2264331350u, HasCompletedLifetimeWish);
                if (mSupernaturalData != null)
                {
                    writer.WriteUint32(226598758u, (uint)mSupernaturalData.OccultType);
                    mSupernaturalData.ExportContent(resKeyTable, objIdTable, writer);
                }
                ExportContentChild(resKeyTable, objIdTable, writer, 2368840039u, SkillManager);
                ExportContentChild(resKeyTable, objIdTable, writer, 3850691202u, CareerManager);
                ExportContentChild(resKeyTable, objIdTable, writer, 243549899u, VisaManager);
                ExportContentChild(resKeyTable, objIdTable, writer, 243549900u, CelebrityManager);
                ExportContentChild(resKeyTable, objIdTable, writer, 1916741826u, LifeEventManager);
                ExportContentChild(resKeyTable, objIdTable, writer, 146573769u, OccultManager);
                if (HealthManager != null)
                {
                    ExportContentChild(resKeyTable, objIdTable, writer, 222542822u, HealthManager);
                }
                if (mReputation != null)
                {
                    ExportContentChild(resKeyTable, objIdTable, writer, 146573776u, mReputation);
                }
                if (MidlifeCrisisManager != null)
                {
                    ExportContentChild(resKeyTable, objIdTable, writer, 181659961u, MidlifeCrisisManager);
                }
                if (PetManager != null)
                {
                    ExportContentChild(resKeyTable, objIdTable, writer, 4095203657u, PetManager);
                }
                writer.WriteInt32(2081779727u, ReadBookDataList.Count);
                uint num2 = 0u;
                foreach (KeyValuePair <string, ReadBookData> readBookData in ReadBookDataList)
                {
                    writer.WriteString(1155630664 + num2, readBookData.Key);
                    ExportContentChild(resKeyTable, objIdTable, writer, (uint)(-1873278614 + (int)num2), readBookData.Value);
                    num2++;
                }
                if (IsPregnant)
                {
                    ExportContentChild(resKeyTable, objIdTable, writer, 1064352938u, Pregnancy);
                }
                if (OpportunityHistory != null)
                {
                    ExportContentChild(resKeyTable, objIdTable, writer, 3825310104u, OpportunityHistory);
                }
                writer.WriteBool(148913893u, NeedsOpportunityImport);
                if (CreatedSim != null && CreatedSim.DreamsAndPromisesManager != null)
                {
                    DnPExportData = new DnPExportData(this);
                    ExportContentChild(resKeyTable, objIdTable, writer, 3039377755u, DnPExportData);
                }
                else
                {
                    DnPExportData = null;
                }
                if (RelicStats != null)
                {
                    ExportContentChild(resKeyTable, objIdTable, writer, 142971188u, RelicStats);
                }
                if (TombStats != null)
                {
                    ExportContentChild(resKeyTable, objIdTable, writer, 4233889236u, TombStats);
                }
                if (TravelBuffs != null)
                {
                    int count = TravelBuffs.Count;
                    IPropertyStreamWriter propertyStreamWriter = writer.CreateChild(143219793u);
                    propertyStreamWriter.WriteInt32(0u, count);
                    uint num3 = 1u;
                    foreach (BuffInstance travelBuff in TravelBuffs)
                    {
                        ExportContentChild(resKeyTable, objIdTable, propertyStreamWriter, num3++, travelBuff);
                    }
                    writer.CommitChild();
                }
                if (mPreferredVehicleGuid != ObjectGuid.InvalidObjectGuid)
                {
                    int value4 = objIdTable.AddId(mPreferredVehicleGuid);
                    writer.WriteInt32(3836047044u, value4);
                }
                if (Singing != null)
                {
                    ExportContentChild(resKeyTable, objIdTable, writer, 145650758u, Singing);
                }
                if (GameStates.IsTravelling)
                {
                    writer.WriteInt32(350667110u, CharismaStats.KnownSims);
                    writer.WriteInt32(2680064337u, CharismaStats.FriendSims);
                    writer.WriteInt32(2649604395u, CharismaStats.BestFriendSims);
                    writer.WriteInt32(1611073300u, CharismaStats.JokesSuccesfullyTold);
                    writer.WriteInt32(426808711u, CharismaStats.TraitsLearned);
                    writer.WriteBool(150904202u, HadFirstKiss);
                    writer.WriteBool(150904210u, HadFirstRomance);
                    writer.WriteBool(150904214u, HadFirstWooHoo);
                    writer.WriteBool(150904215u, HadBachelorParty);
                }
                writer.WriteByte(3475610776u, (byte)KnownSnowmanTypes);
                ExportSurgeryBlends(writer);
                if (CareerManager.DegreeManager != null)
                {
                    ExportContentChild(resKeyTable, objIdTable, writer, 240491398u, CareerManager.DegreeManager);
                }
                if (mTraitChipManager != null)
                {
                    ExportContentChild(resKeyTable, objIdTable, writer, 2471919987u, mTraitChipManager);
                }
            } catch { }
            return(true);
        }
Beispiel #26
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);
        }
Beispiel #27
0
 public override bool ImportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
 {
     return(false);
 }
Beispiel #28
0
        public bool ImportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            Inventory ths = mInventory;

            uint[] numArray;
            ths.DestroyItems();
            ths.Owner.InventoryComp.InventoryUIModel.ClearInvalidItemStacks();
            if (!reader.ReadUint32(0x804459ab, out numArray))
            {
                return(false);
            }

            foreach (uint num in numArray)
            {
                IGameObject obj2 = GameObject.GetObject <IGameObject>(objIdTable[(int)num]);
                if (obj2 != null)
                {
                    IPropertyStreamReader child = reader.GetChild(num);
                    if (child != null)
                    {
                        bool flag = true;
                        try
                        {
                            Urnstone urnstone = obj2 as Urnstone;
                            if (urnstone != null)
                            {
                                flag = urnstone.ImportContent(resKeyTable, objIdTable, child, ths.Owner);
                            }
                            else if (obj2 is IPhoneCell)
                            {
                                if (ths.AmountIn <IPhoneCell>() == 0x1)
                                {
                                    flag = false;
                                }
                            }
                            else
                            {
                                flag = obj2.ImportContent(resKeyTable, objIdTable, child);
                            }
                        }
                        catch (Exception)
                        {
                            flag = false;
                        }
                        if (!flag)
                        {
                            obj2.Destroy();
                            continue;
                        }
                    }

                    // Custom
                    if (!Inventories.TryToMove(obj2, ths, false))
                    {
                        obj2.Destroy();
                    }
                }
            }
            reader.ReadInt32(0x86c4285, out ths.mMaxInventoryCapacity, 0x0);
            return(true);
        }
Beispiel #29
0
 public bool ExportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
 {
     return(mInventory.ExportContent(resKeyTable, objIdTable, writer));
 }
Beispiel #30
0
        public static bool HMembers_ExportContent(Household.Members _this, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
        {
            if (_this == null)
            {
                throw new NullReferenceException();
            }
            // writer.WriteInt32(3921240069u, _this.Count);
            oerew = false;
            uint num = 0u;

            foreach (SimDescription allSimDescription in _this.AllSimDescriptionList)
            {
                if (string.IsNullOrEmpty(allSimDescription.mFirstName) && string.IsNullOrEmpty(allSimDescription.mLastName))
                {
                    continue;
                }
                if (!Nra.NFinalizeDeath.SD_OutfitsIsValid2(allSimDescription, true))
                {
                    continue;
                }

                var allCreatedSim = allSimDescription.CreatedSim;
                if (allCreatedSim != null)
                {
                    if (allCreatedSim.ObjectId.mValue == 0 ||
                        !Nra.NFinalizeDeath.GameObjectIsValid(allCreatedSim.ObjectId.mValue) ||
                        allCreatedSim.mSimDescription != allSimDescription)
                    {
                        allSimDescription.mSim = null;
                    }
                }


                try // fix
                {
                    bool needFix = false;
                    if (allSimDescription.mTraitManager == null)
                    {
                        allSimDescription.mTraitManager = new TraitManager();
                        allSimDescription.mTraitManager.mSimDescription = allSimDescription;
                        needFix = true;
                    }
                    if (allSimDescription.SkillManager == null)
                    {
                        allSimDescription.SkillManager = new Sims3.Gameplay.Skills.SkillManager(allSimDescription);
                        allSimDescription.SkillManager.mSimDescription = allSimDescription;
                        needFix = true;
                    }
                    if (allSimDescription.mGenealogy == null)
                    {
                        allSimDescription.mGenealogy      = new Genealogy(allSimDescription);
                        allSimDescription.mGenealogy.mSim = allSimDescription;
                        needFix = true;
                    }
                    if (allSimDescription.CareerManager == null)
                    {
                        allSimDescription.CareerManager = new Sims3.Gameplay.Careers.CareerManager(allSimDescription);
                        allSimDescription.CareerManager.mSimDescription = allSimDescription;
                        needFix = true;
                    }
                    if (allSimDescription.VisaManager == null)
                    {
                        allSimDescription.VisaManager = new Sims3.Gameplay.Visa.VisaManager(allSimDescription);
                        needFix = true;
                    }
                    else
                    {
                        allSimDescription.VisaManager.mSimDescription = allSimDescription;
                    }

                    if (allSimDescription.CelebrityManager == null)
                    {
                        allSimDescription.CelebrityManager = new Sims3.Gameplay.CelebritySystem.CelebrityManager(allSimDescription.SimDescriptionId);
                        needFix = true;
                    }

                    if (needFix)
                    {
                        allSimDescription.Fixup();
                    }

                    if (needFix && allSimDescription.CelebrityManager == null)
                    {
                        allSimDescription.Fixup();
                    }

                    if (allSimDescription.CelebrityManager == null)
                    {
                        if (Nra.NFinalizeDeath.IsOpenDGSInstalled)
                        {
                            break;
                        }
                        if (!oerew)
                        {
                            Nra.NFinalizeDeath.AssertX(false, "allSimDescription.CelebrityManager == null\nST:\n" + Nra.NDebugger.GetCurrentStackLite());
                            oerew = true;
                        }

                        if (!NiecMod.Nra.BimDesc.DoneECMK)
                        {
                            continue;
                        }
                    }
                }
                catch (Exception)
                {
                    //allSimDescription.Dispose();
                    //continue; check game crash
                }


                uint keyData = num++;
                IPropertyStreamWriter writerChild = writer.CreateChild(keyData);
                // custom  14:49 12/10/2019
                try
                {
                    if (allSimDescription.ExportContent(resKeyTable, objIdTable, writerChild))
                    {
                        writer.CommitChild();
                    }
                    else
                    {
                        writer.CancelChild(keyData);
                    }
                }
                catch (StackOverflowException) { throw; }
                catch (ResetException) { throw; }
                catch (Exception)
                {
                    writer.CancelChild(keyData);
                }
            }
            writer.WriteInt32(3921240069u, (int)num);
            return(true);
        }
Beispiel #31
0
        private static bool ImportRelationships(Household me, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            Common.StringBuilder msg = new Common.StringBuilder("ImportRelationships");

            try
            {
                uint num = 0x0;
                reader.ReadUint32(0x1265c8a0, out num, 0x0);

                msg += "A" + num;

                for (uint i = 0x0; i < num; i++)
                {
                    msg += "B";

                    ulong id;
                    ulong simDescriptionId;
                    IPropertyStreamReader child = reader.GetChild(i);
                    if (((child != null) && child.ReadUint64(0xc9c68605, out id, 0x0L)) && child.ReadUint64(0xbf0a71c2, out simDescriptionId, 0x0L))
                    {
                        msg += "C";

                        if (Household.sOldIdToNewSimDescriptionMap != null)
                        {
                            SimDescription description;
                            if (Household.sOldIdToNewSimDescriptionMap.TryGetValue(id, out description))
                            {
                                id = description.SimDescriptionId;
                            }

                            if (Household.sOldIdToNewSimDescriptionMap.TryGetValue(simDescriptionId, out description))
                            {
                                simDescriptionId = description.SimDescriptionId;
                            }
                        }

                        msg += "D";

                        SimDescription simDescriptionFromId = me.mMembers.GetSimDescriptionFromId(id);
                        SimDescription y = me.mMembers.GetSimDescriptionFromId(simDescriptionId);

                        msg += "E";

                        // Custom Try/Catch
                        try
                        {
                            Relationship relation = Relationship.Get(simDescriptionFromId, y, true);
                            if (relation != null)
                            {
                                relation.ImportContent(resKeyTable, objIdTable, child);
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(simDescriptionFromId, y, e);
                        }

                        msg += "F";
                    }
                }
            }
            catch(Exception e)
            {
                Common.DebugException(msg, e);
            }
            return true;
        }
Beispiel #32
0
        public static bool Household_ExportContent(Household _this, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
        {
            if (_this == null)
            {
                throw new NullReferenceException();
            }
            if (_this.mMembers == null)
            {
                return(false);
            }
            string name    = _this.mName;
            string bioText = _this.mBioText;

            //if (!DownloadContent.IsDevBuild())
            //{
            //    name = _this.Name;
            //    bioText = _this.BioText;
            //}
            writer.WriteString(1357107804u, name);
            writer.WriteInt32(867787827u, _this.mFamilyFunds);
            writer.WriteString(3647669240u, bioText);
            writer.WriteInt64(1669643236u, DateTime.Now.ToBinary());
            writer.WriteBool(571722353u, _this.mbLifetimeHappinessNotificationShown);
            writer.WriteInt32(145720536u, _this.mUnpaidBills);
            if (_this.LotHome != null)
            {
                writer.WriteInt32(3338514733u, _this.LotHome.Cost);
            }
            IPropertyStreamWriter writer2 = writer.CreateChild(2449095374u);

            HMembers_ExportContent(_this.mMembers, resKeyTable, objIdTable, writer2);
            writer.CommitChild();
            writer2 = writer.CreateChild(2706303414u);
            try
            {
                //_this.ExportRelationships(resKeyTable, objIdTable, writer2);
                Household_ExportRelationships(_this.mMembers, resKeyTable, objIdTable, writer2);
            }
            catch (StackOverflowException) { throw; }
            catch (ResetException)
            {
                throw;
            }
            catch { }

            writer.CommitChild();
            writer.WriteInt32(141731785u, _this.mAncientCoinCount);
            writer.WriteUint64(1193523264u, (ulong)_this.UniqueObjectsObtained);
            int count = _this.mKeystonePanelsUsed.Count;

            writer.WriteInt32(129814813u, count);
            uint num = 0u;

            foreach (WorldName key in _this.mKeystonePanelsUsed.Keys)
            {
                writer.WriteInt32(146578516 + num, (int)key);
                List <string> list = new List <string>(_this.mKeystonePanelsUsed[key]);
                writer.WriteString(163369191 + num, list.ToArray());
                num++;
            }
            ulong[] array = new ulong[_this.mCompletedHouseholdOpportunities.Count];
            _this.mCompletedHouseholdOpportunities.Keys.CopyTo(array, 0);
            writer.WriteUint64(149611345u, array);
            writer.WriteUint32(149611346u, _this.mMoneySaved);
            ulong[] array2 = new ulong[_this.mWardrobeCasParts.Count];
            _this.mWardrobeCasParts.CopyTo(array2, 0);
            writer.WriteUint64(153835052u, array2);
            writer.WriteUint64(156333552u, (ulong)_this.mServiceUniforms);
            return(true);
        }
Beispiel #33
0
        public static bool Household_ImportRelationships(Household _this, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            if (Relationship.sAllRelationships == null)
            {
                return(false);
            }

            uint ccount = 0;

            reader.ReadUint32(308660384u, out ccount, 0);

            if (ccount == 0)
            {
                return(true);
            }
            if (ccount < 0 || ccount == uint.MaxValue)
            {
                return(false);
            }

            for (uint i = 0; i < ccount; i++)
            {
                var child = reader.GetChild(i);

                ulong importID;
                ulong importID2;

                if (child == null || !child.ReadUint64(3385230853u, out importID, 0) || !child.ReadUint64(3205132738u, out importID2, 0))
                {
                    continue;
                }

                ulong simDescID  = importID;
                ulong simDescID2 = importID2;

                if (Household.sOldIdToNewSimDescriptionMap != null)
                {
                    SimDescription outSimDesc;
                    if (Household.sOldIdToNewSimDescriptionMap.TryGetValue(importID, out outSimDesc))
                    {
                        simDescID = outSimDesc.SimDescriptionId;
                    }
                    if (Household.sOldIdToNewSimDescriptionMap.TryGetValue(importID2, out outSimDesc))
                    {
                        simDescID2 = outSimDesc.SimDescriptionId;
                    }
                }

                var relationship = Relationship.Get(
                    _this.mMembers.GetSimDescriptionFromId(simDescID),
                    _this.mMembers.GetSimDescriptionFromId(simDescID2),
                    true
                    );

                if (relationship == null) // if SimDesc is invalid or SimDesc ID == 0. Should EA Bug
                {
                    continue;
                }

                relationship.ImportContent(resKeyTable, objIdTable, child);
            }
            return(true);
        }
Beispiel #34
0
        private static bool ImportRelationships(Household me, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            Common.StringBuilder msg = new Common.StringBuilder("ImportRelationships");

            try
            {
                uint num = 0x0;
                reader.ReadUint32(0x1265c8a0, out num, 0x0);

                msg += "A" + num;

                for (uint i = 0x0; i < num; i++)
                {
                    msg += "B";

                    ulong id;
                    ulong simDescriptionId;
                    IPropertyStreamReader child = reader.GetChild(i);
                    if (((child != null) && child.ReadUint64(0xc9c68605, out id, 0x0L)) && child.ReadUint64(0xbf0a71c2, out simDescriptionId, 0x0L))
                    {
                        msg += "C";

                        if (Household.sOldIdToNewSimDescriptionMap != null)
                        {
                            SimDescription description;
                            if (Household.sOldIdToNewSimDescriptionMap.TryGetValue(id, out description))
                            {
                                id = description.SimDescriptionId;
                            }

                            if (Household.sOldIdToNewSimDescriptionMap.TryGetValue(simDescriptionId, out description))
                            {
                                simDescriptionId = description.SimDescriptionId;
                            }
                        }

                        msg += "D";

                        SimDescription simDescriptionFromId = me.mMembers.GetSimDescriptionFromId(id);
                        SimDescription y = me.mMembers.GetSimDescriptionFromId(simDescriptionId);

                        msg += "E";

                        // Custom Try/Catch
                        try
                        {
                            Relationship relation = Relationship.Get(simDescriptionFromId, y, true);
                            if (relation != null)
                            {
                                relation.ImportContent(resKeyTable, objIdTable, child);
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(simDescriptionFromId, y, e);
                        }

                        msg += "F";
                    }
                }
            }
            catch (Exception e)
            {
                Common.DebugException(msg, e);
            }
            return(true);
        }
 public bool ImportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
 {
     throw new NotImplementedException();
 }
Beispiel #36
0
 public override bool ExportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
 {
     return(false);
 }
Beispiel #37
0
        public static bool HMembers_ImportContent(Household.Members _this, ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
        {
            if (_this == null)
            {
                throw new NullReferenceException();
            }

            _this.mAllSimDescriptions.Clear();
            _this.mPetSimDescriptions.Clear();
            _this.mSimDescriptions.Clear();

            try
            {
                Household.sRemapSimDescriptionIdsOnImport = !Household.IsTravelImport;

                int memberCount;

                if (!reader.ReadInt32(3921240069u, out memberCount, int.MaxValue) || memberCount == 0 || memberCount < 0 || memberCount == int.MaxValue) // loop
                {
                    return(false);
                }

                int checkloop = 0; // Fix Loop 12:48 20/05/2019

                for (uint i = 0; i < memberCount; i++)
                {
                    IPropertyStreamReader child = reader.GetChild(i);
                    if (child == null)
                    {
                        continue;
                    }
                    SimDescription simDescription = Nra.NFinalizeDeath.SimDesc_Empty(null); //new SimDescription();

                    try
                    {
                        if (simDescription.ImportContent(resKeyTable, objIdTable, child))
                        {
                            _this.Add(simDescription, simDescription.CreatedSim);
                        }
                        else
                        {
                            Nra.NFinalizeDeath.SimDescCleanse(simDescription, true, false);
                        }
                    }
                    catch (StackOverflowException) { throw; }
                    catch (ResetException) { throw; }
                    catch (Exception)
                    {
                        Nra.NFinalizeDeath.Household_Remove(simDescription, true);
                        Nra.NFinalizeDeath.SimDescCleanse(simDescription, true, false);
                        continue;
                    }

                    if (checkloop++ > 500)
                    {
                        break;
                    }
                }
            }
            finally
            {
                Household.sRemapSimDescriptionIdsOnImport = false;
            }
            return(true);
        }