protected static bool NeedsFixup(ActiveNodeBase node) { ActiveDreamNode dreamNode = node as ActiveDreamNode; if (dreamNode != null) { if (dreamNode.NodeInstance == null) { return(true); } } else { ActiveTimerNode timerNode = node as ActiveTimerNode; if (timerNode != null) { if (timerNode.NodeInstance == null) { return(true); } } } return(false); }
protected override bool PrivateAllow(SimDescription me) { if (!base.PrivateAllow(me)) { return(false); } if (me.CreatedSim == null) { return(false); } if (me.CreatedSim.DreamsAndPromisesManager == null) { return(false); } ActiveDreamNode node = me.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode; if (node == null) { return(false); } return(true); }
public static string GetName(SimDescription sim) { DreamNodeInstance instance = null; DreamsAndPromisesManager.sMajorWishes.TryGetValue(sim.LifetimeWish, out instance); string name = null; if (instance != null) { string sKey = instance.MaleNameKey; if (sim.IsFemale) { sKey = instance.FemaleNameKey; } if (!Localization.GetLocalizedString(sKey, out name)) { name = instance.GetMajorWishName(sim); } if ((sim.CreatedSim != null) && (sim.CreatedSim.DreamsAndPromisesManager != null)) { ActiveDreamNode node = sim.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode; if (node != null) { name = node.Name; } } } return(name); }
protected override bool Run(SimDescription me, bool singleSelection) { Sim sim = me.CreatedSim; if (sim == null) { return(false); } ActiveDreamNode node = sim.DreamsAndPromisesManager.LifetimeWishNode; if (node == null) { return(false); } float value = node.InternalCount; if (!ApplyAll) { string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", me.IsFemale, new object[] { me }), value.ToString(), 256, StringInputDialog.Validation.None); if (string.IsNullOrEmpty(text)) { return(false); } mCount = 0; if (!float.TryParse(text, out mCount)) { SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error")); return(false); } } node.InternalCount += mCount; return(true); }
public static bool OnCompletion(ActiveDreamNode ths) { DreamsAndPromisesManager manager = null; if (ths.Owner != null) { manager = ths.Owner.DreamsAndPromisesManager; } if (manager == null) return false; // Changed if ((ths.IsPromised) || ((manager.mDisplayedDreamNodes != null) && (manager.mDisplayedDreamNodes.Contains(ths)))) { bool wasMajorDream = false; try { if (ths.IsMajorWish && !ths.mOwner.SimDescription.HasCompletedLifetimeWish) { wasMajorDream = true; ths.mOwner.SimDescription.HasCompletedLifetimeWish = true; ths.mOwner.BuffManager.AddElement(BuffNames.Fulfilled, DreamsAndPromisesManager.kVeryFulfilledMoodValue, DreamsAndPromisesManager.kVeryFulfilledDuration, Origin.FromLifetimeWish); (ths.mOwner.BuffManager.GetElement(BuffNames.Fulfilled) as BuffFulfilled.BuffInstanceFulfilled).SetVeryFulfilledText(); } else { BuffFulfilled.BuffInstanceFulfilled element = ths.mOwner.BuffManager.GetElement(BuffNames.Fulfilled) as BuffFulfilled.BuffInstanceFulfilled; if (element != null) { float num = element.mBuff.EffectValue + (BuffFulfilled.kFulfilledBuffStackTimes * BuffFulfilled.kFulfilledBuffStackMoodValue); if (element.mEffectValue < num) { ths.mOwner.BuffManager.AddElement(BuffNames.Fulfilled, (int)(element.mEffectValue + BuffFulfilled.kFulfilledBuffStackMoodValue), Origin.FromCompletingPromisedWish); } } else { ths.mOwner.BuffManager.AddElement(BuffNames.Fulfilled, Origin.FromCompletingPromisedWish); } } } catch(Exception e) { Common.DebugException(ths.Owner, e); } // Changed manager.RemoveDisplayedPromiseNode(ths); if (DreamsAndPromisesManager.IsMLCrisisDream(ths)) { MidlifeCrisisManager.MidlifeCrisisPromiseCompleted(ths.Owner.SimDescription); MidlifeCrisisManager.UpdateCrisisType(ths.Owner.SimDescription); } if (ths.IsPromised) { if ((manager == DreamsAndPromisesManager.ActiveDreamsAndPromisesManager) && (DreamsAndPromisesModel.Singleton != null)) { DreamsAndPromisesModel.Singleton.FireFulfillPromise(ths); } } float achievementPoints = ths.AchievementPoints; if (ths.mOwner.BuffManager.HasElement(BuffNames.WishMaster)) { achievementPoints *= DreamsAndPromisesManager.kWishMasterMultiple; } SimDescriptionEx.IncrementLifetimeHappiness(ths.Owner.SimDescription, achievementPoints); if (!Responder.Instance.EditTownModel.IsLoading) { manager.PopRewardEffect(achievementPoints, wasMajorDream); } if (wasMajorDream) { if (ths.Owner.IsEP11Bot) { if ((ths.Owner.SimDescription.TraitChipManager != null) && ths.Owner.SimDescription.TraitChipManager.HasElement(11L)) { ths.Owner.ShowTNSIfSelectable(Localization.LocalizeString(ths.Owner.IsFemale, "Gameplay/DreamsAndPromises/DreamsAndPromisesManager:LifetimeWishSuccessTNS", new object[] { ths.Owner }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, ths.Owner.ObjectId); } } else { ths.Owner.ShowTNSIfSelectable(Localization.LocalizeString(ths.Owner.IsFemale, "Gameplay/DreamsAndPromises/DreamsAndPromisesManager:LifetimeWishSuccessTNS", new object[] { ths.Owner }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, ths.Owner.ObjectId); } } EventTracker.SendEvent(new DreamEvent(EventTypeId.kPromisedDreamCompleted, ths, true)); } return true; }
public static void Update(DreamsAndPromisesManager ths) { if (!ths.mFullUpdate) { PartialUpdate(ths); } else { ths.mFullUpdate = false; float num = SimClock.ElapsedTime(TimeUnit.Minutes); float simMinutesPassed = num - ths.mLastUpdateTime; ths.mLastUpdateTime = num; Dictionary <Event, List <DreamsAndPromisesManager.ScoredNode> > completedNodes = new Dictionary <Event, List <DreamsAndPromisesManager.ScoredNode> >(); List <ActiveNodeBase> timeoutList = new List <ActiveNodeBase>(); List <ActiveNodeBase> completedList = new List <ActiveNodeBase>(); foreach (ActiveNodeBase base2 in new List <ActiveNodeBase>(ths.mActiveNodes)) { if (DreamerTuning.kNoTimeOut) { ActiveDreamNode node = base2 as ActiveDreamNode; if (node != null) { node.mTimeActive = 0; } } try { switch (base2.Update(simMinutesPassed)) { case ActiveNodeBase.UpdateStatus.TimedOut: timeoutList.Add(base2); break; case ActiveNodeBase.UpdateStatus.Completed: { ActiveDreamNode node = base2 as ActiveDreamNode; if (((node != null) && (node.CompletionEvent != null)) && !completedNodes.ContainsKey(node.CompletionEvent)) { completedNodes.Add(node.CompletionEvent, new List <DreamsAndPromisesManager.ScoredNode>()); } completedList.Add(base2); break; } } } catch (Exception e) { Common.Exception(ths.Actor, e); ths.RemoveActiveNode(base2); } } ths.RetestVisibleNodes(timeoutList, completedList); foreach (ActiveNodeBase base3 in completedList) { List <DreamsAndPromisesManager.ScoredNode> list3; if ((base3.PromiseParent != null) && (base3.PromiseParent.WasPromisedAndBroken || base3.PromiseParent.IsComplete)) { continue; } ActiveDreamNode node2 = base3 as ActiveDreamNode; if (((node2 == null) || (node2.CompletionEvent == null)) || !completedNodes.TryGetValue(node2.CompletionEvent, out list3)) { list3 = new List <DreamsAndPromisesManager.ScoredNode>(); completedNodes.Add(new Event(EventTypeId.kEventNone), list3); } if (node2 != null) { ths.RemoveCompletedNode(node2); } try { list3.AddRange(ths.ScoreChildren(base3, completedNodes, false, base3.GetNonPromiseLinkChildren())); } catch (Exception e) { Common.DebugException(ths.Actor, e); } } bool flag = ths.SelectDreamsToDisplay(completedNodes); foreach (ActiveNodeBase base4 in timeoutList) { ths.RemoveActiveNode(base4); flag = true; } List <ActiveDreamNode> list4 = new List <ActiveDreamNode>(); foreach (ActiveDreamNode node3 in ths.mSleepingNodes) { if (node3.UpdateSleeping(simMinutesPassed)) { node3.Reset(true); ths.mActiveNodes.Add(node3); ths.AddToReferenceList(node3); list4.Add(node3); } } foreach (ActiveDreamNode node4 in list4) { ths.mSleepingNodes.Remove(node4); } foreach (ActiveNodeBase base5 in completedList) { ActiveDreamNode node5 = base5 as ActiveDreamNode; ActiveTimerNode node6 = base5 as ActiveTimerNode; bool flag2 = true; if (node5 != null) { if (!ActiveDreamNodeEx.OnCompletion(node5)) { flag2 = false; } else if ((node5.IsRepeatable) && (ths.IsNotSpecialCaseNode(node5.NodeInstance.PrimitiveId) && ((node5.DebugCompleteFlags & ActiveDreamNode.DebugCompleteReasons.kStartNode) == ActiveDreamNode.DebugCompleteReasons.kNone))) { if (node5.NodeInstance.TimeBetweenRepeats <= 0f) { ths.CancelDream(node5); node5.Reset(true); flag2 = false; } else { node5.Reset(false); ths.mSleepingNodes.Add(node5); } } } if ((node6 != null) && !node6.IsComplete) { flag2 = false; } if (flag2) { ths.RemoveActiveNode(base5); } } List <ActiveDreamNode> list5 = new List <ActiveDreamNode>(); foreach (ActiveDreamNode node7 in ths.mDreamNodes) { if (node7.TimeActive > node7.NodeInstance.DisplayTime) { list5.Add(node7); } } foreach (ActiveDreamNode node8 in list5) { if ((ths.mDisplayedDreamNodes.Remove(node8) && (ths == DreamsAndPromisesManager.ActiveDreamsAndPromisesManager)) && (DreamsAndPromisesModel.Singleton != null)) { DreamsAndPromisesModel.Singleton.FireRemoveDream(node8); } ths.mDreamNodes.Remove(node8); } if ((flag && (ths == DreamsAndPromisesManager.ActiveDreamsAndPromisesManager)) && (DreamsAndPromisesModel.Singleton != null)) { ths.RefreshDisplayedDreams(); } if (ths.mShouldRefreshOnUpdate) { ths.mShouldRefreshOnUpdate = false; try { ths.Refresh(); } catch (Exception e) { Common.Exception(ths.Actor, e); } } } }
public void Restore(SimDescription sim) { try { sim.mGenderPreferenceMale = mMalePreference; sim.mGenderPreferenceFemale = mFemalePreference; if (sim.Pregnancy != null) { sim.Pregnancy.mGender = mPregnantGender; } if (sim.CreatedSim != null) { if (mPreviousOutfitCategory != OutfitCategories.None) { SimOutfit outfit = sim.GetOutfit(mPreviousOutfitCategory, mPreviousOutfitIndex); if (outfit != null) { sim.CreatedSim.mPreviousOutfitKey = outfit.Key; } } if (sim.CreatedSim.DreamsAndPromisesManager != null) { ActiveDreamNode node = sim.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode; if (node != null) { node.InternalCount = mLifetimeWishTally; } } } foreach (TraitNames trait in mTraits) { if (sim.TraitManager.HasElement(trait)) { continue; } sim.TraitManager.AddElement(trait); } SocialNetworkingSkill networkSkill = sim.SkillManager.GetSkill <SocialNetworkingSkill>(SkillNames.SocialNetworking); if (networkSkill != null) { networkSkill.mNumberOfFollowers = mNumberOfFollowers; networkSkill.mBlogsCreated = mBlogsCreated; } RockBand bandSkill = sim.SkillManager.GetSkill <RockBand>(SkillNames.RockBand); if (bandSkill != null) { bandSkill.mBandInfo = mBandInfo; } Collecting collecting = sim.SkillManager.GetSkill <Collecting>(SkillNames.Collecting); if (collecting != null) { collecting.mGlowBugData = mGlowBugData; collecting.mMushroomsCollected = mMushroomsCollected; } NectarSkill nectar = sim.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar); if (nectar != null) { nectar.mHashesMade = mNectarHashesMade; } Photography photography = sim.SkillManager.GetSkill <Photography>(SkillNames.Photography); if (photography != null) { // Forces a recalculation of the completion count // photography.mCollectionsCompleted = uint.MaxValue; photography.mCollectionsCompleted = mCollectionsCompleted; if (mSubjectRecords != null) { photography.mSubjectRecords = mSubjectRecords; } if (mStyleRecords != null) { photography.mStyleRecords = mStyleRecords; } if (mSizeRecords != null) { photography.mSizeRecords = mSizeRecords; } } RidingSkill riding = sim.SkillManager.GetSkill <RidingSkill>(SkillNames.Riding); if (riding != null) { if (mCrossCountryCompetitionsWon != null) { riding.mCrossCountryCompetitionsWon = mCrossCountryCompetitionsWon.ToArray(); } if (mJumpCompetitionsWon != null) { riding.mJumpCompetitionsWon = mJumpCompetitionsWon.ToArray(); } } Bartending mixology = sim.SkillManager.GetSkill <Bartending>(SkillNames.Bartending); if (mixology != null) { if (mCustomDrinks != null) { mixology.mUniqueDrinks = mCustomDrinks; } } if (mOccult != null) { foreach (OccultBaseClass occult in mOccult) { if (OccultTypeHelper.Add(sim, occult.ClassOccultType, false, false)) { OccultTransfer transfer = OccultTransfer.Get(occult.ClassOccultType); if (transfer != null) { transfer.Perform(sim, occult); } } } } mOccult = null; if (mOutfitCache != null) { foreach (SavedOutfit.Cache.Key outfit in mOutfitCache.Outfits) { using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, outfit.mKey, false)) { builder.Builder.SkinTone = mSkinToneKey; builder.Builder.SkinToneIndex = mSkinToneIndex; outfit.Apply(builder, true, null, null); } } foreach (SavedOutfit.Cache.Key outfit in mOutfitCache.AltOutfits) { using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, outfit.mKey, true)) { builder.Builder.SkinTone = mSkinToneKey; builder.Builder.SkinToneIndex = mSkinToneIndex; outfit.Apply(builder, true, null, null); } } int count = 0; int originalCount = mOutfitCache.GetOutfitCount(OutfitCategories.Everyday, false); while ((originalCount > 0) && (originalCount < sim.GetOutfitCount(OutfitCategories.Everyday)) && (count < originalCount)) { CASParts.RemoveOutfit(sim, new CASParts.Key(OutfitCategories.Everyday, sim.GetOutfitCount(OutfitCategories.Everyday) - 1), false); count++; } } } catch (Exception e) { Common.Exception(sim, e); } }
public CrossWorldData(SimDescription sim) { mName = sim.FullName; mOutfitCache = new SavedOutfit.Cache(sim); SimOutfit outfit = sim.GetOutfit(OutfitCategories.Everyday, 0); if (outfit != null) { mSkinToneKey = outfit.SkinToneKey; mSkinToneIndex = outfit.SkinToneIndex; } else { mSkinToneKey = sim.SkinToneKey; mSkinToneIndex = sim.SkinToneIndex; } mMalePreference = sim.mGenderPreferenceMale; mFemalePreference = sim.mGenderPreferenceFemale; if (sim.CreatedSim != null) { if (sim.CreatedSim.mPreviousOutfitKey != null) { try { mPreviousOutfitCategory = sim.GetOutfitCategoryFromResKey(sim.CreatedSim.mPreviousOutfitKey, out mPreviousOutfitIndex); } catch { } } if (sim.CreatedSim.DreamsAndPromisesManager != null) { ActiveDreamNode node = sim.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode; if (node != null) { mLifetimeWishTally = node.InternalCount; } } } if (sim.Pregnancy != null) { mPregnantGender = sim.Pregnancy.mGender; } foreach (Trait trait in sim.TraitManager.List) { if (trait.IsReward) { continue; } mTraits.Add(trait.Guid); } SocialNetworkingSkill networkSkill = sim.SkillManager.GetSkill <SocialNetworkingSkill>(SkillNames.SocialNetworking); if (networkSkill != null) { // This value is set to mNumberOfBlogFollowers for some reason mNumberOfFollowers = networkSkill.mNumberOfFollowers; // Not transitioned at all mBlogsCreated = networkSkill.mBlogsCreated; } RockBand bandSkill = sim.SkillManager.GetSkill <RockBand>(SkillNames.RockBand); if (bandSkill != null) { mBandInfo = bandSkill.mBandInfo; } Collecting collecting = sim.SkillManager.GetSkill <Collecting>(SkillNames.Collecting); if (collecting != null) { // Error in CollectingPropertyStreamWriter:Export() requires that mGlowBugData by transfered manually // Exported as two Int64, but Imported as a Int64 and Int32 mGlowBugData = collecting.mGlowBugData; mMushroomsCollected = collecting.mMushroomsCollected; } NectarSkill nectar = sim.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar); if (nectar != null) { mNectarHashesMade = nectar.mHashesMade; } Photography photography = sim.SkillManager.GetSkill <Photography>(SkillNames.Photography); if (photography != null) { mCollectionsCompleted = photography.mCollectionsCompleted; mSubjectRecords = photography.mSubjectRecords; mStyleRecords = photography.mStyleRecords; mSizeRecords = photography.mSizeRecords; } RidingSkill riding = sim.SkillManager.GetSkill <RidingSkill>(SkillNames.Riding); if (riding != null) { // Error in the Import (Copy/Paste fail by the looks of it), where the CrossCountry Wins are imported instead mCrossCountryCompetitionsWon = new List <uint>(riding.mCrossCountryCompetitionsWon); mJumpCompetitionsWon = new List <uint>(riding.mJumpCompetitionsWon); } // EA hosed the color, glass and drink picks Bartending mixology = sim.SkillManager.GetSkill <Bartending>(SkillNames.Bartending); if (mixology != null) { mCustomDrinks = mixology.mUniqueDrinks; } if ((sim.OccultManager != null) && (sim.OccultManager.mOccultList != null)) { mOccult = new List <OccultBaseClass>(sim.OccultManager.mOccultList); } }
public static string GetStatus(SimDescription sim) { string str = sim.FullName; bool serviceOrRole = false; if (sim.AssignedRole != null) { serviceOrRole = true; ShoppingRegister register = sim.AssignedRole.RoleGivingObject as ShoppingRegister; if (register != null) { str += ", " + register.RegisterRoleName(sim.IsFemale); } else { string roleName; if (Localization.GetLocalizedString(sim.AssignedRole.CareerTitleKey, out roleName)) { str += ", " + roleName; } } string hours = GetRoleHours(sim); if (!string.IsNullOrEmpty(hours)) { str += Common.NewLine + hours; } } else if (SimTypes.InServicePool(sim)) { serviceOrRole = true; string serviceName; if (Localization.GetLocalizedString("Ui/Caption/Services/Service:" + sim.CreatedByService.ServiceType.ToString(), out serviceName)) { str += ", " + serviceName; } } List <string> customTitles; if (Tagger.Settings.mCustomSimTitles.TryGetValue(sim.SimDescriptionId, out customTitles)) { int perline = serviceOrRole ? 1 : 2; serviceOrRole = true; foreach (string title in customTitles) { if (perline == 0) { str += Common.NewLine; perline = 3; } str += ", " + title; perline--; } } if ((serviceOrRole) || (Tagger.Settings.mTagDataSettings[TagDataType.Orientation] && Tagger.Settings.mTagDataSettings[TagDataType.LifeStage] && (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.AgeInYears] || (Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage] && sim.AgingEnabled)))) { str += Common.NewLine; } else { str += " - "; } if (!sim.IsPet) { if (sim.TeenOrAbove && Tagger.Settings.mTagDataSettings[TagDataType.Orientation]) { str += Common.Localize("SimType:" + TagDataHelper.GetOrientation(sim).ToString()); } if (Tagger.Settings.mTagDataSettings[TagDataType.Zodiac] && sim.Zodiac != Zodiac.Unset) { if (Tagger.Settings.mTagDataSettings[TagDataType.Orientation]) { str += " "; } str += Common.LocalizeEAString("Ui/Caption/HUD/KnownInfoDialog:" + sim.Zodiac.ToString()); } } if (Tagger.Settings.mTagDataSettings[TagDataType.LifeStage]) { if (!sim.IsPet && Tagger.Settings.mTagDataSettings[TagDataType.Orientation] || (Tagger.Settings.mTagDataSettings[TagDataType.Zodiac] && sim.Zodiac != Zodiac.Unset)) { str += " "; } str += sim.AgeLocalizedText; } if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.AgeInYears] || Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage]) { str += " ("; } if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.AgeInYears]) { str += Common.Localize("TagData:Age", sim.IsFemale); } if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] && !Tagger.Settings.mTagDataSettings[TagDataType.AgeInYears]) { str += " " + Common.Localize("TagData:Days", sim.IsFemale, new object[] { Math.Round(Aging.GetCurrentAgeInDays(sim as IMiniSimDescription)) }); } if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInYears]) { str += " " + Common.Localize("TagData:Years", sim.IsFemale, new object[] { Math.Round(Aging.GetCurrentAgeInDays(sim as IMiniSimDescription) / Tagger.Settings.TagDataAgeInYearsLength) + 1 }); } if (sim.AgingEnabled) { if (Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage]) { str += ", " + Common.Localize("TagData:Birthday", sim.IsFemale, new object[] { (int)(AgingManager.Singleton.AgingYearsToSimDays(AgingManager.GetMaximumAgingStageLength(sim)) - AgingManager.Singleton.AgingYearsToSimDays(sim.AgingYearsSinceLastAgeTransition)) }); } } if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.AgeInYears] || Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage]) { str += ")"; } if (Tagger.Settings.mTagDataSettings[TagDataType.Occult] && sim.OccultManager != null) { List <OccultTypes> types = OccultTypeHelper.CreateList(sim, false); if (types.Count > 0) { str += Common.NewLine; string occultString = ""; foreach (OccultTypes type in types) { occultString += ", " + OccultTypeHelper.GetLocalizedName(type); } str += Common.Localize("TagData:OccultTag", sim.IsFemale, new object[] { occultString.Remove(0, 2) }); } } Sim createdSim = sim.CreatedSim; if (Tagger.Settings.Debugging) { if (createdSim != null) { str += Common.NewLine + "Autonomy: "; if (createdSim.Autonomy == null) { str += "None"; } else { if (createdSim.Autonomy.AutonomyDisabled) { str += "Disabled"; } else if (!AutonomyRestrictions.IsAnyAutonomyEnabled(createdSim)) { str += "User Disabled"; } else if (createdSim.Autonomy.IsRunningHighLODSimulation) { str += "High"; } else { str += "Low"; } if (createdSim.Autonomy.ShouldRunLocalAutonomy) { str += " Local"; } if (createdSim.CanRunAutonomyImmediately()) { str += " Ready"; } else if (!createdSim.mLastInteractionWasAutonomous) { str += " Push"; } else if (!createdSim.mLastInteractionSucceeded) { str += " Fail"; } if (createdSim.Autonomy.InAutonomyManagerQueue) { str += " Queued"; } } } } if (createdSim != null) { if (Tagger.Settings.mTagDataSettings[TagDataType.Mood]) { str += Common.NewLine; int flavour = (int)createdSim.MoodManager.MoodFlavor; str += Common.Localize("TagData:MoodTag", sim.IsFemale, new object[] { Common.LocalizeEAString(false, "Ui/Tooltip/HUD/SimDisplay:MoodFlavor" + flavour.ToString()) }) + " "; } if (Tagger.Settings.mTagDataSettings[TagDataType.MotiveInfo]) { if (!Tagger.Settings.mTagDataSettings[TagDataType.Mood]) { str += Common.NewLine; } string motives = ", "; int num = 0; foreach (CommodityKind kind in (Sims3.UI.Responder.Instance.HudModel as HudModel).GetMotives(sim.CreatedSim)) { if (sim.CreatedSim.Motives.HasMotive(kind)) { if (num >= 6) { break; } motives += FetchMotiveLocalization(sim.Species, kind) + ": " + "(" + sim.CreatedSim.Motives.GetValue(kind).ToString("0.") + ") "; } num++; } if (sim.CreatedSim.Motives.HasMotive(CommodityKind.Temperature)) { motives += FetchMotiveLocalization(sim.Species, CommodityKind.Temperature) + ": " + "(" + sim.CreatedSim.Motives.GetValue(CommodityKind.Temperature).ToString("0.") + ") "; } str += Common.Localize("TagData:Motives", sim.IsFemale, new object[] { motives.Remove(0, 2) }); } if (Tagger.Settings.mTagDataSettings[TagDataType.CurrentInteraction] && createdSim.CurrentInteraction != null) { str += Common.NewLine; try { str += createdSim.CurrentInteraction.ToString(); } catch (Exception e) { Common.DebugException(createdSim, e); str += createdSim.CurrentInteraction.GetType(); } Tone tone = createdSim.CurrentInteraction.CurrentTone; if (tone != null) { str += Common.NewLine + tone.ToString(); } SocialInteractionBase social = createdSim.CurrentInteraction as SocialInteractionBase; if ((social != null) && (social.Target != null)) { str += " " + Common.Localize("TagData:With", sim.IsFemale, new object[] { social.Target.Name }); } if (createdSim.CurrentInteraction is Terrain.GoHereWith) { InviteToLotSituation situtation = InviteToLotSituation.FindInviteToLotSituationInvolving(createdSim); if (situtation != null) { if (situtation.SimA != createdSim) { str += " " + situtation.SimA.Name; } else if (situtation.SimB != createdSim) { str += situtation.SimB.Name; } } } } } if (!SimTypes.IsSpecial(sim)) { str += Common.NewLine + Common.Localize("TagData:CashTag", sim.IsFemale, new object[] { sim.FamilyFunds }); if ((Tagger.Settings.mTagDataSettings[TagDataType.Debt] || Tagger.Settings.mTagDataSettings[TagDataType.NetWorth]) && sGetDebtAndNetworth.Valid) { int bit = 0; if (Tagger.Settings.mTagDataSettings[TagDataType.Debt]) { bit = bit + 1; } if (Tagger.Settings.mTagDataSettings[TagDataType.NetWorth]) { bit = bit + 4; } str += sGetDebtAndNetworth.Invoke <string>(new object[] { sim, bit }); } if (Tagger.Settings.mTagDataSettings[TagDataType.LifetimeWant] && sim.HasLifetimeWish) { IInitialMajorWish wish = DreamsAndPromisesManager.GetMajorDream(sim.LifetimeWish); string completed = string.Empty; if (sim.CreatedSim != null && sim.CreatedSim.DreamsAndPromisesManager != null) { ActiveDreamNode node = sim.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode; completed = " " + node.AmountCompleted; } if (wish != null) { str += Common.NewLine + Common.Localize("TagData:LifetimeWantTag", sim.IsFemale, new object[] { wish.GetMajorWishName(sim) }) + completed; } } if (Tagger.Settings.mTagDataSettings[TagDataType.LifetimeHappiness] && sim.LifetimeHappiness > 0) { if (!Tagger.Settings.mTagDataSettings[TagDataType.LifetimeWant] || (Tagger.Settings.mTagDataSettings[TagDataType.LifetimeWant] && !sim.HasLifetimeWish)) { str += Common.NewLine; } else { str += " "; } str += Common.Localize("TagData:LifetimeHappinessSpendable", sim.IsFemale, new object[] { sim.LifetimeHappiness, sim.SpendableHappiness }); } if (Tagger.Settings.mTagDataSettings[TagDataType.Job]) { if (sim.Occupation != null) { str += Common.NewLine; if (sim.Occupation.OfficeLocation != null) { str += Common.Localize("TagData:JobAt", sim.IsFemale, new object[] { sim.Occupation.CurLevelJobTitle, sim.Occupation.OfficeLocation.GetLocalizedName() }); } else { str += Common.Localize("TagData:JobTag", sim.IsFemale, new object[] { sim.Occupation.CurLevelJobTitle }); } } } if (Tagger.Settings.mTagDataSettings[TagDataType.PartnerInfo]) { if (sim.Partner != null) { Relationship rel = sim.GetRelationship(sim.Partner, false); string status = "Happily"; if (rel != null) { if (rel.CurrentLTRLiking < -15) { status = "Unhappily"; } } str += Common.NewLine; if (sim.IsMarried) { str += Common.Localize("TagData:Spouse", sim.IsFemale, new object[] { Common.Localize("TagData:" + status), sim.Partner }); } else { str += Common.Localize("TagData:Partner", sim.IsFemale, new object[] { sim.Partner }); } } } } if (sim.IsPregnant && Tagger.Settings.mTagDataSettings[TagDataType.PregnancyInfo]) { IMiniSimDescription father = SimDescription.Find(sim.Pregnancy.DadDescriptionId); if (father == null) { father = MiniSimDescription.Find(sim.Pregnancy.DadDescriptionId); } str += Common.NewLine; if (father != null) { if (sim.Partner != null && father != sim.Partner && !sim.IsPet) { string uhoh = Common.Localize("TagData:Uhoh"); str += Common.Localize("TagData:Pregnancy", sim.IsFemale, new object[] { father, uhoh }); } else { str += Common.Localize("TagData:Pregnancy", sim.IsFemale, new object[] { father }); } } else { str += Common.Localize("TagData:PregnancyUnknown", sim.IsFemale); } } if (Tagger.Settings.mTagDataSettings[TagDataType.PersonalityInfo] && sGetClanInfo.Valid) { List <string> info = sGetClanInfo.Invoke <List <string> >(new object [] { sim }); foreach (string personality in info) { str += Common.NewLine + personality; } } return(str); }
public static bool OnCompletion(ActiveDreamNode ths) { DreamsAndPromisesManager manager = null; if (ths.Owner != null) { manager = ths.Owner.DreamsAndPromisesManager; } if (manager == null) { return(false); } // Changed if ((ths.IsPromised) || ((manager.mDisplayedDreamNodes != null) && (manager.mDisplayedDreamNodes.Contains(ths)))) { bool wasMajorDream = false; try { if (ths.IsMajorWish && !ths.mOwner.SimDescription.HasCompletedLifetimeWish) { wasMajorDream = true; ths.mOwner.SimDescription.HasCompletedLifetimeWish = true; ths.mOwner.BuffManager.AddElement(BuffNames.Fulfilled, DreamsAndPromisesManager.kVeryFulfilledMoodValue, DreamsAndPromisesManager.kVeryFulfilledDuration, Origin.FromLifetimeWish); (ths.mOwner.BuffManager.GetElement(BuffNames.Fulfilled) as BuffFulfilled.BuffInstanceFulfilled).SetVeryFulfilledText(); } else { BuffFulfilled.BuffInstanceFulfilled element = ths.mOwner.BuffManager.GetElement(BuffNames.Fulfilled) as BuffFulfilled.BuffInstanceFulfilled; if (element != null) { float num = element.mBuff.EffectValue + (BuffFulfilled.kFulfilledBuffStackTimes * BuffFulfilled.kFulfilledBuffStackMoodValue); if (element.mEffectValue < num) { ths.mOwner.BuffManager.AddElement(BuffNames.Fulfilled, (int)(element.mEffectValue + BuffFulfilled.kFulfilledBuffStackMoodValue), Origin.FromCompletingPromisedWish); } } else { ths.mOwner.BuffManager.AddElement(BuffNames.Fulfilled, Origin.FromCompletingPromisedWish); } } } catch (Exception e) { Common.DebugException(ths.Owner, e); } // Changed manager.RemoveDisplayedPromiseNode(ths); if (DreamsAndPromisesManager.IsMLCrisisDream(ths)) { MidlifeCrisisManager.MidlifeCrisisPromiseCompleted(ths.Owner.SimDescription); MidlifeCrisisManager.UpdateCrisisType(ths.Owner.SimDescription); } if (ths.IsPromised) { if ((manager == DreamsAndPromisesManager.ActiveDreamsAndPromisesManager) && (DreamsAndPromisesModel.Singleton != null)) { DreamsAndPromisesModel.Singleton.FireFulfillPromise(ths); } } float achievementPoints = ths.AchievementPoints; if (ths.mOwner.BuffManager.HasElement(BuffNames.WishMaster)) { achievementPoints *= DreamsAndPromisesManager.kWishMasterMultiple; } SimDescriptionEx.IncrementLifetimeHappiness(ths.Owner.SimDescription, achievementPoints); if (!Responder.Instance.EditTownModel.IsLoading) { manager.PopRewardEffect(achievementPoints, wasMajorDream); } if (wasMajorDream) { if (ths.Owner.IsEP11Bot) { if ((ths.Owner.SimDescription.TraitChipManager != null) && ths.Owner.SimDescription.TraitChipManager.HasElement(11L)) { ths.Owner.ShowTNSIfSelectable(Localization.LocalizeString(ths.Owner.IsFemale, "Gameplay/DreamsAndPromises/DreamsAndPromisesManager:LifetimeWishSuccessTNS", new object[] { ths.Owner }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, ths.Owner.ObjectId); } } else { ths.Owner.ShowTNSIfSelectable(Localization.LocalizeString(ths.Owner.IsFemale, "Gameplay/DreamsAndPromises/DreamsAndPromisesManager:LifetimeWishSuccessTNS", new object[] { ths.Owner }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, ths.Owner.ObjectId); } } EventTracker.SendEvent(new DreamEvent(EventTypeId.kPromisedDreamCompleted, ths, true)); } return(true); }