public override bool Test(Sim a, ScientificSample target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { ScienceSkill element = (ScienceSkill)a.SkillManager.GetElement(SkillNames.Science); if ((element == null) || (element.SkillLevel < ScientificSample.CloneFromSample.kMinScienceSkillLevel)) { return(false); } IResearchStation[] objects = Sims3.Gameplay.Queries.GetObjects <IResearchStation>(a.LotCurrent); List <IResearchStation> list = a.LotCurrent.GetObjects <IResearchStation>(p => !p.Repairable.Broken); if (objects.Length == 0) { greyedOutTooltipCallback = new GreyedOutTooltipCallback(target.NoStationDisabledText); return(false); } if (list.Count < 1) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(a.IsFemale, "Gameplay/Objects/HobbiesSkills/ScienceResearchStation:IsBroken", new object[0])); return(false); } if (target.SubjectIsTooLarge()) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(ScientificSample.CloneFromSample.LocalizeString(a.IsFemale, "SubjectTooLarge", new object[0])); return(false); } if ((target.ScientificSampleType == ScientificSample.SampleType.Dna) && GameUtils.IsUniversityWorld()) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(a.IsFemale, "Gameplay/Actors/Sim:InteractionUnavailable", new object[0])); return(false); } /* * if ((target.ScientificSampleType == ScientificSample.SampleType.Dna) && !a.Household.CanAddSpeciesToHousehold(CASAgeGenderFlags.None | CASAgeGenderFlags.Human)) * { * greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(a.IsFemale, "UI/Feedback/CAS:ErrorMsg4", new object[0])); * return false; * } */ return(true); }
public override bool Test(Sim a, ScienceResearchStation target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.Repairable.Broken) { greyedOutTooltipCallback = new GreyedOutTooltipCallback(target.StationIsBroken); return(false); } ScienceSkill element = (ScienceSkill)a.SkillManager.GetElement(SkillNames.Science); if ((element == null) || (element.SkillLevel < ScientificSample.CloneFromSample.MinScienceSkillLevel)) { greyedOutTooltipCallback = new GreyedOutTooltipCallback(ScienceResearchStation.DisplayLevelTooLowTooltip); return(false); } new List <InventoryStack>(); bool flag = false; foreach (InventoryStack stack in a.Inventory.InventoryItems.Values) { ScientificSample sample = null; if (stack != null) { sample = stack.List[0].Object as ScientificSample; } if ((sample != null) && ((sample.ScientificSampleType != ScientificSample.SampleType.Dna) /*|| (!GameUtils.IsUniversityWorld() && a.Household.CanAddSpeciesToHousehold(CASAgeGenderFlags.None | CASAgeGenderFlags.Human))*/)) { flag = true; break; } } if (!flag) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(ScienceResearchStation.LocalizeString("SampleNotPresent", new object[0])); return(false); } return(flag); }
public static bool DoHarvest(HarvestPlant ths, Sim actor, bool hasHarvested, BurglarSituation burglarSituation) { Slot[] containmentSlots = ths.GetContainmentSlots(); List <GameObject> objectsHarvested = new List <GameObject>(); foreach (Slot slot in containmentSlots) { GameObject containedObject = ths.GetContainedObject(slot) as GameObject; if ((containedObject != null) && ths.HarvestHarvestable(containedObject, actor, burglarSituation)) { objectsHarvested.Add(containedObject); } } if (actor.TraitManager.HasElement(TraitNames.GathererTrait) && RandomUtil.RandomChance01(TraitTuning.GathererTraitExtraHarvestablesChance)) { int gathererTraitNumberOfExtraHarvestables = TraitTuning.GathererTraitNumberOfExtraHarvestables; for (int i = 0; i < gathererTraitNumberOfExtraHarvestables; i++) { GameObject item = ths.Seed.Copy(false) as GameObject; if (item != null) { objectsHarvested.Add(item); } } } ScienceSkill element = actor.SkillManager.GetSkill <ScienceSkill>(SkillNames.Science); if ((element != null) && RandomUtil.RandomChance01(ScienceSkill.kSuccessRateBonusesGardening[element.SkillLevel])) { int num3 = ScienceSkill.kNumExtraHarvestables[element.SkillLevel]; for (int j = 0; j < num3; j++) { GameObject obj6 = ths.Seed.Copy(false) as GameObject; if (obj6 != null) { objectsHarvested.Add(obj6); } } } if (objectsHarvested.Count <= 0) { return(false); } foreach (GameObject obj7 in objectsHarvested) { ths.ManipulateHarvestable(actor, obj7); } Gardening skill = actor.SkillManager.GetSkill <Gardening>(SkillNames.Gardening); Collecting collecting = actor.SkillManager.GetSkill <Collecting>(SkillNames.Collecting); int skillDifficulty = ths.PlantDef.GetSkillDifficulty(); if (skill != null) { if (skill.SkillLevel <= skillDifficulty) { if (actor.SimDescription.IsFairy && skill.IsFairySkill()) { skill.AddPoints(ths.PlantDef.SkillPointsHarvest * Skill.SkillLevelBumpMultiplierForFairies); } else { skill.AddPoints(ths.PlantDef.SkillPointsHarvest); } } if (ths is MoneyTree) { MoneyTreeEx.UpdateGardeningSkillJournal(ths as MoneyTree, skill, ths.PlantDef, objectsHarvested); } else { ths.UpdateGardeningSkillJournal(skill, ths.PlantDef, objectsHarvested); } } if (!hasHarvested) { actor.ShowTNSIfSelectable(Localization.LocalizeString(actor.IsFemale, "Gameplay/Objects/Gardening/HarvestPlant/Harvest:FirstHarvest", new object[] { actor, ths.PlantDef.Name }), StyledNotification.NotificationStyle.kGameMessagePositive, ths.ObjectId, actor.ObjectId); } if (collecting == null) { collecting = actor.SkillManager.AddElement(SkillNames.Collecting) as Collecting; } collecting.CollectedFromHarvest(objectsHarvested); ths.PostHarvest(); return(true); }
public void DetermineHumanOutcomeEx(bool succeeded) { this.DeleteVialsInCentrifuge(); ScientificSample.DnaSampleSubject subject = base.Target.Subject as ScientificSample.DnaSampleSubject; bool flag = false; ScienceSkill element = (ScienceSkill)base.Actor.SkillManager.GetElement(SkillNames.Science); if (succeeded) { bool flag3; bool flag2 = RandomUtil.RandomChance01(kSuccessChance); if (flag2) { flag3 = RandomUtil.RandomChance01(kEpicSuccessChance); } else { flag3 = RandomUtil.RandomChance01(kEpicFailureChance); } if (((subject == null) /*|| !base.Actor.Household.CanAddSpeciesToHousehold(CASAgeGenderFlags.None | CASAgeGenderFlags.Human)*/) || GameUtils.IsUniversityWorld()) { flag2 = false; flag3 = true; } if (flag2) { string name = string.Empty; if (flag3) { this.CreateBaby(); SetupPerfectCloneChildTraits(this.mCloneSim.SimDescription, this.mCloneSim, subject.Subject); name = "SimCloneEpicSuccess"; } else { this.CreateBaby(); SetupCloneTraitsFromArray(this.mCloneSim.SimDescription, this.mCloneSim, subject.Subject, kGoodCloneTraitNames); name = "SimCloneSuccess"; } if (element != null) { element.AddObjectsCreated(); } flag = true; base.Actor.ShowTNSIfSelectable(LocalizeString(base.Actor.IsFemale, name, new object[] { base.Actor, subject.Subject }), StyledNotification.NotificationStyle.kGameMessagePositive); EventTracker.SendEvent(new SimDescriptionTargetEvent(EventTypeId.kClonedSim, base.Actor, subject.Subject)); } else if (flag3) { if (this.mCloneSim != null) { this.mCloneSim.Destroy(); this.mCloneSim = null; this.mReplacementObject = null; } base.Actor.BuffManager.AddElement(BuffNames.MinorSetback, Origin.FromFailedExperiment); BuffSinged.SingeViaInteraction(this, Origin.FromFailedExperiment); base.AnimateSim("ExperimentRareEpicFail"); base.Actor.ShowTNSIfSelectable(LocalizeString(base.Actor.IsFemale, "SimCloneEpicFail", new object[] { base.Actor, subject.Subject }), StyledNotification.NotificationStyle.kGameMessageNegative); if (element != null) { element.AddEpicFail(); } } else { this.CreateBaby(); SetupCloneTraitsFromArray(this.mCloneSim.SimDescription, this.mCloneSim, subject.Subject, kBadCloneTraitNames); flag = true; VisualEffect.FireOneShotEffect("ep9ScienceCloneBaby_main", this.mResearchStation, unchecked ((Slot)(-1474234202)), VisualEffect.TransitionType.HardTransition); base.Actor.ShowTNSIfSelectable(LocalizeString(base.Actor.IsFemale, "SimCloneFail", new object[] { base.Actor, subject.Subject }), StyledNotification.NotificationStyle.kGameMessageNegative); EventTracker.SendEvent(new SimDescriptionTargetEvent(EventTypeId.kClonedSim, base.Actor, subject.Subject)); if (element != null) { element.AddObjectsCreated(); } } } else { if (this.mCloneSim != null) { this.mCloneSim.Destroy(); this.mCloneSim = null; this.mReplacementObject = null; } base.Actor.BuffManager.AddElement(BuffNames.Mourning, unchecked ((Origin)(-8359806666160896151L))); BuffSinged.SingeViaInteraction(this, Origin.FromFailedExperiment); base.AnimateSim("ExperimentRareEpicFail"); base.Actor.ShowTNSIfSelectable(LocalizeString(base.Actor.IsFemale, "SimCloneEpicFail", new object[] { base.Actor, subject.Subject }), StyledNotification.NotificationStyle.kGameMessageNegative); if (element != null) { element.AddEpicFail(); } } if (flag) { base.SetActorAndEnter("y", this.mCloneSim, "NewBabyCloneEnter"); base.AnimateJoinSims("CloneBabySuccessExit"); ChildUtils.CarryChild(base.Actor, this.mCloneSim, false); this.mReplacementObject = null; this.mCloneSim.EnableInteractions(InteractionsDisabledType.All); } }