Exemplo n.º 1
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);
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
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;
            }
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
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;
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
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);
            }
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
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;
        }
Exemplo n.º 13
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;
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
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;
        }
Exemplo n.º 17
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);
        }
Exemplo n.º 18
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);
        }