Example #1
0
        private static void ChooseDNASamples(Sim actor, Sim target, ref ScientificSample maleDNA, ref ScientificSample femaleDNA)
        {
            if (actor.IsRobot)
            {
                if (actor.IsFemale)
                {
                    femaleDNA = SelectDNASample(actor, CASAgeGenderFlags.Female);
                }
                else
                {
                    maleDNA = SelectDNASample(actor, CASAgeGenderFlags.Male);
                }
            }

            if (target.IsRobot)
            {
                if (target.IsFemale)
                {
                    femaleDNA = SelectDNASample(target, CASAgeGenderFlags.Female);
                }
                else
                {
                    maleDNA = SelectDNASample(target, CASAgeGenderFlags.Male);
                }
            }
        }
Example #2
0
        // For 2 robots
        private static Pregnancy ImpregnateRobot(Sim mother, Sim father, ScientificSample dnaF, ScientificSample dnaM, bool isAutonomous, CommonWoohoo.WoohooStyle style)
        {
            ScientificSample.DnaSampleSubject femaleSubject = dnaF.Subject as ScientificSample.DnaSampleSubject;
            ScientificSample.DnaSampleSubject maleSubject   = dnaM.Subject as ScientificSample.DnaSampleSubject;

            if (femaleSubject != null)
            {
                if (maleSubject != null)
                {
                    return(StartPregnancy(mother, father, femaleSubject.Subject, maleSubject.Subject, isAutonomous, true));
                }
                else
                {
                    if (father.IsRobot)
                    {
                        Common.DebugNotify("Surrogate Pregnancy: Male DNA Null", father);
                        return(null);
                    }
                    else
                    {
                        return(StartPregnancy(mother, father, femaleSubject.Subject, null, isAutonomous, true));
                    }
                }
            }
            else
            {
                Common.DebugNotify("Surrogate Pregnancy: Female DNA Null", mother);
                return(null);
            }
        }
Example #3
0
        private static void RandomDNASmaples(Sim actor, Sim target, ref ScientificSample maleDNA, ref ScientificSample femaleDNA)
        {
            if (actor.IsRobot)
            {
                if (actor.IsFemale)
                {
                    femaleDNA = RandomUtil.GetRandomObjectFromList(GetDNASamples(actor, CASAgeGenderFlags.Female));
                }
                else
                {
                    maleDNA = RandomUtil.GetRandomObjectFromList(GetDNASamples(actor, CASAgeGenderFlags.Male));
                }
            }

            if (target.IsRobot)
            {
                if (target.IsFemale)
                {
                    femaleDNA = RandomUtil.GetRandomObjectFromList(GetDNASamples(target, CASAgeGenderFlags.Female));
                }
                else
                {
                    maleDNA = RandomUtil.GetRandomObjectFromList(GetDNASamples(target, CASAgeGenderFlags.Male));
                }
            }
        }
Example #4
0
        private static ScientificSample SelectDNASample(Sim robot, CASAgeGenderFlags gender)
        {
            List <ObjectPicker.HeaderInfo> list       = new List <ObjectPicker.HeaderInfo>();
            List <ObjectPicker.TabInfo>    list2      = new List <ObjectPicker.TabInfo>();
            List <ScientificSample>        dnaSamples = GetDNASamples(robot, gender);

            int numSelectableRows = 1;

            ObjectPicker.TabInfo tabInfo = new ObjectPicker.TabInfo(string.Empty, "TabText", new List <ObjectPicker.RowInfo>());

            foreach (ScientificSample current in dnaSamples)
            {
                ObjectPicker.RowInfo rowInfo = new ObjectPicker.RowInfo(current, new List <ObjectPicker.ColumnInfo>());
                rowInfo.ColumnInfo.Add(new ObjectPicker.ThumbAndTextColumn(current.GetThumbnailKey(), current.GetLocalizedName()));
                rowInfo.ColumnInfo.Add(new ObjectPicker.TextColumn(current.Subject.GetSubjectString()));
                tabInfo.RowInfo.Add(rowInfo);
            }

            list2.Add(tabInfo);
            list.Add(new ObjectPicker.HeaderInfo("HeaderString1", "HeaderTooltip1", 250));
            list.Add(new ObjectPicker.HeaderInfo("HeaderString2", "HeaderTooltip2", 250));
            List <ObjectPicker.RowInfo> list4 = ObjectPickerDialog.Show(true, ModalDialog.PauseMode.PauseSimulator, "DialogTitle",
                                                                        "Okay", "Cancel", list2, list, numSelectableRows);
            ScientificSample result = null;

            if (list4 != null && list4.Count > 0)
            {
                result = (ScientificSample)list4[0].Item;
            }

            return(result);
        }
Example #5
0
        public override bool InRabbitHole()
        {
            BeginCommodityUpdates();
            bool flag = DoTimedLoop(kSimMinutesForRaid);

            EndCommodityUpdates(flag);

            int samplesStolen = 0;

            if (flag)
            {
                for (int i = 0; i < mMaxSamples; i++)
                {
                    if (RandomUtil.RandomChance(mChance))
                    {
                        ScientificSample.DnaSampleSubject subject = new ScientificSample.DnaSampleSubject(RandomUtil.GetRandomObjectFromList(mDonors));
                        ScientificSample.CreateAndAddToInventory(Actor, subject);
                        samplesStolen++;
                    }
                }
            }

            mSuccessful = samplesStolen > 0;

            return(flag);
        }
Example #6
0
        public static void DonateDNA(Sim actor, Sim target)
        {
            if (!actor.IsRobot && !target.IsRobot)
            {
                Common.DebugNotify("CommonSurrogate.DonateDNA" + Common.NewLine + " - Fail: Participants are Robots");
                return;
            }

            if (actor.IsRobot && target.IsRobot)
            {
                Common.DebugNotify("CommonSurrogate.DonateDNA" + Common.NewLine + " - Fail: Participants are Humans");
                return;
            }

            if (actor.SimDescription.Gender != target.SimDescription.Gender)
            {
                Common.DebugNotify("CommonSurrogate.DonateDNA" + Common.NewLine + " - Fail: Participants are not Same Sex");
                return;
            }

            ScientificSample.DnaSampleSubject subject;

            if (!actor.IsRobot)
            {
                subject = new ScientificSample.DnaSampleSubject(actor.SimDescription);
                ScientificSample.CreateAndAddToInventory(target, subject);
            }
            else
            {
                subject = new ScientificSample.DnaSampleSubject(target.SimDescription);
                ScientificSample.CreateAndAddToInventory(actor, subject);
            }
        }
Example #7
0
 public static void GetDNASamples(Sim actor, Sim target, ref ScientificSample maleDNA, ref ScientificSample femaleDNA)
 {
     if (actor.IsSelectable || target.IsSelectable)
     {
         ChooseDNASamples(actor, target, ref maleDNA, ref femaleDNA);
     }
     else
     {
         RandomDNASmaples(actor, target, ref maleDNA, ref femaleDNA);
     }
 }
Example #8
0
        // For 1 robot and 1 human
        private static Pregnancy ImpregnateHuman(Sim mother, Sim father, ScientificSample dna, bool isAutonomous, CommonWoohoo.WoohooStyle style)
        {
            ScientificSample.DnaSampleSubject dnaSubject = dna.Subject as ScientificSample.DnaSampleSubject;

            if (dnaSubject != null)
            {
                return(StartPregnancy(mother, father, dnaSubject.Subject, isAutonomous, true));
            }
            else
            {
                Common.DebugNotify("Surrogate Pregnancy: Male DNA Null", father);
                return(null);
            }
        }
Example #9
0
        private static List <ScientificSample> GetDNASamples(Sim robot, CASAgeGenderFlags gender)
        {
            if (robot.Inventory == null)
            {
                return(null);
            }

            List <InventoryStack> stacks = new List <InventoryStack>();

            foreach (InventoryStack current in robot.Inventory.InventoryItems.Values)
            {
                if (current != null && new SelectionDelegate(IsObjectSample)(current.List[0].Object))
                {
                    ScientificSample scientificSample = current.List[0].Object as ScientificSample;

                    if (scientificSample.ScientificSampleType == ScientificSample.SampleType.Dna)
                    {
                        stacks.Add(current);
                    }
                }
            }

            List <ScientificSample> results = new List <ScientificSample>();

            foreach (InventoryStack current2 in stacks)
            {
                foreach (InventoryItem current3 in current2.List)
                {
                    ScientificSample scientificSample2 = current3.Object as ScientificSample;

                    if (scientificSample2 != null)
                    {
                        ScientificSample.DnaSampleSubject subject = scientificSample2.Subject as ScientificSample.DnaSampleSubject;

                        if (subject != null && subject.Subject.IsHuman && subject.Subject.Gender == gender)
                        {
                            results.Add(scientificSample2);
                        }
                    }
                }
            }

            return(results);
        }
Example #10
0
        public static Pregnancy Impregnate(Sim simA, Sim simB, ScientificSample dnaF, ScientificSample dnaM, bool isAutonomous, CommonWoohoo.WoohooStyle style)
        {
            if (simA == null || simB == null)
            {
                Common.DebugNotify("CommonSurrogatePregnancy.Impregnate" + Common.NewLine + " - Impregnate Fail: Parent is Null");
                return(null);
            }

            if (simA.SimDescription.Gender == simB.SimDescription.Gender)
            {
                Common.DebugNotify("CommonSurrogatePregnancy.Impregnate" + Common.NewLine + " - Impregante Fail: Same Sex");
                return(null);
            }

            if (dnaF == null && dnaM == null)
            {
                Common.DebugNotify("CommonSurrogatePregnancy.Impregnate" + Common.NewLine + " - Impregnate Fail: DNA are Null");
                return(null);
            }

            Sim mother, father;

            if (simA.IsFemale)
            {
                mother = simA;
                father = simB;
            }
            else
            {
                mother = simB;
                father = simA;
            }

            if (mother.IsRobot)
            {
                return(ImpregnateRobot(mother, father, dnaF, dnaM, isAutonomous, style));
            }
            else
            {
                return(ImpregnateHuman(mother, father, dnaM, isAutonomous, style));
            }
        }
Example #11
0
            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);
            }
Example #12
0
            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);
            }
Example #13
0
        public static bool IsObjectSample(IGameObject toTest)
        {
            ScientificSample scientificSample = toTest as ScientificSample;

            return(scientificSample != null);
        }
Example #14
0
 public override string GetInteractionName(Sim actor, ScientificSample target, InteractionObjectPair iop)
 {
     return(base.GetInteractionName(actor, target, new InteractionObjectPair(sOldSingleton, target)));
 }