Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #5
0
        public static string GetHouseholdInfo(Household household, bool notile, string msg)
        {
            string logText = null;

            if (household != null)
            {
                if (msg == null)
                {
                    msg = "";
                }
                logText = "";

                if (!notile)
                {
                    logText += "Household Name: " + household.Name + NewLine;
                }

                logText += msg + " Id: " + household.HouseholdId + NewLine;
                try
                {
                    logText += msg + " Has Been Destroyed: " + household.HasBeenDestroyed + NewLine;

                    if (!string.IsNullOrEmpty(household.BioText))
                    {
                        logText += msg + " Bio: " + household.BioText + NewLine;
                    }

                    logText += msg + " Family Funds: " + EAText.GetMoneyString(household.mFamilyFunds) + NewLine;
                    logText += msg + " Delinquent Funds: " + EAText.GetMoneyString(household.mDelinquentFunds) + NewLine;
                    logText += msg + " Inited: " + household.mbInited + NewLine;
                    logText += msg + " Ancient Coin Count: " + EAText.GetMoneyString(household.mAncientCoinCount) + NewLine;
                    logText += msg + " UnPaid Bills: " + EAText.GetMoneyString(household.mUnpaidBills) + NewLine;
                    try
                    {
                        if (household.mMoneySaved != null)
                        {
                            long it = 0;
                            foreach (var item in household.mMoneySaved)
                            {
                                it += item;
                            }
                            logText += msg + " Money Saved: " + EAText.GetMoneyString(it) + ", Length: " + household.mMoneySaved.Length + NewLine;
                        }
                    }
                    catch (ResetException)
                    { throw; }
                    catch
                    { }
                }
                catch (ResetException)
                {
                    throw;
                }
                catch
                { }

                logText += msg + " -----------------------------------------------" + NewLine;
                try
                {
                    logText += msg + "  Active Household: " + (household == Household.ActiveHousehold || (PlumbBob.sSingleton != null && PlumbBob.sSingleton.mSelectedActor != null && household == PlumbBob.sSingleton.mSelectedActor.Household)) + NewLine;
                }
                catch (ResetException)
                {
                    throw;
                }
                catch
                {
                    logText += msg + "  Active Household: False" + NewLine;
                }

                logText += msg + "  Servobot Household: " + (household == Household.sServobotHousehold) + NewLine;
                logText += msg + "  Alien Household: " + (household == Household.sAlienHousehold) + NewLine;
                logText += msg + "  Mermaid Household: " + (household == Household.sMermaidHousehold) + NewLine;
                logText += msg + "  Previous Traveler Household: " + (household == Household.sPreviousTravelerHousehold) + NewLine;
                logText += msg + "  Service NPC Household: " + (household == Household.sNpcHousehold) + NewLine;
                logText += msg + "  Pet Household: " + (household == Household.sPetHousehold) + NewLine;
                logText += msg + "  Tourist Household: " + (household == Household.sTouristHousehold) + NewLine;
                logText += msg + " -----------------------------------------------" + NewLine;
                Household.Members me = household.mMembers;
                if (me != null)
                {
                    try
                    {
                        logText += msg + " Members: " + household.NumMembers + NewLine;
                    }
                    catch (ResetException)
                    {
                        throw;
                    }
                    catch
                    { }
                }
                if (me != null && me.mAllSimDescriptions != null)
                {
                    try
                    {
                        foreach (SimDescription sim2 in me.mAllSimDescriptions)
                        {
                            if (sim2 != null)
                            {
                                logText += msg + "  Member: (" + sim2.FullName + ", Id: " + sim2.mSimDescriptionId + ")" + NewLine;
                            }
                            else
                            {
                                logText += msg + "  Member: (NULL)" + NewLine;
                            }
                        }
                    }
                    catch (ResetException)
                    {
                        throw;
                    }
                    catch
                    { }
                }
                try
                {
                    if (household.VirtualLotHome != null)
                    {
                        logText += msg + " Virtual Home Lot: " + (string.IsNullOrEmpty(household.VirtualLotHome.Name) ? "No Name" : household.VirtualLotHome.Name) + NewLine;
                        logText += msg + " Virtual Home Lot Id: " + household.mVirtualLotId + NewLine;
                        logText += msg + " Virtual Home Address: " + (string.IsNullOrEmpty(household.VirtualLotHome.Address) ? "No Address" : household.VirtualLotHome.Address) + NewLine;
                    }
                    else
                    {
                        logText += msg + " No Virtual Lot Home" + NewLine;
                    }
                }
                catch (ResetException)
                {
                    throw;
                }
                catch
                { }
                try
                {
                    if (household.LotHome != null)
                    {
                        logText += msg + " Home Lot: " + (string.IsNullOrEmpty(household.LotHome.Name) ? "No Name" : household.LotHome.Name) + NewLine;
                        logText += msg + " Home Lot Id: " + household.mLotId + NewLine;
                        logText += msg + " Home Address: " + (string.IsNullOrEmpty(household.LotHome.Address) ? "No Address" : household.LotHome.Address);//+ NewLine;
                    }
                    else
                    {
                        logText += msg + " No Lot Home";
                    }
                }
                catch (ResetException)
                {
                    throw;
                }
                catch
                { }
            }
            return(logText);
        }
Пример #6
0
        public static string GetHouseholdInfo(Household household, bool notile, string msg)
        {
            string logText = null;

            if (household != null)
            {
                if (msg == null)
                {
                    msg = "";
                }
                logText = "";
                if (!notile)
                {
                    logText += "Household Name: " + household.Name + NewLine;
                }
                //else
                //    logText += msg + "Household: " + household.Name + NewLine;
                logText += msg + " Id: " + household.HouseholdId + NewLine;
                try
                {
                    logText += msg + " Has Been Destroyed: " + household.HasBeenDestroyed + NewLine;
                    logText += msg + " Bio: " + household.mBioText + NewLine;

                    logText += msg + " Family Funds: " + household.mFamilyFunds + NewLine;
                    logText += msg + " Delinquent Funds: " + household.mDelinquentFunds + NewLine;
                    logText += msg + " Inited: " + household.mbInited + NewLine;
                    logText += msg + " Ancient Coin Count: " + household.mAncientCoinCount + NewLine;
                    logText += msg + " UnPaid Bills: " + household.mUnpaidBills + NewLine;
                }
                catch
                { }

                //if (household == Household.ActiveHousehold || (PlumbBob.sSingleton != null && PlumbBob.sSingleton.mSelectedActor != null && household == PlumbBob.sSingleton.mSelectedActor.Household))
                //{
                //    logText += " Active Household:" + NewLine;
                //}

                /*
                 * if (household.IsServiceNpcHousehold || household.IsPetHousehold)
                 * {
                 *  logText += " Is Service NPC Household: " + (household == Household.sNpcHousehold) + NewLine;
                 * }
                 * if (household.IsTouristHousehold)
                 * {
                 *  logText += " Tourist" + NewLine;
                 * }*/

                try
                {
                    logText += msg + " Active Household: " + (household == Household.ActiveHousehold || (PlumbBob.sSingleton != null && PlumbBob.sSingleton.mSelectedActor != null && household == PlumbBob.sSingleton.mSelectedActor.Household)) + NewLine;
                }
                catch
                {
                    logText += msg + " Active Household: False" + NewLine;
                }
                logText += msg + " Servobot Household: " + (household == Household.sServobotHousehold) + NewLine;
                logText += msg + " Alien Household: " + (household == Household.sAlienHousehold) + NewLine;
                logText += msg + " Mermaid Household: " + (household == Household.sMermaidHousehold) + NewLine;
                logText += msg + " Previous Traveler Household: " + (household == Household.sPreviousTravelerHousehold) + NewLine;
                logText += msg + " Service NPC Household: " + (household == Household.sNpcHousehold) + NewLine;
                logText += msg + " Pet Household: " + (household == Household.sPetHousehold) + NewLine;
                logText += msg + " Tourist Household: " + (household == Household.sTouristHousehold) + NewLine;
                try
                {
                    logText += msg + " Members: " + household.NumMembers + NewLine;
                }
                catch
                { }
                Household.Members me = household.mMembers;
                if (me != null && me.mAllSimDescriptions != null)
                {
                    try
                    {
                        foreach (SimDescription sim2 in me.mAllSimDescriptions)
                        {
                            if (sim2 != null)
                            {
                                logText += msg + "  Member: " + sim2.FullName + ", Id: " + sim2.mSimDescriptionId + NewLine;
                            }
                        }
                    }
                    catch
                    { }
                }
                try
                {
                    if (household.VirtualLotHome != null)
                    {
                        logText += msg + " Virtual Home Lot: " + household.VirtualLotHome.Name + NewLine;
                        logText += msg + " Virtual Home Lot Id: " + household.mVirtualLotId + NewLine;
                        logText += msg + " Virtual Home Address: " + household.VirtualLotHome.Address + NewLine;
                    }
                    else
                    {
                        logText += msg + " No Virtual Lot Home" + NewLine;
                    }
                }
                catch
                { }
                if (household.LotHome != null)
                {
                    logText += msg + " Home Lot: " + household.LotHome.Name + NewLine;
                    logText += msg + " Home Lot Id: " + household.mLotId + NewLine;
                    logText += msg + " Home Address: " + household.LotHome.Address;//+ NewLine;
                }
                else
                {
                    logText += msg + " No Lot Home";// + NewLine;
                }
            }
            return(logText);
        }