Beispiel #1
0
        public static void OnTermCompleted(AcademicCareer ths, float gradeAsPercentage)
        {
            if (ths.OwnerDescription == null)
            {
                throw new NullReferenceException("OwnerDescription");
            }
            else if (ths.OwnerDescription.CareerManager == null)
            {
                throw new NullReferenceException("CareerManager");
            }
            else if (ths.OwnerDescription.CareerManager.DegreeManager == null)
            {
                throw new NullReferenceException("DegreeManager");
            }
            else if (ths.DegreeInformation == null)
            {
                throw new NullReferenceException("DegreeInformation");
            }

            if (ths.OwnerDescription.CareerManager.DegreeManager.CommitAcademicProgressToDegree(ths.OwnerDescription, ths.DegreeInformation.AcademicDegreeName, (int)ths.mNumberOfCoursesPerDay, gradeAsPercentage, (uint)AcademicCareer.sTermLengthEx))
            {
                CollegeGraduationEx.GraduateSim(ths.OwnerDescription, ths.mDegree);
            }

            ActiveTopic.RemoveTopicFromSim(ths.OwnerSim, "During University");
            ths.LeaveJob(false, Career.LeaveJobReason.kNone);
        }
Beispiel #2
0
 public static void GraduateSim(SimDescription simDesc, AcademicDegree degree)
 {
     if ((simDesc != null) && (degree != null))
     {
         IHandleUniversityGraduation graduationRabbitHole = CollegeGraduation.GetGraduationRabbitHole() as IHandleUniversityGraduation;
         if (graduationRabbitHole != null)
         {
             Annex annex = graduationRabbitHole as Annex;
             if (annex != null)
             {
                 AnnexEx.AddSimToGraduationList(annex, simDesc, degree);
             }
             else
             {
                 graduationRabbitHole.AddSimToGraduationList(simDesc, degree);
             }
         }
         else if (simDesc.CreatedSim != null)
         {
             CollegeGraduation.GraduateInPlace entry = CollegeGraduation.GraduateInPlace.Singleton.CreateInstance(simDesc.CreatedSim, simDesc.CreatedSim, new InteractionPriority(InteractionPriorityLevel.High), false, false) as CollegeGraduation.GraduateInPlace;
             simDesc.CreatedSim.InteractionQueue.AddNext(entry);
             ActiveTopic.RemoveTopicFromSim(simDesc.CreatedSim, "University Graduation");
         }
     }
 }
Beispiel #3
0
            protected override void OnPerform()
            {
                Common.DebugNotify("StartGraduationCeremonyTask:OnPerform");

                if (mThs.IsAGraduationCeremonyInProgressAndIfNecessaryStartOne())
                {
                    foreach (SimDescription sim in new List <SimDescription>(mThs.mGraduatingSims.Keys))
                    {
                        try
                        {
                            Instantiation.PerformOffLot(sim, mThs.RabbitHoleProxy.LotCurrent, null);

                            if ((sim.CreatedSim != null) && (sim.CreatedSim.InteractionQueue != null))
                            {
                                sim.CreatedSim.ShowTNSIfSelectable(TNSNames.CollegeGraduationStarting, null, sim.CreatedSim, new object[] { sim.CreatedSim });
                                Annex.UniversityGraduationCeremony entry = Annex.UniversityGraduationCeremony.Singleton.CreateInstance(mThs, sim.CreatedSim, new InteractionPriority(InteractionPriorityLevel.High), false, true) as Annex.UniversityGraduationCeremony;
                                sim.CreatedSim.InteractionQueue.AddNext(entry);
                                ActiveTopic.RemoveTopicFromSim(sim.CreatedSim, "University Graduation");
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(sim, e);
                        }
                    }

                    Dictionary <ulong, SimDescription> loadedSims = SimListing.GetResidents(false);

                    foreach (MiniSimDescription sim in new List <MiniSimDescription>(mThs.mForeignVisitors))
                    {
                        try
                        {
                            // Custom
                            //   EA Standard attempts to reimport existing sims without checking
                            SimDescription local;
                            if (loadedSims.TryGetValue(sim.SimDescriptionId, out local))
                            {
                                if (!mThs.mLocalVisitors.Contains(local))
                                {
                                    mThs.mLocalVisitors.Add(local);
                                }
                            }
                            else
                            {
                                SimDescription simDescription = MiniSims.UnpackSimAndUpdateRel(sim);
                                if (simDescription != null)
                                {
                                    Household.CreateTouristHousehold();
                                    Household.TouristHousehold.AddTemporary(simDescription);
                                    sim.Instantiated = true;
                                    (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).OnSimCurrentWorldChanged(true, sim);

                                    if (simDescription.AgingState != null)
                                    {
                                        simDescription.AgingState.MergeTravelInformation(sim);
                                    }

                                    mThs.mLocalVisitors.Add(simDescription);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(sim, e);
                        }
                    }

                    Dictionary <SimDescription, bool> performed = new Dictionary <SimDescription, bool>();

                    foreach (SimDescription sim in new List <SimDescription>(mThs.mLocalVisitors))
                    {
                        try
                        {
                            if (mThs.mGraduatingSims.ContainsKey(sim))
                            {
                                continue;
                            }

                            if (performed.ContainsKey(sim))
                            {
                                continue;
                            }
                            performed[sim] = true;

                            Instantiation.PerformOffLot(sim, mThs.RabbitHoleProxy.LotCurrent, null);

                            if ((sim.CreatedSim != null) && (sim.CreatedSim.InteractionQueue != null))
                            {
                                InteractionInstance instance = Annex.AttendGraduationCeremony.Singleton.CreateInstance(mThs, sim.CreatedSim, new InteractionPriority(InteractionPriorityLevel.High), true, true);
                                sim.CreatedSim.InteractionQueue.AddNext(instance);
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(sim, e);
                        }
                    }
                }
            }
Beispiel #4
0
        public static void OnRemoval(OccultPlantSim ths, SimDescription simDes, bool alterOutfit)
        {
            Sim createdSim = simDes.CreatedSim;
            int index      = simDes.HasOutfit(OutfitCategories.Everyday, ths.mOccultOutfitKey);

            if (index >= 0x0)
            {
                simDes.RemoveOutfit(OutfitCategories.Everyday, index, true);
            }
            if (createdSim != null)
            {
                createdSim.Motives.RemoveMotive(CommodityKind.BePlantSim);
                createdSim.Motives.EnableMotive(CommodityKind.Bladder);
                createdSim.Motives.EnableMotive(CommodityKind.Hunger);
                createdSim.BuffManager.RemoveElement(BuffNames.PlantSimDehydrated);
                createdSim.BuffManager.RemoveElement(BuffNames.PlantSimHydrated);
                createdSim.TraitManager.RemoveElement(TraitNames.PlantSim);
                ActiveTopic.RemoveTopicFromSim(createdSim, "PlantSim Trait Topic");
                createdSim.Motives.UpdateMotives(1f, createdSim);
                (createdSim.RoutingComponent as SimRoutingComponent).RemoveOccultWalkingEffects(OccultTypes.PlantSim);
                ResourceKey skinToneKey = new ResourceKey(0xe8a7d5f0fec3d90bL, 0x354796a, 0x0);
                if (ths.mOldSkinToneKey != ResourceKey.kInvalidResourceKey)
                {
                    skinToneKey = ths.mOldSkinToneKey;
                }

                if (alterOutfit)
                {
                    simDes.SetSkinAndHairForAllOutfits(simDes.Age, skinToneKey, ths.mOldSkinIndex, ResourceKey.kInvalidResourceKey, true, ths.mOldHairColor);
                    simDes.RemoveBodyTypeFromAllOutfits(BodyTypes.BirthMark);
                    simDes.RemoveBodyTypeFromAllOutfits(BodyTypes.Beard);
                }

                HudModel hudModel = Responder.Instance.HudModel as HudModel;
                if ((hudModel != null) && (hudModel.GetSimInfo(createdSim.ObjectId) != null))
                {
                    if (alterOutfit)
                    {
                        SimBuilder builder = new SimBuilder();
                        builder.Clear();
                        SimOutfit outfit = simDes.GetOutfit(OutfitCategories.Everyday, 0x0);
                        OutfitUtils.SetOutfit(builder, outfit, null);
                        OutfitUtils.ExtractOutfitHairColor(simDes, builder);
                        ths.mOutfitIsReady = false;
                        createdSim.SwitchToOutfitDelayed(outfit, new CASUtils.SwapReadyCallback(ths.PlayConcealEffectAndSwapOutfit));
                        for (int i = 0x0; !ths.mOutfitIsReady && (i < 0xc350); i++)
                        {
                            Common.Sleep(0xa);
                        }
                        ths.SwapOutfit();
                    }

                    hudModel.OnSimAppearanceChanged(createdSim.ObjectId);
                    hudModel.NotifyNameChanged(createdSim.ObjectId);
                }
                else
                {
                    createdSim.SwitchToOutfitWithoutSpin(Sim.ClothesChangeReason.Force, createdSim.CurrentOutfitCategory, true);
                }

                createdSim.Motives.RemoveMotive(CommodityKind.BePlantSim);
                createdSim.Motives.EnableMotive(CommodityKind.Bladder);
                createdSim.Motives.EnableMotive(CommodityKind.Hunger);
                createdSim.BuffManager.RemoveElement(BuffNames.PlantSimDehydrated);
                createdSim.BuffManager.RemoveElement(BuffNames.PlantSimHydrated);
                createdSim.TraitManager.RemoveElement(TraitNames.PlantSim);
                ActiveTopic.RemoveTopicFromSim(createdSim, "PlantSim Trait Topic");
                hudModel.NotifyNameChanged(createdSim.ObjectId);
                createdSim.Motives.UpdateMotives(1f, createdSim);
            }
        }