public void Dispose() { try { mSim.AssignedRole = mRole; mSim.IsNeverSelectable = mNeverSelectable; if (mSim.CelebrityManager != null) { mSim.CelebrityManager.ScheduleOpportunityCallIfNecessary(); } if (mOpportunities != null) { mOpportunities.Dispose(); } if ((mSchool != null) && (mSim.CareerManager != null)) { mSim.CareerManager.mSchool = mSchool; } if ((mCareer != null) && (mSim.CareerManager != null) && (mSim.Occupation == null)) { mSim.CareerManager.mJob = mCareer; if (mSim.Occupation != null) { using (BaseWorldReversion reversion = new BaseWorldReversion()) { if ((mFlags & Flag.LoadFixup) == Flag.LoadFixup) { mSim.Occupation.OnLoadFixup(false); } if (((mFlags & Flag.Selectable) == Flag.Selectable) && (SimTypes.IsSelectable(mSim))) { using (StoryProgressionServiceEx.SuppressCreateHousehold suppress = new StoryProgressionServiceEx.SuppressCreateHousehold()) { bool careerLoc = true; if (mSim.Occupation is Career) { careerLoc = (mSim.Occupation.CareerLoc != null); } if (careerLoc) { Corrections.FixCareer(mSim.Occupation, false, null); mSim.Occupation.OnOwnerBecameSelectable(); } } } else if ((mFlags & Flag.Unselectable) == Flag.Unselectable) { using (StoryProgressionServiceEx.SuppressCreateHousehold suppress = new StoryProgressionServiceEx.SuppressCreateHousehold()) { // fix for script error in GhostHunter:ApplyCareerSpecificModifiersToXp where // ownersim is not null checked and breaks when this is ran during age up. ActiveCareerLevelStaticData data = null; int experience = 0; GhostHunter hunter = null; try { hunter = mSim.Occupation as GhostHunter; if (hunter != null) { data = hunter.GetCurrentLevelStaticDataForActiveCareer(); if (data != null) { experience = data.DailyPerfectJobBonusExperience; data.DailyPerfectJobBonusExperience = 0; } } mSim.Occupation.OnOwnerBecameUnselectable(); } catch (Exception e) { Common.Exception(mSim, e); } finally { if (hunter != null && data != null) { data.DailyPerfectJobBonusExperience = experience; } } } } } mSim.CareerManager.UpdateCareerUI(); } } } catch (Exception e) { Common.Exception(mSim, e); } }
public void Dispose() { try { mSim.AssignedRole = mRole; mSim.IsNeverSelectable = mNeverSelectable; if (mSim.CelebrityManager != null) { mSim.CelebrityManager.ScheduleOpportunityCallIfNecessary(); } if (mOpportunities != null) { mOpportunities.Dispose(); } if ((mSchool != null) && (mSim.CareerManager != null)) { mSim.CareerManager.mSchool = mSchool; } if ((mCareer != null) && (mSim.CareerManager != null) && (mSim.Occupation == null)) { mSim.CareerManager.mJob = mCareer; if (mSim.Occupation != null) { using (BaseWorldReversion reversion = new BaseWorldReversion()) { if ((mFlags & Flag.LoadFixup) == Flag.LoadFixup) { mSim.Occupation.OnLoadFixup(false); } if (((mFlags & Flag.Selectable) == Flag.Selectable) && (SimTypes.IsSelectable(mSim))) { using (StoryProgressionServiceEx.SuppressCreateHousehold suppress = new StoryProgressionServiceEx.SuppressCreateHousehold()) { bool careerLoc = true; if (mSim.Occupation is Career) { careerLoc = (mSim.Occupation.CareerLoc != null); } if (careerLoc) { Corrections.FixCareer(mSim.Occupation, false, null); mSim.Occupation.OnOwnerBecameSelectable(); } } } else if ((mFlags & Flag.Unselectable) == Flag.Unselectable) { using (StoryProgressionServiceEx.SuppressCreateHousehold suppress = new StoryProgressionServiceEx.SuppressCreateHousehold()) { mSim.Occupation.OnOwnerBecameUnselectable(); } } } mSim.CareerManager.UpdateCareerUI(); } } } catch (Exception e) { Common.Exception(mSim, e); } }