Exemplo n.º 1
0
        //public static void Break()
        //{
        //    Break(TypeBreak.GameScriptFreeze, true);
        //}
        //public static void Break(TypeBreak type)
        //{
        //    Break(type, false);
        //}

        public static void Break(TypeBreak type = TypeBreak.GameScriptFreeze, bool force = true)
        {
            if (!IsAttached && !force)
            {
                return;
            }

            niec_native_func.OutputDebugString("Script Debugger Break!");
            NiecException.NewSendTextExceptionToDebugger();

            switch (type)
            {
            case TypeBreak.MessageBox:
                niec_native_func.MessageBox(0, "NDBreak ST:\n" + GetCurrentStackLite(), "NiecMod", 0);
                break;

            case TypeBreak.GameScriptFreeze:
                try
                {
                    while (true)
                    {
                        // Do nothing
                    }
                }
                catch (Exception)
                { return; }

            case TypeBreak.NativeBreak:
                niec_native_func.DebuggerBreak();
                break;

            default:
                throw new NotSupportedException();
            }
        }
Exemplo n.º 2
0
        public NewBimDesc(SimOutfit defaultOutfit)
        {
            if (dontCall)
            {
                return;
            }

            var _this = (SimDescription)(object)this;

            Create.AddNiecSimDescription(_this);
            NiecException.NewSendTextExceptionToDebugger();

            _this.mSkinToneKey = default(ResourceKey);
            _this.mSecondaryNormalMapWeights = new float[2];
            _this.mFlags                           = SimDescription.FlagField.Marryable | SimDescription.FlagField.CanBeKilledOnJob | SimDescription.FlagField.ShowSocialsOnSim | SimDescription.FlagField.Contactable | SimDescription.FlagField.CanStartFires | SimDescription.FlagField.WasCasCreated;
            _this.mAlmaMaterName                   = string.Empty;
            _this.UserDaysInCurrentAge             = int.MaxValue;
            _this.CharismaStats                    = default(SimDescription.Charisma);
            _this.mShapeDeltaMultiplier            = 1f;
            _this.mPreferredVehicleGuid            = ObjectGuid.InvalidObjectGuid;
            _this.mPreferredBoatGuid               = ObjectGuid.InvalidObjectGuid;
            _this.LastMakeoverReceivedUserDirected = SimClock.CurrentTime() - new DateAndTime(4, DaysOfTheWeek.Sunday, 0, 0, 0);
            _this.mStoredSlot                      = PASSPORTSLOT.PASSPORTSLOT_NUM;
            _this.mReturnSimAlarm                  = AlarmHandle.kInvalidHandle;

            if (defaultOutfit != null && defaultOutfit.IsValid)
            {
                _this.mIsValidDescription = true;
                _this.Init(defaultOutfit);
                _this.InitHairColors(defaultOutfit);
            }
        }
Exemplo n.º 3
0
        static NWorldFerry()
        {
            FieldInfo[] list;
            try
            {
                list = FindPersistableStatics();
            }
            catch (Exception ex)
            {
                niec_native_func.OutputDebugString("NM: FindPersistableStatics() failed.");
                NiecException.SendTextExceptionToDebugger(ex);
                _mCargo = new Dictionary <FieldInfo, object>();
                return;
            }

            if (list == null || list.Length == 0)
            {
                niec_native_func.OutputDebugString(string.Format("NM: There are no PersistableStatic fields declared in {0}.", typeof(T)));
                _mCargo = new Dictionary <FieldInfo, object>();
                return;
            }

            _mCargo = new Dictionary <FieldInfo, object>(list.Length);

            foreach (FieldInfo field in list)
            {
                if (field == null)
                {
                    //niec_native_func.OutputDebugString("NWorldFerry(): field == null. Should mono bug");
                    continue;
                }
                _mCargo[field] = null;
            }
        }
Exemplo n.º 4
0
        public NewBimDesc(SimDescriptionCore sdCore)
        {
            if (dontCall)
            {
                return;
            }

            var _this = (SimDescription)(object)this;

            if (!NStackTrace.IsCallingMyMethedLite("CreateSimHead", true, 3))
            {
                Create.AddNiecSimDescription(_this);
                NiecException.NewSendTextExceptionToDebugger();
            }

            _this.mSkinToneKey = default(ResourceKey);
            _this.mSecondaryNormalMapWeights = new float[2];
            _this.mFlags                           = SimDescription.FlagField.Marryable | SimDescription.FlagField.CanBeKilledOnJob | SimDescription.FlagField.ShowSocialsOnSim | SimDescription.FlagField.Contactable | SimDescription.FlagField.CanStartFires | SimDescription.FlagField.WasCasCreated;
            _this.mAlmaMaterName                   = string.Empty;
            _this.UserDaysInCurrentAge             = int.MaxValue;
            _this.CharismaStats                    = default(SimDescription.Charisma);
            _this.mShapeDeltaMultiplier            = 1f;
            _this.mPreferredVehicleGuid            = ObjectGuid.InvalidObjectGuid;
            _this.mPreferredBoatGuid               = ObjectGuid.InvalidObjectGuid;
            _this.LastMakeoverReceivedUserDirected = SimClock.CurrentTime() - new DateAndTime(4, DaysOfTheWeek.Sunday, 0, 0, 0);
            _this.mStoredSlot                      = PASSPORTSLOT.PASSPORTSLOT_NUM;
            _this.mReturnSimAlarm                  = AlarmHandle.kInvalidHandle;

            _this.mIsValidDescription = true;

            if (SimDescription.sLoadedSimDescriptions != null)
            {
                SimDescription.sLoadedSimDescriptions.Add(_this);
            }
            try
            {
                _this.TraitManager = new TraitManager(sdCore.TraitManager);
                _this.TraitManager.SetSimDescription(_this);
                _this.CopyAllOutfits(sdCore);
                _this.CopyCoreFileds(sdCore);
                SimOutfit outfit = sdCore.GetOutfit(OutfitCategories.Everyday, 0);
                _this.Init(outfit);
                _this.CopyPetFields(sdCore);
            }
            catch (Exception)
            { }
        }
Exemplo n.º 5
0
        public static void CheckChangeInActiveHousehold(Household newHousehold, bool bForce)
        {
            if (newHousehold == null)
            {
                return;
            }

            if (sCurrentNonNullHousehold == null)
            {
                sCurrentNonNullHousehold          = PlumbBob.sCurrentNonNullHousehold;
                PlumbBob.sCurrentNonNullHousehold = null;
            }

            try
            {
                if (sCurrentNonNullHousehold != newHousehold || bForce)
                {
                    Lot lot = null;
                    if (sCurrentNonNullHousehold != null)
                    {
                        lot = sCurrentNonNullHousehold.LotHome;
                    }
                    if (sCurrentNonNullHousehold != null && sCurrentNonNullHousehold != newHousehold)
                    {
                        Situation.OnActiveHouseholdChanged(sCurrentNonNullHousehold, newHousehold);

                        if (!NiecHelperSituation.__acorewIsnstalled__)
                        {
                            Party.CancelAllHouseParties(sCurrentNonNullHousehold.LotHome);
                        }

                        //sCurrentNonNullHousehold.ResetSocialWorkerTrigger();

                        foreach (Sim allActor in sCurrentNonNullHousehold.AllActors)
                        {
                            try
                            {
                                allActor.OnBecameUnselectable();
                            }
                            catch (Exception)
                            { if (!NiecHelperSituation.__acorewIsnstalled__)
                              {
                                  throw;
                              }
                            }
                        }
                        if (lot != null)
                        {
                            lot.OnBecameUnselected();
                        }
                        sCurrentNonNullHousehold.ResetParentVacationsTrigger();
                    }
                    if (newHousehold != null)
                    {
                        foreach (Sim actor in newHousehold.AllActors)
                        {
                            if (!Household.RoommateManager.IsNPCRoommate(actor))
                            {
                                try
                                {
                                    actor.OnBecameSelectable();
                                }
                                catch (Exception)
                                { if (!NiecHelperSituation.__acorewIsnstalled__)
                                  {
                                      throw;
                                  }
                                }
                            }
                        }
                        if (sCurrentNonNullHousehold != newHousehold)
                        {
                            if (lot != null)
                            {
                                //lot.TryTurnOffHolidayHouseLights();
                            }
                            newHousehold.GiveIngredients();
                        }
                        if (newHousehold.LotHome != null)
                        {
                            newHousehold.LotHome.OnBecameSelected();
                        }

                        Lot.UpdatePlayerNeighbors();

                        TombRoomManager.OnChangeHousehold(newHousehold);

                        try
                        {
                            if (sCurrentNonNullHousehold != newHousehold)
                            {
                                newHousehold.SetParentFreeVacationTrigger(false, false);
                            }
                        }
                        catch (Exception)
                        { if (!NiecHelperSituation.__acorewIsnstalled__)
                          {
                              throw;
                          }
                        }
                    }
                    EventTracker.SendEvent(new HouseholdUpdateEvent(EventTypeId.kHouseholdSelected, newHousehold));
                }
                sCurrentNonNullHousehold          = newHousehold;
                PlumbBob.sCurrentNonNullHousehold = newHousehold;
            }
            catch (Exception ex)
            {
                niec_native_func.OutputDebugString("CheckChangeInActiveHousehold(Household newHousehold, bool bForce) failed.");
                NiecException.SendTextExceptionToDebugger(ex);
            }
        }
Exemplo n.º 6
0
        public static bool SetActiveActor(Sim actor, bool force)
        {
            if (NiecHelperSituation.__acorewIsnstalled__)
            {
                if (!Instantiator.kDontCallDGSACore && NFinalizeDeath.RUNIACORE != null)
                {
                    NFinalizeDeath.RUNIACORE(false);
                }
                else
                {
                    NFinalizeDeath.CheckNHSP();
                }
            }

            if (ShouldCheckTwoPlayer())
            {
                return(false);
            }

            if (!force && actor != null && !actor.IsSelectable)
            {
                return(false);
            }

            if (NiecHelperSituation.__acorewIsnstalled__)
            {
                if (!Sims3.Gameplay.GameStates.IsGameShuttingDown && !force && actor == null)
                {
                    return(false);
                }
            }

            try
            {
                throw new Exception("DEBUG SetActiveActor(Sim actor, bool force): " + (Type.GetType("Sims3.Gameplay.Core.PlumbBob") != null));
            }
            catch (Exception ex)
            {
                NiecException.SendTextExceptionToDebugger(ex);
            }

            try
            {
                Sim sim = sCurrentSim;
                if (sim != null && sim.Inventory != null)
                {
                    sim.Inventory.MuteMP3();
                }

                if (actor != null && actor.Inventory != null)
                {
                    actor.Inventory.UnmuteMP3();
                }

                if (actor != null)
                {
                    if (actor.Household != Household.ActiveHousehold)
                    {
                        actor.Household.MarkSimsAsProtected();
                    }

                    PlumbBob splumbBob = PlumbBob.sSingleton;
                    if (splumbBob != null)
                    {
                        if (NFinalizeDeath.World_IsEditInGameFromWBModeImpl())
                        {
                            splumbBob.mSelectedActor = null;
                        }
                        else
                        {
                            splumbBob.mSelectedActor = actor;
                        }
                    }

                    sCurrentSim = actor;

                    bool okParentTo = false;
                    if (actor.InWorld)
                    {
                        try
                        {
                            okParentTo = splumbBob != null && PlumbBob.ParentTo(actor);
                        }
                        catch (Exception)
                        { }

                        if (sim != actor)
                        {
                            if (actor.BuffManager != null)
                            {
                                BuffMummysCurse.BuffInstanceMummysCurse buffInstanceMummysCurse = actor.BuffManager.GetElement(BuffNames.MummysCurse) as BuffMummysCurse.BuffInstanceMummysCurse;
                                if (buffInstanceMummysCurse != null)
                                {
                                    BuffMummysCurse.SetCursedScreenFX(buffInstanceMummysCurse.CurseStage, false);
                                }
                                else
                                {
                                    BuffMummysCurse.SetCursedScreenFX(0, false);
                                }
                            }

                            if (actor.Household != null)
                            {
                                foreach (Sim itemSim in actor.Household.Sims)
                                {
                                    if (itemSim == null)
                                    {
                                        continue;
                                    }

                                    Conversation conversation = itemSim.Conversation;
                                    if (conversation != null)
                                    {
                                        foreach (Sim member in conversation.Members)
                                        {
                                            if (member == null)
                                            {
                                                continue;
                                            }

                                            if (member != actor && member.ProgressMeter is CelebrityImpressProgressMeter)
                                            {
                                                ProgressMeter.HideProgressMeter(member, false);
                                            }
                                        }
                                    }
                                }
                            }

                            if (actor.InteractionQueue != null)
                            {
                                InteractionInstance currentInteraction = NiecHelperSituation.__acorewIsnstalled__ ? NFinalizeDeath._GetCurrentInteraction(actor) : actor.InteractionQueue.GetCurrentInteraction();
                                if (currentInteraction is ICelebrityImpressInteraction)
                                {
                                    CelebrityManager.ShowImpressProgressMeterIfNecessary(actor, currentInteraction.Target as Sim);
                                }
                            }
                        }
                    }

                    if (splumbBob != null)
                    {
                        try
                        {
                            if (okParentTo)
                            {
                                World.AddObjectToScene(splumbBob.ObjectId);
                                PlumbBob.ShowPlumbBob();
                            }
                            else
                            {
                                PlumbBob.HidePlumbBob();
                            }
                        }
                        catch (Exception)
                        { }
                    }

                    World.SetWallCutawayFocusPos(actor.Position);
                    PlumbBob.CheckForChangeInActiveHousehold(actor.Household, force);
                    PieMenu.ClearInteractions();

                    EventTracker.SendEvent(EventTypeId.kEventSimSelected, actor, sim);
                }
                else
                {
                    PlumbBob splumbBob = PlumbBob.sSingleton;
                    if (splumbBob != null)
                    {
                        splumbBob.mSelectedActor = null;
                    }

                    sCurrentSim = null;

                    if (splumbBob != null)
                    {
                        try
                        {
                            PlumbBob.HidePlumbBob();
                        }
                        catch (Exception)
                        { }


                        Slots.DetachFromSlot(splumbBob.ObjectId);

                        if (splumbBob.LotCurrent != null)
                        {
                            splumbBob.LotCurrent.RemoveObjectFromLot(splumbBob.ObjectId, false);
                        }
                    }

                    PlumbBob.CheckForChangeInActiveHousehold(null, force);

                    PieMenu.ClearInteractions();

                    EventTracker.SendEvent(EventTypeId.kEventSimSelected, null, sim);
                }

                if (sim != actor && actor != null && actor.MoodManager != null)
                {
                    actor.MoodManager.UpdatePlumbbobColor();
                }
            }
            catch (Exception ex) // Should EA debug?
            {
                niec_native_func.OutputDebugString("SetActiveActor(Sim actor, bool force) failed.");
                if (actor != null)
                {
                    var simDescription = actor.SimDescription;
                    if (simDescription != null)
                    {
                        niec_native_func.OutputDebugString("Sim Name: " + simDescription.FullName);
                        niec_native_func.OutputDebugString("Sim ID: " + simDescription.SimDescriptionId.ToString("X"));
                    }
                }
                NiecException.SendTextExceptionToDebugger(ex);
                return(false);
            }
            return(true);
        }
Exemplo n.º 7
0
        /*
         * DebugString: "_NFixUp(): if (ListCollon.NullSimSimDescription == this)"
         * DebugString: "NMScript Exception Log
         * System.Exception: no message
         *
         #0: 0x0001f throw      in Sims3.Gameplay.CAS.Sims3.Gameplay.CAS.SimDescription:Fixup () ()
         #1: 0x00050 callvirt   in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.RecoverMissingSims:PrivatePerformAction (bool) (9193E9C0 [0] )
         #2: 0x00011 callvirt   in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.AlarmOption:PerformAction (bool) (9193E9C0 [0] )
         #3: 0x00002 call       in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.AlarmOption:PerformAlarm () ()
         #4: 0x0001b callvirt   in NRaas.NRaas.Overwatch:OnTimer () ()
         #5: 0x00000            in Sims3.Gameplay.Sims3.Gameplay.Function:Invoke () ()
         #6: 0x00003 callvirt   in NRaas.Common+FunctionTask:Simulate () ()
         */
        public void _NFixUp()
        {
            if (runI)
            {
                return;
            }

            if (ListCollon.NullSimSimDescription == this)
            {
                if (niec_native_func.cache_done_niecmod_native_debug_text_to_debugger)
                {
                    niec_native_func.OutputDebugString("_NFixUp(): if (ListCollon.NullSimSimDescription == this)");
                    try
                    {
                        throw new Exception("no message");
                    }
                    catch (Exception ex)
                    {
                        NiecException.SendTextExceptionToDebugger(ex);
                    }
                }

                mIsValidDescription = false;
                NFinalizeDeath.SimDesc_NullToEmpty(this);
                mIsValidDescription = true;

                if (UnsafeFixNUllSimDESC)
                {
                    var p = NFinalizeDeath.GetSafeSelectActor();
                    if (p != null && p.SimDescription != null)
                    {
                        mOutfits = p.SimDescription.Outfits;
                    }
                    if (!waitrunningtask01)
                    {
                        waitrunningtask01 = true;
                        NiecTask.Perform(() =>
                        {
                            for (int i = 0; i < 800; i++)
                            {
                                Simulator.Sleep(0);
                            }
                            waitrunningtask01 = false;
                            NFinalizeDeath.SimDescCleanse(this, true, false);
                        });
                    }
                }
                else if (!waitrunningtask01)
                {
                    waitrunningtask01 = true;
                    NiecTask.Perform(() =>
                    {
                        for (int i = 0; i < 50; i++)
                        {
                            Simulator.Sleep(0);
                        }
                        waitrunningtask01 = false;
                        NFinalizeDeath.SimDescCleanse(this, true, true);
                    });
                }
                return;
            }

            mIsValidDescription = true;

            if (base.TraitManager != null)
            {
                base.TraitManager.SetSimDescription(this);
                base.TraitManager.Fixup();
            }

            if (CreatedSim != null && CreatedSim.Inventory != null)
            {
                foreach (TraitChip item in CreatedSim.Inventory.FindAll <TraitChip>(false))
                {
                    item.OnLoadFixup();
                    if (item.Owner == null)
                    {
                        item.SetOwner(this);
                    }
                }
            }

            MiniSimDescription miniSimDescription = MiniSimDescription.Find(SimDescriptionId);

            if ((GameStates.IsTravelling || GameStates.IsEditingOtherTown) && miniSimDescription != null)
            {
                base.CASGenealogy = miniSimDescription.Genealogy;
            }

            if (GameObjectRelationships != null)
            {
                int i = 0;
                while (i < GameObjectRelationships.Count)
                {
                    if (!Sims3.SimIFace.Objects.IsValid(GameObjectRelationships[i].GameObjectDescription.GameObject.ObjectId))
                    {
                        GameObjectRelationships.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }
            }

            if (mGenealogy == null)
            {
                mGenealogy = new Genealogy(this);
            }

            if (SkillManager == null)
            {
                SkillManager = new SkillManager(this);
            }
            else
            {
                SkillManager.OnLoadFixup();
            }

            if (CareerManager == null)
            {
                CareerManager = new CareerManager(this);
            }
            else
            {
                CareerManager.OnLoadFixup();
            }

            if (VisaManager == null)
            {
                VisaManager = new VisaManager(this);
            }
            else
            {
                VisaManager.OnLoadFixup();
            }

            if (CelebrityManager == null)
            {
                CelebrityManager = new CelebrityManager(SimDescriptionId);
            }
            else if (CelebrityManager.Owner == null)
            {
                CelebrityManager.ResetOwnerSimDescription(SimDescriptionId);
            }

            if (LifeEventManager == null || !LifeEventManager.IsValid)
            {
                LifeEventManager = new LifeEventManager(this);
            }

            LifeEventManager.ClearInvalidActiveNodes();

            if (OccultManager == null)
            {
                OccultManager = new OccultManager(this);
            }
            else
            {
                OccultManager.OnLoadFixup();
            }

            if (IsPet)
            {
                if (PetManager == null)
                {
                    PetManager = CreatePetManager();
                }
            }
            else if (PetManager != null)
            {
                PetManager.Dispose();
                PetManager = null;
            }

            if (IsEP11Bot)
            {
                if (TraitChipManager == null)
                {
                    TraitChipManager = new TraitChipManager(this);
                }
                else if (TraitChipManager.Owner == null)
                {
                    TraitChipManager.ResetOwnerSimDescription(SimDescriptionId);
                }
                TraitChipManager.OnLoadFixup();
            }
            else if (TraitChipManager != null)
            {
                TraitChipManager.Dispose();
                TraitChipManager = null;
            }

            AssignSchool();

            if (mSimDescriptionId == 0)
            {
                MakeUniqueId();
            }

            if (ReadBookDataList == null)
            {
                ReadBookDataList = new Dictionary <string, ReadBookData>();
            }

            PushAgingEnabledToAgingManager();

            if (mInitialShape.Owner == null || mCurrentShape.Owner == null || mInitialShape.Owner != this || mCurrentShape.Owner != this)
            {
                mInitialShape.Owner = (mCurrentShape.Owner = this);
            }

            if (OpportunityHistory == null)
            {
                OpportunityHistory = new OpportunityHistory();
            }

            if (Sims3.Gameplay.Gameflow.sGameLoadedFromWorldFile && !Household.IsTravelImport && !GameStates.IsIdTravelling(SimDescriptionId))
            {
                mDisplayedShape.Owner    = mCurrentShape.Owner;
                mDisplayedShape.Fit      = mCurrentShape.Fit;
                mDisplayedShape.Weight   = mCurrentShape.Weight;
                mDisplayedShape.Pregnant = mCurrentShape.Pregnant;
                ResetLifetimeHappinessStatistics();
                mHomeWorld = GameUtils.GetCurrentWorld();
            }

            if (mHomeWorld == WorldName.Undefined)
            {
                mHomeWorld = GameUtils.GetCurrentWorld();
            }

            if (RelicStats == null)
            {
                RelicStats = new RelicStatTracking(this);
            }

            RelicStats.SetSimDescription(this);

            if (TombStats == null)
            {
                TombStats = new TombStatTracking(this);
            }

            TombStats.SetSimDescription(this);

            if (Singing == null)
            {
                Singing = new SingingInfo(this);
            }

            Singing.SetSimDesctiption(this);

            if (AssignedRole != null)
            {
                AssignedRole.OnLoadFixUp();
            }

            Lot lot = LotManager.GetLot(mVirtualLotId);

            if (lot != null)
            {
                lot.VirtualMoveIn(this);
            }

            if (Species == CASAgeGenderFlags.None)
            {
                Species = CASAgeGenderFlags.Human;
            }

            if (!CASLogic.GetSingleton().IsMusicTypeInstalled(FavoriteMusic))
            {
                RandomizeFavoriteMusic();
            }

            if (GetCurrentOutfits() != null)
            {
                OutfitCategories[] array = new OutfitCategories[5]
                {
                    OutfitCategories.None,
                    OutfitCategories.All,
                    OutfitCategories.CategoryMask,
                    OutfitCategories.PrimaryCategories,
                    OutfitCategories.PrimaryHorseCategories
                };

                foreach (var outfitCategories in array)
                {
                    if (GetOutfitCount(outfitCategories) > 0)
                    {
                        RemoveOutfits(outfitCategories, false);
                        if (base.mMaternityOutfits != null)
                        {
                            base.mMaternityOutfits.Remove(outfitCategories);
                        }
                        if (base.mOutfits != null)
                        {
                            base.mOutfits.Remove(outfitCategories);
                        }
                    }
                }
            }

            if (!GameUtils.IsInstalled(ProductVersion.EP4))
            {
                Sim.PlayPretend.RemoveAllChildCostumeOutfits(this);

                if (CreatedSim != null && CreatedSim.CurrentOutfitCategory == OutfitCategories.ChildImagination)
                {
                    CreatedSim.SwitchToOutfitWithoutSpin(OutfitCategories.Everyday);
                }

                RemoveOutfits(OutfitCategories.ChildImagination, true);

                base.Outfits.Remove(OutfitCategories.ChildImagination);

                if (SpoiledGiftHistory != null)
                {
                    SpoiledGiftHistory.Clear();
                    SpoiledGiftHistory = null;
                }
            }

            if (CreatedSim != null && (OccultManager == null || !OccultManager.HasOccultType(OccultTypes.Vampire | OccultTypes.Genie | OccultTypes.Werewolf | OccultTypes.Ghost)) && mSkinToneKey.InstanceId == 15475186560318337848uL)
            {
                World.ObjectSetVisualOverride(CreatedSim.ObjectId, eVisualOverrideTypes.Genie, null);
            }
        }
Exemplo n.º 8
0
 public static bool sAcceptCancelDialogWithoutCommonException(string message)
 {
     try
     {
         throw new NiecModException("AcceptCancelDialogWithoutCommonException: Not Error");
     }
     catch (ResetException)
     {
         throw;
     }
     catch (NiecModException ex)
     {
         WriteLog("AcceptCancelDialogWithoutCommonException: " + NiecException.NewLine + NiecException.LogException(ex), true, true, false);
     }
     if (Simulator.CheckYieldingContext(false))
     {
         NiecMod.Nra.SpeedTrap.Sleep();
     }
     return(AcceptCancelDialog.Show(message));
     //StyledNotification.Show(new StyledNotification.Format(message, StyledNotification.NotificationStyle.kGameMessagePositive));
 }
Exemplo n.º 9
0
        void StartUpSafeErrorTrapAdded()
        {
            if (NSC_ETRAP.IsDone)
            {
                return;
            }

            if (AssemblyCheckByNiec.IsInstalled("NRaasErrorTrap") || ShouldACoreScipt2020())
            {
                NiecTask.Perform(delegate
                {
                    if (!NFinalizeDeath.GameIs64Bit(true) && ShouldACoreScipt2020() && !NiecHelperSituation.isdgmods)
                    {
                        if (!NFinalizeDeath.DoneSafePreventGetAssembliesPro && NFinalizeDeath.func_address_GetAssemblies != 0)
                        {
                            NFinalizeDeath.RemovePreventGetAssemblies();
                        }

                        Type.GetType("NRaas.Common, NRaasErrorTrap").GetMethod("OnPreLoad", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Invoke(null, new object[0]);

                        var p = Type.GetType("NRaas.ErrorTrap, NRaasErrorTrap");
                        if (p == null)
                        {
                            NFinalizeDeath.Assert("Type.GetType(\"NRaas.ErrorTrap, NRaasErrorTrap\"); == null");
                            goto faled;
                        }
                        else
                        {
                            var m = p.GetMethod("OnScriptError", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                            if (m != null)
                            {
                                var myM = typeof(SCOSR).GetMethod("OnScriptError", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

                                dontcall = true;
                                OnScriptError(null, null);
                                dontcall = false;

                                // Required if no create method pointer.
                                Delegate.CreateDelegate(typeof(SCOSR._SafeScriptError), m);

                                if (!niec_script_func.niecmod_script_copy_ptr_func_to_func(myM, m, false, false, true, false))
                                {
                                    goto faled;
                                }
                            }
                            else
                            {
                                goto faled;
                            }
                        }
                        _SafeOnScriptError = null;
                        DoneSafeErrorTrap  = true;
                        ShouldInjectedMethodOnScriptError = true;
                        if (NiecHelperSituation.___bOpenDGSIsInstalled_)
                        {
                            SetBoolScriptCore2020(false, false, false);
                        }
                        else
                        {
                            SetBoolScriptCore2020(AssemblyCheckByNiec.IsInstalled("AweCore"), true, true);
                        }
                        return;
                    }
                    faled:
                    for (int i = 0; i < 100; i++)
                    {
                        Simulator.Sleep(0);
                    }
                    if (!DoneSafeErrorTrap && AssemblyCheckByNiec.IsInstalled("NRaasErrorTrap"))
                    {
                        Type.GetType("NRaas.Common, NRaasErrorTrap").GetMethod("OnPreLoad", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Invoke(null, new object[0]);
                    }
                    if (AssemblyCheckByNiec.IsInstalled("NRaasErrorTrap"))
                    {
                        Type type = Type.GetType("ScriptCore.ExceptionTrap, ScriptCore", true);
                        if (type != null)
                        {
                            FieldInfo mField = type.GetField("OnScriptError", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                            if (mField != null)
                            {
                                MethodInfo mf = (mField.GetValue(null) as MulticastDelegate).method_info;
                                if (mf != null)
                                {
                                    NFinalizeDeath.sIs_m_OnScriptError = typeof(SCOSR).GetMethod("OnScriptError");
                                    if (mf == typeof(SCOSR).GetMethod("OnScriptError") || mf.DeclaringType == typeof(SCOSR))
                                    {
                                        DoneSafeErrorTrap = true;
                                    }
                                    else
                                    {
                                        SCOSR._SafeOnScriptError = (SCOSR._SafeScriptError)Delegate.CreateDelegate(typeof(SCOSR._SafeScriptError), mf);
                                        type = Type.GetType("ScriptCore.ExceptionTrap+ScriptError, ScriptCore", true);
                                        if (type != null)
                                        {
                                            mf = typeof(SCOSR).GetMethod("OnScriptError");
                                            if (mf != null)
                                            {
                                                mField.SetValue(null, Delegate.CreateDelegate(type, mf));
                                                DoneSafeErrorTrap = true;
                                                if (NiecHelperSituation.___bOpenDGSIsInstalled_)
                                                {
                                                    SetBoolScriptCore2020(false, false, false);
                                                }
                                                else
                                                {
                                                    SetBoolScriptCore2020(AssemblyCheckByNiec.IsInstalled("AweCore"), true, mField.GetValue(null) != null);
                                                }
                                                if (mField.GetValue(null) == null)
                                                {
                                                    NiecException.WriteLog("StartUpSafeErrorTrapAdded() Found mField.GetValue(null) == null");
                                                }
                                            }
                                            else
                                            {
                                                throw new NotSupportedException("OnScriptError not find");
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    NiecException.WriteLog("if (mf == null)");
                                }
                            }
                            else
                            {
                                throw new NotSupportedException("OnScriptError not find");
                            }
                        }
                    }
                });
            }
        }
Exemplo n.º 10
0
 public static bool sAcceptCancelDialogWithoutCommonException(string message)
 {
     try
     {
         throw new NiecModException("AcceptCancelDialogWithoutCommonException: Not Error");
     }
     catch (ResetException)
     {
         throw;
     }
     catch (NiecModException ex)
     {
         WriteLog("AcceptCancelDialogWithoutCommonException: " + NiecException.NewLine + NiecException.LogException(ex), true, true, false);
     }
     return(NFinalizeDeath.CheckAccept(message));
 }