protected bool AcquireOccupation(CareerManager ths, AcquireOccupationParameters occupationParameters) { Occupation occupation; Sim createdSim = ths.mSimDescription.CreatedSim; CareerLocation location = occupationParameters.Location; OccupationNames newJobGuid = occupationParameters.TargetJob; if ((ths.mJob != null) && (location != null) && (ths.mJob.Guid == location.Career.Guid) && (ths.mJob.CareerLoc != location)) { Career mJob = ths.mJob as Career; if ((mJob != null) && (mJob.TransferBetweenCareerLocations(location, false))) { IncStat("Transferred"); return(true); } } if (!ths.TryGetNewCareer(newJobGuid, out occupation)) { IncStat("TryGetNewCareer Fail"); return(false); } if (ths.mJob != null) { if (createdSim != null) { EventTracker.SendEvent(new TransferCareerEvent(createdSim, ths.mJob, occupation)); } ths.mJob.LeaveJob(false, Career.LeaveJobReason.kTransfered); } EventTracker.SendEvent(EventTypeId.kCareerNewJob, createdSim); occupation.OwnerDescription = ths.mSimDescription; occupation.mDateHired = SimClock.CurrentTime(); occupation.mAgeWhenJobFirstStarted = ths.mSimDescription.Age; occupation.SetAttributesForNewJob(location, occupationParameters.LotId, occupationParameters.CharacterImportRequest); EventTracker.SendEvent(new CareerEvent(EventTypeId.kEventCareerHired, occupation)); EventTracker.SendEvent(new CareerEvent(EventTypeId.kEventCareerChanged, occupation)); EventTracker.SendEvent(new CareerEvent(EventTypeId.kCareerDataChanged, occupation)); occupation.RefreshMapTagForOccupation(); ths.UpdateCareerUI(); if ((createdSim != null) && createdSim.IsActiveSim) { HudController.SetInfoState(InfoState.Career); } IncStat("Job Acquired " + occupation.Guid); return(true); }
protected static bool AcquireOccupation(CareerManager ths, AcquireOccupationParameters occupationParameters, bool prompt) { CareerLocation location = occupationParameters.Location; OccupationNames newJobGuid = occupationParameters.TargetJob; if ((ths.mJob != null) && (location != null) && (ths.mJob.Guid == location.Career.Guid) && (ths.mJob.CareerLoc != location)) { Career mJob = ths.mJob as Career; return((mJob != null) && mJob.TransferBetweenCareerLocations(location, false)); } Occupation occupation = null; if (!ths.TryGetNewCareer(newJobGuid, out occupation)) { return(false); } if (occupation is Career) { if (location == null) { return(false); } } Sim createdSim = ths.mSimDescription.CreatedSim; if (ths.mJob != null) { if (prompt) { string newJobName = string.Empty; if (!occupation.TryDisplayingGetHiredUi(location, ref occupationParameters, out newJobName)) { return(false); } if (!Occupation.ShowYesNoCareerOptionDialog(Common.LocalizeEAString(ths.mSimDescription.IsFemale, "Gameplay/Careers/Career:ConfirmLeavingOldCareer", new object[] { ths.mSimDescription, occupation.CareerName, ths.mJob.CareerName }))) { return(false); } } if (createdSim != null) { EventTracker.SendEvent(new TransferCareerEvent(createdSim, ths.mJob, occupation)); } ths.mJob.LeaveJob(false, Career.LeaveJobReason.kTransfered); } if (newJobGuid == OccupationNames.AcademicCareer) { AcademicCareer.EnrollSimInAcademicCareer(ths.mSimDescription, ths.DegreeManager.EnrollmentAcademicDegreeName, ths.DegreeManager.EnrollmentCouseLoad); } else { EventTracker.SendEvent(EventTypeId.kCareerNewJob, createdSim); occupation.OwnerDescription = ths.mSimDescription; occupation.mDateHired = SimClock.CurrentTime(); occupation.mAgeWhenJobFirstStarted = ths.mSimDescription.Age; occupation.SetAttributesForNewJob(location, occupationParameters.LotId, occupationParameters.CharacterImportRequest); EventTracker.SendEvent(new CareerEvent(EventTypeId.kEventCareerHired, occupation)); EventTracker.SendEvent(new CareerEvent(EventTypeId.kEventCareerChanged, occupation)); EventTracker.SendEvent(new CareerEvent(EventTypeId.kCareerDataChanged, occupation)); } occupation.RefreshMapTagForOccupation(); ths.UpdateCareerUI(); if ((createdSim != null) && createdSim.IsActiveSim) { HudController.SetInfoState(InfoState.Career); } return(true); }
protected static bool AcquireOccupation(CareerManager ths, AcquireOccupationParameters occupationParameters, bool prompt) { CareerLocation location = occupationParameters.Location; OccupationNames newJobGuid = occupationParameters.TargetJob; if ((ths.mJob != null) && (location != null) && (ths.mJob.Guid == location.Career.Guid) && (ths.mJob.CareerLoc != location)) { Career mJob = ths.mJob as Career; return ((mJob != null) && mJob.TransferBetweenCareerLocations(location, false)); } Occupation occupation = null; if (!ths.TryGetNewCareer(newJobGuid, out occupation)) { return false; } if (occupation is Career) { if (location == null) return false; } Sim createdSim = ths.mSimDescription.CreatedSim; if (ths.mJob != null) { if (prompt) { string newJobName = string.Empty; if (!occupation.TryDisplayingGetHiredUi(location, ref occupationParameters, out newJobName)) { return false; } if (!Occupation.ShowYesNoCareerOptionDialog(Common.LocalizeEAString(ths.mSimDescription.IsFemale, "Gameplay/Careers/Career:ConfirmLeavingOldCareer", new object[] { ths.mSimDescription, occupation.CareerName, ths.mJob.CareerName }))) { return false; } } if (createdSim != null) { EventTracker.SendEvent(new TransferCareerEvent(createdSim, ths.mJob, occupation)); } ths.mJob.LeaveJob(false, Career.LeaveJobReason.kTransfered); } if (newJobGuid == OccupationNames.AcademicCareer) { AcademicCareer.EnrollSimInAcademicCareer(ths.mSimDescription, ths.DegreeManager.EnrollmentAcademicDegreeName, ths.DegreeManager.EnrollmentCouseLoad); } else { EventTracker.SendEvent(EventTypeId.kCareerNewJob, createdSim); occupation.OwnerDescription = ths.mSimDescription; occupation.mDateHired = SimClock.CurrentTime(); occupation.mAgeWhenJobFirstStarted = ths.mSimDescription.Age; occupation.SetAttributesForNewJob(location, occupationParameters.LotId, occupationParameters.CharacterImportRequest); EventTracker.SendEvent(new CareerEvent(EventTypeId.kEventCareerHired, occupation)); EventTracker.SendEvent(new CareerEvent(EventTypeId.kEventCareerChanged, occupation)); EventTracker.SendEvent(new CareerEvent(EventTypeId.kCareerDataChanged, occupation)); } occupation.RefreshMapTagForOccupation(); ths.UpdateCareerUI(); if ((createdSim != null) && createdSim.IsActiveSim) { HudController.SetInfoState(InfoState.Career); } return true; }