Пример #1
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            string text = StringInputDialog.Show(Name, Common.Localize("Rename:FirstName"), me.FirstName, 256, StringInputDialog.Validation.None);

            if ((text == null) || (text == ""))
            {
                SimpleMessageDialog.Show(Name, Common.Localize("Rename:Error"));
                return(false);
            }
            me.FirstName = text;

            text = StringInputDialog.Show(Name, Common.Localize("Rename:LastName"), me.LastName, 256, StringInputDialog.Validation.None);
            if ((text == null) || (text == ""))
            {
                SimpleMessageDialog.Show(Name, Common.Localize("Rename:Error"));
                return(false);
            }
            me.LastName = text;

            if (me.Household == Household.ActiveHousehold)
            {
                HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel;
                if ((me.CreatedSim != null) && (hudModel.FindSimInfo(me.CreatedSim.ObjectId) != null))
                {
                    hudModel.NotifyNameChanged(me.CreatedSim.ObjectId);
                }
            }

            return(true);
        }
Пример #2
0
        public override void OnDelayedWorldLoadFinished()
        {
            if (!GameUtils.IsInstalled(ProductVersion.EP7))
            {
                return;
            }

            Overwatch.Log("HandleLunarCycle");

            float hourOfDay = World.GetSunriseTime() + 2.6f;

            HudModel model = Sims3.UI.Responder.Instance.HudModel as HudModel;

            AlarmManager.Global.RemoveAlarm(model.mLunarUpdateAlram);
            model.mLunarUpdateAlram = AlarmManager.Global.AddAlarmDay(hourOfDay, ~DaysOfTheWeek.None, OnLunarUpdate, "LunarUpdateAlarm", AlarmType.NeverPersisted, null);

            if (Overwatch.Settings.mCurrentPhaseIndex < 0)
            {
                InitializeLunarPhase();
            }

            LunarUpdate(false);

            if (SimClock.IsNightTime())
            {
                // Reactivates any alarms that were not persisted to save
                EventTracker.SendEvent(new LunarCycleEvent(EventTypeId.kMoonRise, (LunarCycleManager.LunarPhase)World.GetLunarPhase()));

                if (SimClock.HoursPassedOfDay >= (World.GetSunsetTime() + LunarCycleManager.kLunarEffectsDelayHours))
                {
                    if (!Overwatch.Settings.mDisableFullMoonLighting)
                    {
                        LunarCycleManager.TriggerLunarLighting();
                    }
                }
            }

            if (Overwatch.Settings.mDisableFullMoonLighting)
            {
                AlarmManager.Global.RemoveAlarm(LunarCycleManager.mLunarEffectsAlarm);
                LunarCycleManager.mLunarEffectsAlarm = AlarmHandle.kInvalidHandle;
            }

            foreach (MoonDial dial in Sims3.Gameplay.Queries.GetObjects <MoonDial>())
            {
                try
                {
                    if (dial.mLunarFXLookUp.Length > Overwatch.Settings.mCurrentPhaseIndex)
                    {
                        dial.StartLunarFX(dial.mLunarFXLookUp[Overwatch.Settings.mCurrentPhaseIndex]);
                    }
                }
                catch
                { }
            }

            Sims3.UI.Responder.Instance.OptionsModel.OptionsChanged += OnOptionsChanged;
        }
Пример #3
0
        public static List <KnownInfo> GetKnownInfo(HudModel ths, IMiniSimDescription simDesc)
        {
            if ((ths.mSavedCurrentSim != null) && (ths.mSavedCurrentSim.SimDescription != null) && (simDesc != null))
            {
                if (ths.mSavedCurrentSim.SimDescription == simDesc)
                {
                    return(GetKnownInfoAboutSelf(ths, simDesc));
                }

                if (simDesc is SimDescription)
                {
                    if (ths.mSavedCurrentSim.SocialComponent != null)
                    {
                        foreach (Relationship relationship in ths.mSavedCurrentSim.SocialComponent.Relationships)
                        {
                            if (relationship == null)
                            {
                                continue;
                            }

                            SimDescription otherSimDescription = relationship.GetOtherSimDescription(ths.mSavedCurrentSim.SimDescription);
                            if (otherSimDescription != simDesc)
                            {
                                continue;
                            }

                            InformationLearnedAboutSim learnedInfo = relationship.InformationAbout(otherSimDescription);
                            return(GetKnownInfoList(ths, otherSimDescription, learnedInfo));
                        }
                    }
                }
                else
                {
                    MiniSimDescription tsd = MiniSimDescription.Find(ths.mSavedCurrentSim.SimDescription.SimDescriptionId);
                    if (tsd != null)
                    {
                        foreach (MiniRelationship relationship in tsd.MiniRelationships)
                        {
                            if (relationship == null)
                            {
                                continue;
                            }

                            if (relationship.SimDescriptionId != simDesc.SimDescriptionId)
                            {
                                continue;
                            }

                            MiniSimDescription otherTsd = MiniSimDescription.Find(relationship.SimDescriptionId);
                            return(relationship.GetKnownInfo(tsd, otherTsd));
                        }
                    }
                }
            }

            return(new List <KnownInfo>());
        }
Пример #4
0
        protected override OptionResult Run(IActor actor, IMausoleum mausoleum)
        {
            if (CameraController.IsMapViewModeEnabled())
            {
                Sims3.Gameplay.Core.Camera.ToggleMapView();
            }

            HudModel.OpenObjectInventoryForOwner(mausoleum);
            return(OptionResult.SuccessClose);
        }
 public override bool Run()
 {
     try
     {
         Target.TraitManager.mSocialGroupTraitEnabled = true;
         HudModel.ShowTraitsPickerDialogForSocialGroupTrait(Target, TraitManager.GetTraitFromDictionary(TraitNames.InfluenceNerd));
     }
     catch (Exception exception)
     {
         Common.Exception(Actor, Target, exception);
     }
     return(true);
 }
 public override bool Run()
 {
     try
     {
         Target.TraitManager.mUniversityGraduateTraitEnabled = true;
         HudModel.ShowTraitsPickerDialogForUniversityGraduateTrait(Target);
     }
     catch (Exception exception)
     {
         Common.Exception(Actor, Target, exception);
     }
     return(true);
 }
Пример #7
0
        public static HudElement FromXml(XElement xe)
        {
            var type = xe.Name.ToString();

            if (!HudModel.IsValidType(type))
            {
                Mod.Error($"Invalid HUD widget type '{type}'");
                return(null);
            }

            var defName = xe.Attribute(DefNameAttribute)?.Value;
            var targets = TargetsFromXml(xe);

            return(new HudElement(type, defName, targets));
        }
Пример #8
0
        protected bool PrivatePerform()
        {
            try
            {
                if (Sim.CreatedSim == null)
                {
                    IncStat("Hibernating");
                    return(false);
                }

                HudModel.ShowTraitsPickerDialog(0, Sim.CreatedSim);
            }
            catch (Exception e)
            {
                Common.DebugException(Sim, e);
            }
            return(true);
        }
Пример #9
0
        protected bool OnPerform()
        {
            AgingManager.Singleton.CancelAgingAlarmsForSim(Target);
            if (Target.SimDescription.Elder)
            {
                Target.SimDescription.AgingState.ExtendElderLifeSpan(20f);
            }
            else
            {
                Target.SimDescription.AgingState.ExtendAgingState(20f);
            }

            HudModel hudModel = (HudModel)Sims3.Gameplay.UI.Responder.Instance.HudModel;

            if (hudModel != null)
            {
                hudModel.OnSimAgeChanged(Target.ObjectId);
            }

            return(false);
        }
Пример #10
0
        protected override OptionResult Run(Lot lot, Household me)
        {
            if (me == null)
            {
                return(OptionResult.Failure);
            }

            string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt"), me.Name);

            if (string.IsNullOrEmpty(text))
            {
                return(OptionResult.Failure);
            }

            if (AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":SimsPrompt", false, new object[] { me.Name, text })))
            {
                foreach (SimDescription sim in CommonSpace.Helpers.Households.All(me))
                {
                    if (sim.LastName.Trim().ToLower() == me.Name.Trim().ToLower())
                    {
                        sim.LastName = text;

                        if (me == Household.ActiveHousehold)
                        {
                            HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel;
                            if (sim.CreatedSim != null)
                            {
                                Household.AddDirtyNameSimID(sim.SimDescriptionId);
                                hudModel.NotifyNameChanged(sim.CreatedSim.ObjectId);
                            }
                        }
                    }
                }
            }

            me.Name = text;
            return(OptionResult.SuccessClose);
        }
Пример #11
0
 public HudState(Hud.HudMediator mediator)
 {
     this.Mediator = mediator;
     this.HudModel = mediator._hudModel;
     this.View     = mediator._view;
 }
Пример #12
0
 public HudState(HudMediator mediator) : base(mediator)
 {
     Mediator = mediator;
     HudModel = mediator._hudModel;
     View     = mediator._view;
 }
Пример #13
0
        public static Urnstone CreateGrave(SimDescription me, SimDescription.DeathType deathType, bool ignoreExisting, bool report)
        {
            Urnstone urnstone = FindGhostsGrave(me);

            if ((urnstone != null) && (!ignoreExisting))
            {
                if ((urnstone.InInventory) || (urnstone.InWorld))
                {
                    return(urnstone);
                }
            }

            Household originalHousehold = me.Household;

            bool addOnly = false;

            if (urnstone == null)
            {
                urnstone = PrivateCreateGrave(me);
                if (urnstone == null)
                {
                    return(null);
                }
            }
            else
            {
                addOnly = true;
            }

            bool success = MoveToMausoleum(urnstone);

            if (!success)
            {
                if (me.CreatedSim != null)
                {
                    if (Inventories.TryToMove(urnstone, me.CreatedSim.Inventory))
                    {
                        success = true;
                    }
                }

                if ((!success) && (Sim.ActiveActor != null))
                {
                    if (Inventories.TryToMove(urnstone, Sim.ActiveActor.Inventory))
                    {
                        success = true;
                    }
                }

                if (!success)
                {
                    return(null);
                }
            }

            if (report)
            {
                Common.Notify(Common.Localize("ForceKill:Success", me.IsFemale, new object[] { me }));
            }

            if ((addOnly) && (!ignoreExisting))
            {
                return(urnstone);
            }

            if ((originalHousehold == Household.ActiveHousehold) && (me.CreatedSim != null))
            {
                HudModel model = HudController.Instance.Model as HudModel;

                foreach (SimInfo info in model.mSimList)
                {
                    if (info.mGuid == me.CreatedSim.ObjectId)
                    {
                        model.RemoveSimInfo(info);
                        model.mSimList.Remove(info);
                        break;
                    }
                }
            }

            if (me.CreatedSim != null)
            {
                me.CreatedSim.Destroy();
            }

            if (originalHousehold != null)
            {
                originalHousehold.Remove(me, !originalHousehold.IsSpecialHousehold);
            }

            if (me.DeathStyle == SimDescription.DeathType.None)
            {
                if (me.IsHuman)
                {
                    switch (deathType)
                    {
                    case SimDescription.DeathType.None:
                    case SimDescription.DeathType.PetOldAgeBad:
                    case SimDescription.DeathType.PetOldAgeGood:
                        deathType = SimDescription.DeathType.OldAge;
                        break;
                    }
                }
                else
                {
                    switch (deathType)
                    {
                    case SimDescription.DeathType.None:
                    case SimDescription.DeathType.OldAge:
                        deathType = SimDescription.DeathType.PetOldAgeGood;
                        break;
                    }
                }

                me.SetDeathStyle(deathType, true);
            }

            me.IsNeverSelectable = true;
            me.Contactable       = false;
            me.Marryable         = false;

            if (me.CreatedSim == PlumbBob.SelectedActor)
            {
                LotManager.SelectNextSim();
            }

            if (me.CareerManager != null)
            {
                me.CareerManager.LeaveAllJobs(Sims3.Gameplay.Careers.Career.LeaveJobReason.kDied);
            }

            urnstone.OnHandToolMovement();
            Urnstone.FinalizeSimDeath(me, originalHousehold);
            int num = ((int)Math.Floor((double)SimClock.ConvertFromTicks(SimClock.CurrentTime().Ticks, TimeUnit.Minutes))) % 60;

            urnstone.MinuteOfDeath = num;

            return(urnstone);
        }
Пример #14
0
        public static List <KnownInfo> GetKnownInfoAboutSelf(HudModel ths, IMiniSimDescription simDescription)
        {
            List <KnownInfo> infos       = new List <KnownInfo>();
            SimDescription   description = simDescription as SimDescription;

            if (description != null)
            {
                string firstName;
                bool   isHuman = description.IsHuman;
                bool   teen    = (description.Age & CASAgeGenderFlags.Teen) != CASAgeGenderFlags.None;
                bool   child   = (description.Age & CASAgeGenderFlags.Child) != CASAgeGenderFlags.None;
                foreach (Trait trait in description.TraitManager.List)
                {
                    if (trait.IsVisible && Localization.HasLocalizationString(trait.TraitNameInfo))
                    {
                        infos.Add(new KnownInfo(trait.TraitName(description.IsFemale), trait.IconKey, KnownInfoType.Trait));
                    }
                }

                if (isHuman && !child)
                {
                    if (GameUtils.GetCurrentWorld() != description.HomeWorld)
                    {
                        MiniSimDescription description2 = MiniSimDescription.Find(description.SimDescriptionId);
                        if (description2 != null)
                        {
                            description2.GetKnownJobInfo(infos);
                        }
                    }
                    else if ((description.CareerManager != null) && (description.CareerManager.Occupation != null))
                    {
                        infos.Add(new KnownInfo(description.CareerManager.Occupation.CurLevelJobTitle, ResourceKey.CreatePNGKey(description.CareerManager.Occupation.CareerIcon, 0), KnownInfoType.Career));
                    }
                    else if (description.CreatedByService != null)
                    {
                        string str2 = Localization.LocalizeString(description.IsFemale, "Gameplay/Services/Title:" + description.CreatedByService.ServiceType.ToString(), new object[0]);
                        infos.Add(new KnownInfo(str2, ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                    }
                    else
                    {
                        infos.Add(new KnownInfo(Localization.LocalizeString(description.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:Unemployed", new object[0]), ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                    }
                }

                ResourceKey kInvalidResourceKey = ResourceKey.kInvalidResourceKey;
                if (description.Partner != null)
                {
                    firstName = description.Partner.FirstName;
                    Relationship relationship = description.GetRelationship(description.Partner, false);

                    // Custom
                    if (relationship != null)
                    {
                        kInvalidResourceKey = RelationshipFunctions.GetLTRRelationshipImageKey(relationship.LTR.CurrentLTR, relationship.IsPetToPetRelationship);
                    }
                }
                else
                {
                    firstName = Localization.LocalizeString("Ui/Caption/HUD/KnownInfoDialog:None", new object[0]);
                }

                infos.Add(new KnownInfo(firstName, kInvalidResourceKey, KnownInfoType.Partner));
                if ((isHuman && (teen || child)) && ((description.CareerManager != null) && (description.CareerManager.School != null)))
                {
                    infos.Add(new KnownInfo(description.CareerManager.School.Name, ResourceKey.CreatePNGKey(description.CareerManager.School.CareerIcon, 0), KnownInfoType.School));
                }

                if (GameUtils.IsInstalled(ProductVersion.EP9))
                {
                    List <IDegreeEntry> completedDegreeEntries = description.CareerManager.DegreeManager.GetCompletedDegreeEntries();
                    if (completedDegreeEntries.Count > 0)
                    {
                        KnownInfo item = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                        foreach (IDegreeEntry entry in completedDegreeEntries)
                        {
                            if (item.mDegreeIcons.Count == 5)
                            {
                                infos.Add(item);
                                item = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                            }
                            item.mDegreeIcons.Add(ResourceKey.CreatePNGKey(entry.DegreeIcon, 0));
                        }
                        infos.Add(item);
                    }
                }

                if (description.IsRich)
                {
                    infos.Add(new KnownInfo(Localization.LocalizeString(description.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:IsRich", new object[0]), ResourceKey.CreatePNGKey("w_simoleon_32", 0), KnownInfoType.Rich));
                }
                return(infos);
            }

            MiniSimDescription description3 = simDescription as MiniSimDescription;

            if (description3 != null)
            {
                infos = description3.GetKnownInfoOfSelf();
            }
            return(infos);
        }
Пример #15
0
        public static List <KnownInfo> GetKnownInfoList(HudModel ths, SimDescription otherSimDesc, InformationLearnedAboutSim learnedInfo)
        {
            List <KnownInfo> list = new List <KnownInfo>();

            Common.StringBuilder msg = new Common.StringBuilder("GetKnownInfoList" + Common.NewLine);

            try
            {
                if (otherSimDesc != null)
                {
                    bool   isHuman = otherSimDesc.IsHuman;
                    bool   isTeen  = (otherSimDesc.Age & CASAgeGenderFlags.Teen) != CASAgeGenderFlags.None;
                    bool   isChild = (otherSimDesc.Age & CASAgeGenderFlags.Child) != CASAgeGenderFlags.None;
                    string str     = Localization.LocalizeString("Ui/Caption/HUD/RelationshipsPanel:UnknownTrait", new object[0x0]);

                    msg += "A";

                    foreach (Trait trait in otherSimDesc.TraitManager.List)
                    {
                        if (!trait.IsVisible || !Localization.HasLocalizationString(trait.TraitNameInfo))
                        {
                            continue;
                        }
                        bool flag4 = false;
                        foreach (TraitNames names in learnedInfo.Traits)
                        {
                            if (trait.Guid == names)
                            {
                                list.Add(new KnownInfo(trait.TraitName(otherSimDesc.IsFemale), trait.IconKey, KnownInfoType.Trait));
                                flag4 = true;
                                break;
                            }
                        }
                        if (!flag4)
                        {
                            list.Add(new KnownInfo(str, ResourceKey.CreatePNGKey("trait_unknown", 0x0), KnownInfoType.TraitUnknown));
                        }
                    }

                    msg += "B";

                    if ((isHuman && learnedInfo.CareerKnown) && !isChild)
                    {
                        bool      flag5        = false;
                        WorldName currentWorld = GameUtils.GetCurrentWorld();
                        if ((otherSimDesc.HomeWorld != currentWorld) && (GameUtils.GetWorldType(currentWorld) == WorldType.Vacation))
                        {
                            MiniSimDescription description = MiniSimDescription.Find(otherSimDesc.SimDescriptionId);
                            if (description != null)
                            {
                                ResourceKey iconKey = string.IsNullOrEmpty(description.JobIcon) ? ResourceKey.kInvalidResourceKey : ResourceKey.CreatePNGKey(description.JobIcon, 0x0);
                                list.Add(new KnownInfo(Localization.LocalizeString(description.IsFemale, description.JobOrServiceName, new object[0x0]), iconKey, KnownInfoType.Career));
                                flag5 = true;
                            }
                        }

                        msg += "C";

                        if (!flag5)
                        {
                            CareerManager careerManager = otherSimDesc.CareerManager;
                            if ((careerManager != null) && (careerManager.Occupation != null))
                            {
                                msg += "C1";

                                Occupation    occupation = careerManager.Occupation;
                                string        careerIcon = occupation.CareerIcon;
                                ResourceKey   key2       = string.IsNullOrEmpty(careerIcon) ? ResourceKey.kInvalidResourceKey : ResourceKey.CreatePNGKey(careerIcon, 0x0);
                                KnownInfoType type       = occupation.IsAcademicCareer ? KnownInfoType.AcademicCareer : KnownInfoType.Career;
                                list.Add(new KnownInfo(occupation.CurLevelJobTitle, key2, type));
                            }
                            else if ((otherSimDesc.CreatedByService != null) && Sims3.Gameplay.Services.Services.IsSimDescriptionInAnyServicePool(otherSimDesc))
                            {
                                string str4 = Localization.LocalizeString(otherSimDesc.IsFemale, "Gameplay/Services/Title:" + otherSimDesc.CreatedByService.ServiceType.ToString(), new object[0x0]);
                                list.Add(new KnownInfo(str4, ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                            }
                            else if ((otherSimDesc.AssignedRole != null) && !string.IsNullOrEmpty(otherSimDesc.AssignedRole.CareerTitleKey))
                            {
                                list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, otherSimDesc.AssignedRole.CareerTitleKey, new object[0x0]), ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                            }
                            else if (((careerManager != null) && (careerManager.Occupation == null)) && (careerManager.RetiredCareer != null))
                            {
                                list.Add(new KnownInfo(Localization.LocalizeString("Ui/Caption/HUD/Career:Retired", new object[0x0]), ResourceKey.CreatePNGKey(careerManager.RetiredCareer.CareerIcon, 0x0), KnownInfoType.Career));
                            }
                            else
                            {
                                list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:Unemployed", new object[0x0]), ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                            }
                        }
                    }

                    msg += "D";

                    if (learnedInfo.PartnerKnown)
                    {
                        string      firstName            = null;
                        ResourceKey relationshipImageKey = ResourceKey.kInvalidResourceKey;
                        if (otherSimDesc.Partner != null)
                        {
                            msg += "D1";

                            firstName = otherSimDesc.Partner.FirstName;

                            // Custom : false -> true
                            Relationship relationship = otherSimDesc.GetRelationship(otherSimDesc.Partner, true);
                            if (relationship != null)
                            {
                                relationshipImageKey = RelationshipFunctions.GetLTRRelationshipImageKey(relationship.LTR.CurrentLTR, relationship.IsPetToPetRelationship);
                            }
                        }
                        else
                        {
                            msg += "D2";

                            if (otherSimDesc.HomeWorld != GameUtils.GetCurrentWorld())
                            {
                                MiniSimDescription description2 = MiniSimDescription.Find(otherSimDesc.SimDescriptionId);
                                if ((description2 != null) && (description2.PartnerId != 0x0L))
                                {
                                    MiniSimDescription otherSim = MiniSimDescription.Find(description2.PartnerId);
                                    if (otherSim != null)
                                    {
                                        firstName = otherSim.FirstName;
                                        MiniRelationship miniRelationship = description2.GetMiniRelationship(otherSim) as MiniRelationship;
                                        if (miniRelationship != null)
                                        {
                                            relationshipImageKey = RelationshipFunctions.GetLTRRelationshipImageKey(miniRelationship.CurrentLTR, miniRelationship.IsPetToPetRelationship);
                                        }
                                    }
                                }
                            }

                            if (string.IsNullOrEmpty(firstName))
                            {
                                firstName = Localization.LocalizeString("Ui/Caption/HUD/KnownInfoDialog:None", new object[0x0]);
                            }
                        }
                        list.Add(new KnownInfo(firstName, relationshipImageKey, KnownInfoType.Partner));
                    }

                    msg += "E";

                    if ((isHuman && (isTeen || isChild)) && ((otherSimDesc.CareerManager != null) && (otherSimDesc.CareerManager.School != null)))
                    {
                        list.Add(new KnownInfo(otherSimDesc.CareerManager.School.Name, ResourceKey.CreatePNGKey(otherSimDesc.CareerManager.School.CareerIcon, 0x0), KnownInfoType.School));
                    }

                    if (learnedInfo.IsRichAndKnownToBeRich)
                    {
                        list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:IsRich", new object[0x0]), ResourceKey.CreatePNGKey("w_simoleon_32", 0x0), KnownInfoType.Rich));
                    }

                    if (isHuman && learnedInfo.SignKnown)
                    {
                        Zodiac zodiac = otherSimDesc.Zodiac;
                        list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:" + zodiac.ToString(), new object[0x0]), ResourceKey.CreatePNGKey("sign_" + zodiac.ToString() + "_sm", 0x0), KnownInfoType.Zodiac));
                    }

                    if (isHuman && learnedInfo.AlmaMaterKnown)
                    {
                        if (otherSimDesc.AlmaMater != AlmaMater.None)
                        {
                            list.Add(new KnownInfo(otherSimDesc.AlmaMaterName, ResourceKey.CreatePNGKey("w_simple_school_career_s", 0), KnownInfoType.AlmaMater));
                        }
                        if (((otherSimDesc.CareerManager != null) && (otherSimDesc.CareerManager.DegreeManager != null)) && (otherSimDesc.CareerManager.DegreeManager.GetDegreeEntries().Count > 0))
                        {
                            list.Add(new KnownInfo(Localization.LocalizeString("Ui/Caption/HUD/KnownInfoTooltip:UniversityAlmaMater", new object[0]), ResourceKey.CreatePNGKey("moodlet_just_graduated", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.AlmaMater));
                        }
                    }

                    msg += "G";

                    uint celebrityLevel = otherSimDesc.CelebrityLevel;
                    if (celebrityLevel > 0x0)
                    {
                        KnownInfo item = new KnownInfo(otherSimDesc.CelebrityManager.LevelName, ResourceKey.CreatePNGKey("hud_i_celebrity_page", 0x0), KnownInfoType.CelebrityLevel);
                        item.mCelebrityLevel = celebrityLevel;
                        list.Add(item);
                    }

                    msg += "H";

                    if (learnedInfo.IsSocialGroupsKnown)
                    {
                        TraitManager traitManager = otherSimDesc.TraitManager;
                        SkillManager skillManager = otherSimDesc.SkillManager;
                        if ((traitManager != null) && (skillManager != null))
                        {
                            if (traitManager.HasElement(TraitNames.InfluenceNerd))
                            {
                                InfluenceSkill skill = skillManager.GetSkill <InfluenceSkill>(SkillNames.InfluenceNerd);
                                if ((skill != null) && (skill.SkillLevel > 0))
                                {
                                    list.Add(new KnownInfo(string.Concat(new object[] { Localization.LocalizeString("Ui/Tooltips/SocialGroup:Nerd", new object[0]), "(", skill.SkillLevel, ")" }), ResourceKey.CreatePNGKey("trait_SocialGroup01_s", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.SocialGroup));
                                }
                            }
                            if (traitManager.HasElement(TraitNames.InfluenceSocialite))
                            {
                                InfluenceSkill skill2 = skillManager.GetSkill <InfluenceSkill>(SkillNames.InfluenceSocialite);
                                if ((skill2 != null) && (skill2.SkillLevel > 0))
                                {
                                    list.Add(new KnownInfo(string.Concat(new object[] { Localization.LocalizeString("Ui/Tooltips/SocialGroup:Jock", new object[0]), "(", skill2.SkillLevel, ")" }), ResourceKey.CreatePNGKey("trait_SocialGroup03_s", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.SocialGroup));
                                }
                            }
                            if (traitManager.HasElement(TraitNames.InfluenceRebel))
                            {
                                InfluenceSkill skill3 = skillManager.GetSkill <InfluenceSkill>(SkillNames.InfluenceRebel);
                                if ((skill3 != null) && (skill3.SkillLevel > 0))
                                {
                                    list.Add(new KnownInfo(string.Concat(new object[] { Localization.LocalizeString("Ui/Tooltips/SocialGroup:Rebel", new object[0]), "(", skill3.SkillLevel, ")" }), ResourceKey.CreatePNGKey("trait_SocialGroup02_s", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.SocialGroup));
                                }
                            }
                        }
                    }

                    msg += "I";

                    if (learnedInfo.NumDegreesKnown() > 0)
                    {
                        KnownInfo info2 = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                        otherSimDesc.CareerManager.DegreeManager.GetCompletedDegreeEntries();
                        foreach (AcademicDegreeNames names2 in learnedInfo.Degrees)
                        {
                            AcademicDegree element = otherSimDesc.CareerManager.DegreeManager.GetElement(names2);
                            if ((element != null) && element.IsDegreeCompleted)
                            {
                                if (info2.mDegreeIcons.Count == 5)
                                {
                                    list.Add(info2);
                                    info2 = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                                }
                                ResourceKey key4 = ResourceKey.CreatePNGKey(element.DegreeIcon, 0);
                                info2.mDegreeIcons.Add(key4);
                                info2.mIconKey = key4;
                                info2.mInfo    = element.DegreeName;
                            }
                        }
                        list.Add(info2);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(otherSimDesc, null, msg, e);
            }

            return(list);
        }
Пример #16
0
            protected override bool OnPerform()
            {
                if ((HudController.Instance != null) && (GameUtils.IsOnVacation()))
                {
                    HudModel model = HudController.Instance.mHudModel as HudModel;
                    if (model != null)
                    {
                        if (model.MinuteChanged != null)
                        {
                            foreach (Delegate del in model.MinuteChanged.GetInvocationList())
                            {
                                TimeControl control = del.Target as TimeControl;
                                if (control != null)
                                {
                                    TimeControlEx.sThs = control;

                                    model.MinuteChanged -= TimeControlEx.sThs.OnMinuteChanged;
                                    model.MinuteChanged -= TimeControlEx.OnMinuteChanged;
                                    model.MinuteChanged += TimeControlEx.OnMinuteChanged;

                                    break;
                                }
                            }
                        }
                    }
                }

                InventoryPanel inventory = InventoryPanel.sInstance;

                if ((inventory != null) && (inventory.Visible))
                {
                    if (inventory.mTimeAlmanacButton != null)
                    {
                        if (GameUtils.IsFutureWorld())
                        {
                            inventory.mTimeAlmanacButton.Visible = (GameStates.TravelHousehold == Household.ActiveHousehold);
                        }

                        if (inventory.mTimeAlmanacButton.Visible)
                        {
                            inventory.mTimeAlmanacButton.Click -= inventory.OnClickTimeAlmanac;
                            inventory.mTimeAlmanacButton.Click -= FutureDescendantServiceEx.OnClickTimeAlmanac;
                            inventory.mTimeAlmanacButton.Click += FutureDescendantServiceEx.OnClickTimeAlmanac;
                        }
                    }
                }

                EditTownPuck puck = EditTownPuck.Instance;

                if (puck != null)
                {
                    if (puck.mReturnToLiveButton != null)
                    {
                        puck.mReturnToLiveButton.Click -= puck.OnReturnToLive;
                        puck.mReturnToLiveButton.Click -= OnReturnToLive;
                        puck.mReturnToLiveButton.Click += OnReturnToLive;
                    }
                }

                EditTownInfoPanel panel = EditTownInfoPanel.Instance;

                if (panel != null)
                {
                    if ((panel.mActionButtons != null) && (panel.mActionButtons.Length > 8) && (panel.mActionButtons[0x8] != null))
                    {
                        panel.mActionButtons[0x8].Click -= panel.OnChangeTypeClick;
                        panel.mActionButtons[0x8].Click -= OnChangeTypeClick;
                        panel.mActionButtons[0x8].Click += OnChangeTypeClick;
                    }
                }

                OptionsDialog options = OptionsDialog.sDialog;

                if (options != null)
                {
                    if (GameUtils.IsInstalled(ProductVersion.EP8))
                    {
                        Button testButton = options.mSeasonWindow.GetChildByID(0xdf085c3, true) as Button;
                        if ((testButton != null) && (!testButton.Enabled))
                        {
                            using (BaseWorldReversion reversion = new BaseWorldReversion())
                            {
                                foreach (Button weather in options.mEnabledWeatherButtons.Values)
                                {
                                    weather.Enabled = true;
                                }

                                if (options.mFahrenheitRadio != null)
                                {
                                    options.mFahrenheitRadio.Enabled = true;
                                }

                                if (options.mCelciusRadio != null)
                                {
                                    options.mCelciusRadio.Enabled = true;
                                }

                                options.SetupSeasonControls(false, ref options.mOldSeasonData);
                            }
                        }
                    }
                }

                FutureDescendantService instance = FutureDescendantServiceEx.GetInstance();

                if (Sims3.UI.Responder.Instance.InLiveMode && Traveler.Settings.mDisableDescendants && instance.mEventListeners.Count > 0)
                {
                    instance.CleanUpEventListeners();
                }

                return(true);
            }
Пример #17
0
        private void OnHouseholdSimChanged(Sims3.Gameplay.CAS.HouseholdEvent householdEvent, IActor actor, Household oldHousehold)
        {
            Common.StringBuilder msg = new Common.StringBuilder("OnHouseholdSimChanged");

            try
            {
                HudModel ths = Sims3.UI.Responder.Instance.HudModel as HudModel;

                if (ths.HouseholdChanged != null)
                {
                    msg += "A";

                    if (householdEvent != Sims3.Gameplay.CAS.HouseholdEvent.kNone)
                    {
                        msg += "B";

                        ths.ClearSimList();
                        if ((ths.mCurrentHousehold != null) && (ths.mCurrentHousehold.CurrentMembers != null))
                        {
                            msg += "C";

                            int count = ths.mCurrentHousehold.CurrentMembers.Count;
                            for (int i = 0x0; i < count; i++)
                            {
                                msg += "D";

                                Household.Member member = ths.mCurrentHousehold.CurrentMembers[i];
                                SimInfo          item   = ths.CreateSimInfo(member.mSimDescription);
                                if (item != null)
                                {
                                    msg += "E";

                                    ths.mSimList.Add(item);
                                }
                            }
                            ths.mSimList.Sort();
                        }
                    }

                    /*
                     * switch (householdEvent)
                     * {
                     *  case Sims3.Gameplay.CAS.HouseholdEvent.kSimAdded:
                     *      ths.HouseholdChanged(HouseholdEvent.SimAdded, actor.ObjectId);
                     *      break;
                     *
                     *  case Sims3.Gameplay.CAS.HouseholdEvent.kSimRemoved:
                     *      ths.HouseholdChanged(HouseholdEvent.SimRemoved, actor.ObjectId);
                     *      break;
                     * }
                     */
                }
                ths.UpdateHouseholdThumb();
            }
            catch (Exception e)
            {
                Common.Exception(msg, e);
            }
            finally
            {
                Common.DebugNotify(msg);
            }
        }
Пример #18
0
        public void Build(PawnModel model)
        {
            var widget = HudModel.GetWidget(model, _type, _defName);

            Widget = IsTargetted(model) ? widget : HudBlank.Get(widget.Height);
        }
Пример #19
0
        public static bool Perform(SimDescription sim, bool cleanse)
        {
            if (sim == null)
            {
                return(false);
            }

            Common.StringBuilder msg = new Common.StringBuilder("Perform" + Common.NewLine);

            Household house = sim.Household;

            try
            {
                Sim createdSim = sim.CreatedSim;

                if (createdSim != null)
                {
                    createdSim.ReservedVehicle = null;
                }

                if (PetAdoption.sNeighborAdoption != null)
                {
                    if (PetAdoption.sNeighborAdoption.mMother == sim)
                    {
                        try
                        {
                            PetAdoption.ResetNeighborAdoption();
                        }
                        catch (Exception e)
                        {
                            Common.Exception(sim, e);
                        }
                        finally
                        {
                            PetAdoption.sNeighborAdoption = null;
                        }
                    }
                    else
                    {
                        PetAdoption.sNeighborAdoption.mPetsToAdopt.Remove(sim);
                    }
                }

                foreach (Service service in Services.AllServices)
                {
                    try
                    {
                        if (service == null)
                        {
                            continue;
                        }

                        msg += Common.NewLine + "Service: " + service.GetType();

                        if (sim.CreatedSim != null)
                        {
                            service.RemoveAssignment(sim.CreatedSim);
                        }

                        service.RemovePreferredSim(sim);

                        service.mPool.Remove(sim);

                        ResortWorker resortWorker = service as ResortWorker;
                        if (resortWorker != null)
                        {
                            if (resortWorker.mWorkerInfo != null)
                            {
                                List <ObjectGuid> remove = new List <ObjectGuid>();

                                foreach (KeyValuePair <ObjectGuid, ResortWorker.WorkerInfo> info in resortWorker.mWorkerInfo)
                                {
                                    if ((info.Value.CurrentSimDescriptionID == sim.SimDescriptionId) ||
                                        (info.Value.DesiredSimDescriptionID == sim.SimDescriptionId))
                                    {
                                        remove.Add(info.Key);
                                    }
                                }

                                foreach (ObjectGuid rem in remove)
                                {
                                    resortWorker.mWorkerInfo[rem] = new ResortWorker.WorkerInfo();
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception(sim, null, msg, e);
                    }
                }

                msg += Common.NewLine + "A";

                List <Household> houses = new List <Household>();
                if (house != null)
                {
                    houses.Add(house);
                }

                foreach (Household check in Household.sHouseholdList)
                {
                    if (check == house)
                    {
                        continue;
                    }

                    if (check.Contains(sim))
                    {
                        houses.Add(check);
                    }
                }

                foreach (Household remove in houses)
                {
                    Household.HouseholdSimsChangedCallback changedCallback = null;

                    try
                    {
                        changedCallback             = remove.HouseholdSimsChanged;
                        remove.HouseholdSimsChanged = null;

                        remove.Remove(sim, !remove.IsSpecialHousehold);
                    }
                    finally
                    {
                        remove.HouseholdSimsChanged = changedCallback;
                    }
                }

                msg += Common.NewLine + "B";

                try
                {
                    if (cleanse)
                    {
                        if (sim.LifeEventManager != null)
                        {
                            sim.LifeEventManager.Purge();
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(sim, null, msg, e);
                }

                msg += Common.NewLine + "C";

                RemoveSimDescriptionRelationships(sim);

                msg += Common.NewLine + "D";

                PetPoolManager.RemoveIdFromPool(sim.SimDescriptionId);

                msg += Common.NewLine + "E";

                try
                {
                    if (sim.CareerManager != null)
                    {
                        sim.CareerManager.LeaveAllJobs(Career.LeaveJobReason.kDied);
                    }
                }
                catch (Exception e)
                {
                    sim.CareerManager.mJob    = null;
                    sim.CareerManager.mSchool = null;

                    Common.Exception(sim, null, msg, e);
                }

                msg += Common.NewLine + "F";

                if (sim.CASGenealogy == null)
                {
                    // Necessary to stop an error in MidLifeCrisisManager
                    sim.mGenealogy = new Genealogy(sim);
                }

                msg += Common.NewLine + "G";

                try
                {
                    if (sim.Partner != null)
                    {
                        sim.Partner.Partner = null;
                    }

                    sim.Partner = null;
                }
                catch (Exception e)
                {
                    Common.Exception(sim, null, msg, e);
                }

                msg += Common.NewLine + "H";

                if (sim.DeathStyle != SimDescription.DeathType.None)
                {
                    // Passing in a household can invoke the social worker, so don't bother
                    Urnstone.FinalizeSimDeath(sim, null /*house*/);
                }

                msg += Common.NewLine + "I";

                Urnstone urnstone = Urnstones.FindGhostsGrave(sim);

                msg += Common.NewLine + "J";

                if ((cleanse) && (urnstone != null))
                {
                    if (urnstone.InInventory)
                    {
                        Inventory inventory = Inventories.ParentInventory(urnstone);
                        if (inventory != null)
                        {
                            inventory.RemoveByForce(urnstone);
                        }
                    }

                    if (urnstone.DeadSimsDescription != null)
                    {
                        urnstone.DeadSimsDescription.Fixup();
                    }

                    try
                    {
                        urnstone.Dispose();
                    }
                    catch (Exception e)
                    {
                        Common.DebugException(sim, null, msg, e);
                    }

                    urnstone.Destroy();
                }

                msg += Common.NewLine + "K";

                if ((FakeMetaAutonomy.Instance != null) && (FakeMetaAutonomy.Instance.mPool != null))
                {
                    FakeMetaAutonomy.Instance.mPool.Remove(sim);
                }

                msg += Common.NewLine + "L";

                if (Sims3.Gameplay.Services.FakeMetaAutonomy.mToDestroy != null)
                {
                    Sims3.Gameplay.Services.FakeMetaAutonomy.mToDestroy.Remove(sim);
                }

                msg += Common.NewLine + "M";

                if ((houses.Contains(Household.ActiveHousehold)) && (sim.CreatedSim != null))
                {
                    HudModel model = HudController.Instance.Model as HudModel;

                    foreach (SimInfo info in model.mSimList)
                    {
                        if (info.mGuid == sim.CreatedSim.ObjectId)
                        {
                            model.RemoveSimInfo(info);
                            model.mSimList.Remove(info);
                            break;
                        }
                    }
                }

                msg += Common.NewLine + "N";

                try
                {
                    if (sim.AssignedRole != null)
                    {
                        sim.AssignedRole.RemoveSimFromRole();
                    }
                }
                catch (Exception e)
                {
                    Common.DebugException(sim, null, msg, e);

                    sim.AssignedRole = null;
                }

                msg += Common.NewLine + "O1";

                if ((CarNpcManager.Singleton != null) && (CarNpcManager.Singleton.NpcDriversManager != null))
                {
                    foreach (Stack <SimDescription> stack in CarNpcManager.Singleton.NpcDriversManager.mDescPools)
                    {
                        if (stack == null)
                        {
                            continue;
                        }

                        List <SimDescription> sims = new List <SimDescription>();

                        bool found = false;
                        foreach (SimDescription stackSim in stack)
                        {
                            if (stackSim == sim)
                            {
                                found = true;
                            }
                            else
                            {
                                sims.Add(stackSim);
                            }
                        }

                        if (found)
                        {
                            stack.Clear();

                            foreach (SimDescription stackSim in sims)
                            {
                                stack.Push(stackSim);
                            }
                        }
                    }
                }

                msg += Common.NewLine + "O2";

                if (cleanse)
                {
                    sim.Dispose();
                }

                msg += Common.NewLine + "P";

                if ((house != null) && (createdSim != null))
                {
                    house.OnMemberChanged(sim, createdSim);
                }
                return(true);
            }
            catch (Exception e)
            {
                Common.Exception(sim, null, msg, e);

                if (house != null)
                {
                    Household.HouseholdSimsChangedCallback changedCallback = null;

                    try
                    {
                        changedCallback            = house.HouseholdSimsChanged;
                        house.HouseholdSimsChanged = null;

                        house.Add(sim);
                    }
                    finally
                    {
                        house.HouseholdSimsChanged = changedCallback;
                    }
                }
                return(false);
            }
        }
Пример #20
0
        protected string SetTraits(SimDescription me, IEnumerable <SimTrait.Item> choices)
        {
            string result = Name + Common.NewLine + me.FullName;

            bool success = false;

            foreach (SimTrait.Item selection in choices)
            {
                if (me.TraitManager.HasElement(selection.Value))
                {
                    continue;
                }

                Trait selected = TraitManager.GetTraitFromDictionary(selection.Value);
                if (selected != null)
                {
                    if (!selected.TraitValidForAgeSpecies(CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(CASAgeGenderFlags.Adult | me.Species)))
                    {
                        continue;
                    }

                    if (me.mSpendableHappiness < selected.Score)
                    {
                        continue;
                    }

                    me.mSpendableHappiness -= selected.Score;

                    result += Common.NewLine + "  " + selected.TraitName(me.IsFemale);

                    success = true;

                    if (Traits.IsObjectBaseReward(selected.Guid))
                    {
                        if (me.Household == null)
                        {
                            continue;
                        }

                        if (me.CreatedSim == null)
                        {
                            continue;
                        }

                        HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel;
                        if (hudModel != null)
                        {
                            bool showTNS          = SimTypes.IsSelectable(me);
                            bool inHouseInventory = false;
                            Sim  rewardedSim      = me.CreatedSim;
                            hudModel.GiveRewardObjects(me.CreatedSim, selected.Guid, selected.ProductVersion, ref showTNS, ref inHouseInventory, ref rewardedSim);
                        }
                    }
                    else
                    {
                        switch (selected.Guid)
                        {
                        case TraitNames.ForeverYoung:
                            me.AgingEnabled = false;
                            break;

                        default:
                            if (selected.Guid == TraitNames.SuperVampire)
                            {
                                me.AgingEnabled = false;
                            }

                            if (!me.AddTrait(selected))
                            {
                                me.mSpendableHappiness += selected.Score;
                            }
                            break;
                        }
                    }
                }
            }

            if (!success)
            {
                result += Common.NewLine + "  " + Common.Localize(GetTitlePrefix() + ":None");
            }

            return(result);
        }
Пример #21
0
        public static List<KnownInfo> GetKnownInfo(HudModel ths, IMiniSimDescription simDesc)
        {
            if ((ths.mSavedCurrentSim != null) && (ths.mSavedCurrentSim.SimDescription != null) && (simDesc != null))
            {
                if (ths.mSavedCurrentSim.SimDescription == simDesc)
                {
                    return GetKnownInfoAboutSelf(ths, simDesc);
                }

                if (simDesc is SimDescription)
                {
                    if (ths.mSavedCurrentSim.SocialComponent != null)
                    {
                        foreach (Relationship relationship in ths.mSavedCurrentSim.SocialComponent.Relationships)
                        {
                            if (relationship == null) continue;

                            SimDescription otherSimDescription = relationship.GetOtherSimDescription(ths.mSavedCurrentSim.SimDescription);
                            if (otherSimDescription != simDesc) continue;

                            InformationLearnedAboutSim learnedInfo = relationship.InformationAbout(otherSimDescription);
                            return GetKnownInfoList(ths, otherSimDescription, learnedInfo);
                        }
                    }
                }
                else
                {
                    MiniSimDescription tsd = MiniSimDescription.Find(ths.mSavedCurrentSim.SimDescription.SimDescriptionId);
                    if (tsd != null)
                    {
                        foreach (MiniRelationship relationship in tsd.MiniRelationships)
                        {
                            if (relationship == null) continue;

                            if (relationship.SimDescriptionId != simDesc.SimDescriptionId) continue;

                            MiniSimDescription otherTsd = MiniSimDescription.Find(relationship.SimDescriptionId);
                            return relationship.GetKnownInfo(tsd, otherTsd);
                        }
                    }
                }
            }

            return new List<KnownInfo>();
        }
Пример #22
0
        public static List<KnownInfo> GetKnownInfoList(HudModel ths, SimDescription otherSimDesc, InformationLearnedAboutSim learnedInfo)
        {
            List<KnownInfo> list = new List<KnownInfo>();

            Common.StringBuilder msg = new Common.StringBuilder("GetKnownInfoList" + Common.NewLine);

            try
            {
                if (otherSimDesc != null)
                {
                    bool isHuman = otherSimDesc.IsHuman;
                    bool isTeen = (otherSimDesc.Age & CASAgeGenderFlags.Teen) != CASAgeGenderFlags.None;
                    bool isChild = (otherSimDesc.Age & CASAgeGenderFlags.Child) != CASAgeGenderFlags.None;
                    string str = Localization.LocalizeString("Ui/Caption/HUD/RelationshipsPanel:UnknownTrait", new object[0x0]);

                    msg += "A";

                    foreach (Trait trait in otherSimDesc.TraitManager.List)
                    {
                        if (!trait.IsVisible || !Localization.HasLocalizationString(trait.TraitNameInfo))
                        {
                            continue;
                        }
                        bool flag4 = false;
                        foreach (TraitNames names in learnedInfo.Traits)
                        {
                            if (trait.Guid == names)
                            {
                                list.Add(new KnownInfo(trait.TraitName(otherSimDesc.IsFemale), trait.IconKey, KnownInfoType.Trait));
                                flag4 = true;
                                break;
                            }
                        }
                        if (!flag4)
                        {
                            list.Add(new KnownInfo(str, ResourceKey.CreatePNGKey("trait_unknown", 0x0), KnownInfoType.TraitUnknown));
                        }
                    }

                    msg += "B";

                    if ((isHuman && learnedInfo.CareerKnown) && !isChild)
                    {
                        bool flag5 = false;
                        WorldName currentWorld = GameUtils.GetCurrentWorld();
                        if ((otherSimDesc.HomeWorld != currentWorld) && (GameUtils.GetWorldType(currentWorld) == WorldType.Vacation))
                        {
                            MiniSimDescription description = MiniSimDescription.Find(otherSimDesc.SimDescriptionId);
                            if (description != null)
                            {
                                ResourceKey iconKey = string.IsNullOrEmpty(description.JobIcon) ? ResourceKey.kInvalidResourceKey : ResourceKey.CreatePNGKey(description.JobIcon, 0x0);
                                list.Add(new KnownInfo(Localization.LocalizeString(description.IsFemale, description.JobOrServiceName, new object[0x0]), iconKey, KnownInfoType.Career));
                                flag5 = true;
                            }
                        }

                        msg += "C";

                        if (!flag5)
                        {
                            CareerManager careerManager = otherSimDesc.CareerManager;
                            if ((careerManager != null) && (careerManager.Occupation != null))
                            {
                                msg += "C1";

                                Occupation occupation = careerManager.Occupation;
                                string careerIcon = occupation.CareerIcon;
                                ResourceKey key2 = string.IsNullOrEmpty(careerIcon) ? ResourceKey.kInvalidResourceKey : ResourceKey.CreatePNGKey(careerIcon, 0x0);
                                KnownInfoType type = occupation.IsAcademicCareer ? KnownInfoType.AcademicCareer : KnownInfoType.Career;
                                list.Add(new KnownInfo(occupation.CurLevelJobTitle, key2, type));
                            }
                            else if ((otherSimDesc.CreatedByService != null) && Sims3.Gameplay.Services.Services.IsSimDescriptionInAnyServicePool(otherSimDesc))
                            {
                                string str4 = Localization.LocalizeString(otherSimDesc.IsFemale, "Gameplay/Services/Title:" + otherSimDesc.CreatedByService.ServiceType.ToString(), new object[0x0]);
                                list.Add(new KnownInfo(str4, ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                            }
                            else if ((otherSimDesc.AssignedRole != null) && !string.IsNullOrEmpty(otherSimDesc.AssignedRole.CareerTitleKey))
                            {
                                list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, otherSimDesc.AssignedRole.CareerTitleKey, new object[0x0]), ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                            }
                            else if (((careerManager != null) && (careerManager.Occupation == null)) && (careerManager.RetiredCareer != null))
                            {
                                list.Add(new KnownInfo(Localization.LocalizeString("Ui/Caption/HUD/Career:Retired", new object[0x0]), ResourceKey.CreatePNGKey(careerManager.RetiredCareer.CareerIcon, 0x0), KnownInfoType.Career));
                            }
                            else
                            {
                                list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:Unemployed", new object[0x0]), ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                            }
                        }
                    }

                    msg += "D";

                    if (learnedInfo.PartnerKnown)
                    {
                        string firstName = null;
                        ResourceKey relationshipImageKey = ResourceKey.kInvalidResourceKey;
                        if (otherSimDesc.Partner != null)
                        {
                            msg += "D1";

                            firstName = otherSimDesc.Partner.FirstName;

                            // Custom : false -> true
                            Relationship relationship = otherSimDesc.GetRelationship(otherSimDesc.Partner, true);
                            if (relationship != null)
                            {
                                relationshipImageKey = RelationshipFunctions.GetLTRRelationshipImageKey(relationship.LTR.CurrentLTR, relationship.IsPetToPetRelationship);
                            }
                        }
                        else
                        {
                            msg += "D2";

                            if (otherSimDesc.HomeWorld != GameUtils.GetCurrentWorld())
                            {
                                MiniSimDescription description2 = MiniSimDescription.Find(otherSimDesc.SimDescriptionId);
                                if ((description2 != null) && (description2.PartnerId != 0x0L))
                                {
                                    MiniSimDescription otherSim = MiniSimDescription.Find(description2.PartnerId);
                                    if (otherSim != null)
                                    {
                                        firstName = otherSim.FirstName;
                                        MiniRelationship miniRelationship = description2.GetMiniRelationship(otherSim) as MiniRelationship;
                                        if (miniRelationship != null)
                                        {
                                            relationshipImageKey = RelationshipFunctions.GetLTRRelationshipImageKey(miniRelationship.CurrentLTR, miniRelationship.IsPetToPetRelationship);
                                        }
                                    }
                                }
                            }

                            if (string.IsNullOrEmpty(firstName))
                            {
                                firstName = Localization.LocalizeString("Ui/Caption/HUD/KnownInfoDialog:None", new object[0x0]);
                            }
                        }
                        list.Add(new KnownInfo(firstName, relationshipImageKey, KnownInfoType.Partner));
                    }

                    msg += "E";

                    if ((isHuman && (isTeen || isChild)) && ((otherSimDesc.CareerManager != null) && (otherSimDesc.CareerManager.School != null)))
                    {
                        list.Add(new KnownInfo(otherSimDesc.CareerManager.School.Name, ResourceKey.CreatePNGKey(otherSimDesc.CareerManager.School.CareerIcon, 0x0), KnownInfoType.School));
                    }

                    if (learnedInfo.IsRichAndKnownToBeRich)
                    {
                        list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:IsRich", new object[0x0]), ResourceKey.CreatePNGKey("w_simoleon_32", 0x0), KnownInfoType.Rich));
                    }

                    if (isHuman && learnedInfo.SignKnown)
                    {
                        Zodiac zodiac = otherSimDesc.Zodiac;
                        list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:" + zodiac.ToString(), new object[0x0]), ResourceKey.CreatePNGKey("sign_" + zodiac.ToString() + "_sm", 0x0), KnownInfoType.Zodiac));
                    }

                    if (isHuman && learnedInfo.AlmaMaterKnown)
                    {
                        if (otherSimDesc.AlmaMater != AlmaMater.None)
                        {
                            list.Add(new KnownInfo(otherSimDesc.AlmaMaterName, ResourceKey.CreatePNGKey("w_simple_school_career_s", 0), KnownInfoType.AlmaMater));
                        }
                        if (((otherSimDesc.CareerManager != null) && (otherSimDesc.CareerManager.DegreeManager != null)) && (otherSimDesc.CareerManager.DegreeManager.GetDegreeEntries().Count > 0))
                        {
                            list.Add(new KnownInfo(Localization.LocalizeString("Ui/Caption/HUD/KnownInfoTooltip:UniversityAlmaMater", new object[0]), ResourceKey.CreatePNGKey("moodlet_just_graduated", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.AlmaMater));
                        }
                    }

                    msg += "G";

                    uint celebrityLevel = otherSimDesc.CelebrityLevel;
                    if (celebrityLevel > 0x0)
                    {
                        KnownInfo item = new KnownInfo(otherSimDesc.CelebrityManager.LevelName, ResourceKey.CreatePNGKey("hud_i_celebrity_page", 0x0), KnownInfoType.CelebrityLevel);
                        item.mCelebrityLevel = celebrityLevel;
                        list.Add(item);
                    }

                    msg += "H";

                    if (learnedInfo.IsSocialGroupsKnown)
                    {
                        TraitManager traitManager = otherSimDesc.TraitManager;
                        SkillManager skillManager = otherSimDesc.SkillManager;
                        if ((traitManager != null) && (skillManager != null))
                        {
                            if (traitManager.HasElement(TraitNames.InfluenceNerd))
                            {
                                InfluenceSkill skill = skillManager.GetSkill<InfluenceSkill>(SkillNames.InfluenceNerd);
                                if ((skill != null) && (skill.SkillLevel > 0))
                                {
                                    list.Add(new KnownInfo(string.Concat(new object[] { Localization.LocalizeString("Ui/Tooltips/SocialGroup:Nerd", new object[0]), "(", skill.SkillLevel, ")" }), ResourceKey.CreatePNGKey("trait_SocialGroup01_s", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.SocialGroup));
                                }
                            }
                            if (traitManager.HasElement(TraitNames.InfluenceSocialite))
                            {
                                InfluenceSkill skill2 = skillManager.GetSkill<InfluenceSkill>(SkillNames.InfluenceSocialite);
                                if ((skill2 != null) && (skill2.SkillLevel > 0))
                                {
                                    list.Add(new KnownInfo(string.Concat(new object[] { Localization.LocalizeString("Ui/Tooltips/SocialGroup:Jock", new object[0]), "(", skill2.SkillLevel, ")" }), ResourceKey.CreatePNGKey("trait_SocialGroup03_s", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.SocialGroup));
                                }
                            }
                            if (traitManager.HasElement(TraitNames.InfluenceRebel))
                            {
                                InfluenceSkill skill3 = skillManager.GetSkill<InfluenceSkill>(SkillNames.InfluenceRebel);
                                if ((skill3 != null) && (skill3.SkillLevel > 0))
                                {
                                    list.Add(new KnownInfo(string.Concat(new object[] { Localization.LocalizeString("Ui/Tooltips/SocialGroup:Rebel", new object[0]), "(", skill3.SkillLevel, ")" }), ResourceKey.CreatePNGKey("trait_SocialGroup02_s", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.SocialGroup));
                                }
                            }
                        }
                    }

                    msg += "I";

                    if (learnedInfo.NumDegreesKnown() > 0)
                    {
                        KnownInfo info2 = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                        otherSimDesc.CareerManager.DegreeManager.GetCompletedDegreeEntries();
                        foreach (AcademicDegreeNames names2 in learnedInfo.Degrees)
                        {
                            AcademicDegree element = otherSimDesc.CareerManager.DegreeManager.GetElement(names2);
                            if ((element != null) && element.IsDegreeCompleted)
                            {
                                if (info2.mDegreeIcons.Count == 5)
                                {
                                    list.Add(info2);
                                    info2 = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                                }
                                ResourceKey key4 = ResourceKey.CreatePNGKey(element.DegreeIcon, 0);
                                info2.mDegreeIcons.Add(key4);
                                info2.mIconKey = key4;
                                info2.mInfo = element.DegreeName;
                            }
                        }
                        list.Add(info2);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(otherSimDesc, null, msg, e);
            }

            return list;
        }
Пример #23
0
        public static List<KnownInfo> GetKnownInfoAboutSelf(HudModel ths, IMiniSimDescription simDescription)
        {
            List<KnownInfo> infos = new List<KnownInfo>();
            SimDescription description = simDescription as SimDescription;
            if (description != null)
            {
                string firstName;
                bool isHuman = description.IsHuman;
                bool teen = (description.Age & CASAgeGenderFlags.Teen) != CASAgeGenderFlags.None;
                bool child = (description.Age & CASAgeGenderFlags.Child) != CASAgeGenderFlags.None;
                foreach (Trait trait in description.TraitManager.List)
                {
                    if (trait.IsVisible && Localization.HasLocalizationString(trait.TraitNameInfo))
                    {
                        infos.Add(new KnownInfo(trait.TraitName(description.IsFemale), trait.IconKey, KnownInfoType.Trait));
                    }
                }

                if (isHuman && !child)
                {
                    if (GameUtils.GetCurrentWorld() != description.HomeWorld)
                    {
                        MiniSimDescription description2 = MiniSimDescription.Find(description.SimDescriptionId);
                        if (description2 != null)
                        {
                            description2.GetKnownJobInfo(infos);
                        }
                    }
                    else if ((description.CareerManager != null) && (description.CareerManager.Occupation != null))
                    {
                        infos.Add(new KnownInfo(description.CareerManager.Occupation.CurLevelJobTitle, ResourceKey.CreatePNGKey(description.CareerManager.Occupation.CareerIcon, 0), KnownInfoType.Career));
                    }
                    else if (description.CreatedByService != null)
                    {
                        string str2 = Localization.LocalizeString(description.IsFemale, "Gameplay/Services/Title:" + description.CreatedByService.ServiceType.ToString(), new object[0]);
                        infos.Add(new KnownInfo(str2, ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                    }
                    else
                    {
                        infos.Add(new KnownInfo(Localization.LocalizeString(description.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:Unemployed", new object[0]), ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                    }
                }

                ResourceKey kInvalidResourceKey = ResourceKey.kInvalidResourceKey;
                if (description.Partner != null)
                {
                    firstName = description.Partner.FirstName;
                    Relationship relationship = description.GetRelationship(description.Partner, false);

                    // Custom
                    if (relationship != null)
                    {
                        kInvalidResourceKey = RelationshipFunctions.GetLTRRelationshipImageKey(relationship.LTR.CurrentLTR, relationship.IsPetToPetRelationship);
                    }
                }
                else
                {
                    firstName = Localization.LocalizeString("Ui/Caption/HUD/KnownInfoDialog:None", new object[0]);
                }

                infos.Add(new KnownInfo(firstName, kInvalidResourceKey, KnownInfoType.Partner));
                if ((isHuman && (teen || child)) && ((description.CareerManager != null) && (description.CareerManager.School != null)))
                {
                    infos.Add(new KnownInfo(description.CareerManager.School.Name, ResourceKey.CreatePNGKey(description.CareerManager.School.CareerIcon, 0), KnownInfoType.School));
                }

                if (GameUtils.IsInstalled(ProductVersion.EP9))
                {
                    List<IDegreeEntry> completedDegreeEntries = description.CareerManager.DegreeManager.GetCompletedDegreeEntries();
                    if (completedDegreeEntries.Count > 0)
                    {
                        KnownInfo item = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                        foreach (IDegreeEntry entry in completedDegreeEntries)
                        {
                            if (item.mDegreeIcons.Count == 5)
                            {
                                infos.Add(item);
                                item = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                            }
                            item.mDegreeIcons.Add(ResourceKey.CreatePNGKey(entry.DegreeIcon, 0));
                        }
                        infos.Add(item);
                    }
                }

                if (description.IsRich)
                {
                    infos.Add(new KnownInfo(Localization.LocalizeString(description.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:IsRich", new object[0]), ResourceKey.CreatePNGKey("w_simoleon_32", 0), KnownInfoType.Rich));
                }
                return infos;
            }

            MiniSimDescription description3 = simDescription as MiniSimDescription;
            if (description3 != null)
            {
                infos = description3.GetKnownInfoOfSelf();
            }
            return infos;
        }
Пример #24
0
        public override bool Run()
        {
            try
            {
                if (!Target.RouteToCan(Actor, true))
                {
                    return(false);
                }
                StateMachineClient stateMachine = Target.GetStateMachine(Actor, false);
                stateMachine.AddOneShotScriptEventHandler(0x65, Target.EventCallbackRemoveLid);
                stateMachine.AddOneShotScriptEventHandler(0x66, Target.EventCallbackAddLid);

                Trashcan target = Target as Trashcan;
                if (target != null)
                {
                    mLidGuid = target.SetupLidProp(stateMachine);
                }

                IFairyBoobyTrap trap = Target as IFairyBoobyTrap;
                if (((trap != null) && ((trap.BoobyTrapComponent != null) ? trap.BoobyTrapComponent.CanTriggerTrap(Actor.SimDescription) : false)) && trap.TriggerTrap(Actor))
                {
                    TrashcanOutside outsideCan = Target as TrashcanOutside;
                    if (outsideCan != null)
                    {
                        TrashPile.CreateFairyTrapTrashPiles(outsideCan);
                    }
                    return(false);
                }

                StandardEntry();
                BeginCommodityUpdates();

                try
                {
                    if (!Autonomous)
                    {
                        Target.HasBeenRummagedByPlayer = true;
                    }
                    Target.SetRummagingSim(Actor);
                    Target.RummageBroadcasterCreate();
                    stateMachine.RequestState("x", "LoopRummage");
                    if ((!Autonomous && (HudController.InfoState != InfoState.Inventory)) && Actor.IsActiveSim)
                    {
                        HudController.SetInfoState(InfoState.Inventory);
                    }
                    mNetWorth = Target.LotCurrent.Household.NetWorth();
                    DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), LoopDel, stateMachine);
                    Target.RummageBroadcasterDestroy();
                    stateMachine.RequestState("x", "Exit");
                    if (!Autonomous)
                    {
                        HudModel.OpenObjectInventoryForOwner(null);
                    }
                }
                finally
                {
                    EndCommodityUpdates(true);
                }

                BuffInstance element = Actor.BuffManager.GetElement(BuffNames.Smelly);
                if (element != null)
                {
                    element.mBuffOrigin = Origin.FromDumpsterDiving;
                }
                StandardExit();
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Пример #25
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);
            }
        }
Пример #26
0
        protected static void LunarUpdate(bool change)
        {
            HudModel model = Sims3.UI.Responder.Instance.HudModel as HudModel;

            LunarCycleManager.LunarPhase[] choices = null;

            uint result;

            OptionsModel.GetOptionSetting("EnableLunarPhase", out result);
            if (result == 0x0)
            {
                choices = GetCycle();

                if (change)
                {
                    Overwatch.Settings.mCurrentPhaseIndex++;
                }

                if (Overwatch.Settings.mCurrentPhaseIndex >= choices.Length)
                {
                    Overwatch.Settings.mCurrentPhaseIndex = 0;
                }

                World.ForceLunarPhase((int)choices[Overwatch.Settings.mCurrentPhaseIndex]);
            }

            LunarCycleManager.LunarPhase phase = (LunarCycleManager.LunarPhase)World.GetLunarPhase();
            if (phase != LunarCycleManager.LunarPhase.kFullMoon)
            {
                if ((LunarCycleManager.sFullMoonZombies == null) || (LunarCycleManager.sFullMoonZombies.Count == 0))
                {
                    foreach (Sim sim in LotManager.Actors)
                    {
                        if (sim.LotHome != null)
                        {
                            continue;
                        }

                        if (sim.BuffManager == null)
                        {
                            continue;
                        }

                        sim.BuffManager.RemoveElement(BuffNames.Zombie);
                    }
                }

                OnDewolf(false);
            }
            else
            {
                new Common.AlarmTask(Common.AlarmTask.TimeTo(World.GetSunriseTime()), TimeUnit.Hours, OnDewolf);
            }

            EventTracker.SendEvent(new MoonRiseEvent((uint)World.GetLunarPhase()));
            if (model.LunarUpdate != null)
            {
                model.LunarUpdate((uint)World.GetLunarPhase());
            }

            if (Overwatch.Settings.mDisableFullMoonLighting)
            {
                if (LunarCycleManager.mLunarEffectsAlarm != AlarmHandle.kInvalidHandle)
                {
                    AlarmManager.Global.RemoveAlarm(LunarCycleManager.mLunarEffectsAlarm);
                    LunarCycleManager.mLunarEffectsAlarm = AlarmHandle.kInvalidHandle;
                }
            }

            foreach (MoonDial dial in Sims3.Gameplay.Queries.GetObjects <MoonDial>())
            {
                try
                {
                    if (dial.mLunarFXLookUp.Length > Overwatch.Settings.mCurrentPhaseIndex)
                    {
                        dial.StartLunarFX(dial.mLunarFXLookUp[Overwatch.Settings.mCurrentPhaseIndex]);
                    }
                }
                catch
                { }
            }

            if (choices != null)
            {
                SimDisplay display = SimDisplay.Instance;
                if (display != null)
                {
                    int numDaysUntilFullMoon = 0;

                    int index = Overwatch.Settings.mCurrentPhaseIndex;
                    while ((choices[index] != LunarCycleManager.LunarPhase.kFullMoon) && (numDaysUntilFullMoon < choices.Length))
                    {
                        numDaysUntilFullMoon++;
                        index++;
                        if (index >= choices.Length)
                        {
                            index = 0;
                        }
                    }

                    if (display.mLunarCycleIcon != null)
                    {
                        string entryKey = "UI/LunarCycle:MoonString" + ((uint)World.GetLunarPhase() + 0x1);
                        display.mLunarCycleIcon.TooltipText = Common.LocalizeEAString(entryKey);

                        if (numDaysUntilFullMoon > 0x0)
                        {
                            display.mLunarCycleIcon.TooltipText = display.mLunarCycleIcon.TooltipText + "\n";
                            display.mLunarCycleIcon.TooltipText = display.mLunarCycleIcon.TooltipText + Common.LocalizeEAString(false, "UI/LunarCycle:NextFullMoon", new object[] { numDaysUntilFullMoon });
                        }
                    }
                }
            }
        }