Esempio n. 1
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (Sim.CreatedSim == null)
            {
                Sims.Instantiate(Sim, Sim.LotHome, false);
            }

            if (Target.CreatedSim == null)
            {
                Sims.Instantiate(Target, Target.LotHome, false);
            }

            if ((Sim.CreatedSim == null) || (Target.CreatedSim == null))
            {
                IncStat("Uninstantiated");
                return(false);
            }
            else
            {
                if (Sim.IsRobot)
                {
                    if ((Sim.LotHome == null) ||
                        ((Sim.LotHome.CountObjects <BotMakingStation> () + Sim.LotHome.CountObjects <InventionWorkbench>()) == 0))
                    {
                        IncStat("No Workbench");
                        return(false);
                    }

                    SimDescription child = null;
                    if (Sim.IsFrankenstein)
                    {
                        bool reward = Sim.OccultManager.mIsLifetimeReward;

                        if ((Target.IsFrankenstein) && (RandomUtil.CoinFlip()))
                        {
                            reward = Target.OccultManager.mIsLifetimeReward;
                        }

                        Sim childSim = OccultFrankenstein.CreateFrankenStein(Sim.CreatedSim, CASAgeGenderFlags.None, reward);
                        if (childSim == null)
                        {
                            IncStat("Creation Fail");
                            return(false);
                        }

                        child = childSim.SimDescription;
                    }
                    else
                    {
                        child = OccultRobot.MakeRobot(CASAgeGenderFlags.Adult, CASAgeGenderFlags.None, RobotForms.MaxType);
                        if (child == null)
                        {
                            IncStat("Creation Fail");
                            return(false);
                        }

                        CASRobotData supernaturalData = child.SupernaturalData as CASRobotData;
                        if (supernaturalData != null)
                        {
                            supernaturalData.CreatorSim = Sim.SimDescriptionId;

                            int quality = 0;
                            int count   = 0;

                            CASRobotData parentData = Sim.SupernaturalData as CASRobotData;
                            if (parentData != null)
                            {
                                quality = parentData.BotQualityLevel;
                                count++;
                            }

                            parentData = Target.SupernaturalData as CASRobotData;
                            if (parentData != null)
                            {
                                quality += parentData.BotQualityLevel;
                                count++;
                            }

                            if (count == 2)
                            {
                                quality /= count;
                            }

                            supernaturalData.BotQualityLevel = quality;
                        }
                    }

                    if (child.Genealogy.Parents.Count == 0)
                    {
                        Sim.Genealogy.AddChild(child.Genealogy);
                    }

                    Target.Genealogy.AddChild(child.Genealogy);

                    if (!Households.MoveSim(child, Sim.Household))
                    {
                        IncStat("Move Fail");

                        Deaths.CleansingKill(child, true);

                        return(false);
                    }

                    return(true);
                }
                else if (Target.IsRobot)
                {
                    IncStat("Simbot Partner");
                    return(false);
                }
                else
                {
                    if (CommonSpace.Helpers.Pregnancies.Start(Sim.CreatedSim, Target, false) != null)
                    {
                        ManagerSim.ForceRecount();

                        if (Sim.IsHuman)
                        {
                            if (OnGatheringScenario != null)
                            {
                                OnGatheringScenario(this, frame);
                            }
                        }

                        if ((!Sim.IsHuman) && (Sim.Partner != Target))
                        {
                            if ((GetValue <AllowMarriageOption, bool>(Sim)) && (GetValue <AllowMarriageOption, bool>(Target)))
                            {
                                if ((Romances.AllowBreakup(this, Sim, Managers.Manager.AllowCheck.None)) && (Romances.AllowBreakup(this, Target, Managers.Manager.AllowCheck.None)))
                                {
                                    RemoveAllPetMateFlags(Sim);
                                    RemoveAllPetMateFlags(Target);
                                    Relationship.Get(Sim, Target, false).LTR.AddInteractionBit(LongTermRelationship.InteractionBits.Marry);
                                }
                            }
                        }
                    }
                    return(true);
                }
            }
        }
Esempio n. 2
0
        public void motive_motive_distress(Sim sim, CommodityKind commodity)
        {
            if (commodity == (CommodityKind)0x44440444)
            {
                return;
            }

            SimDescription simd        = sim.SimDescription;
            BuffManager    buffManager = sim.BuffManager;
            Motives        moves       = sim.Motives;

            switch (commodity)
            {
            case CommodityKind.Bladder:
            {
                bool flag = true;
                InteractionDefinition interactionDefinition;
                switch (simd.Species)
                {
                case CASAgeGenderFlags.Horse:
                    interactionDefinition = Sim.HorsePee.Singleton;
                    break;

                case CASAgeGenderFlags.Dog:
                case CASAgeGenderFlags.LittleDog:
                    interactionDefinition = (InteractionDefinition)Sim.DogPeeStart.Singleton;
                    break;

                case CASAgeGenderFlags.Cat:
                    interactionDefinition = (InteractionDefinition)Sim.CatPeeStart.Singleton;
                    break;

                default:
                    interactionDefinition = Sim.BladderFailure.Singleton;
                    break;
                }

                foreach (InteractionInstance interaction in sim.InteractionQueue.InteractionList)
                {
                    if (interaction is Sim.DogPee || interaction is Sim.CatPee || interaction.InteractionDefinition == interactionDefinition)
                    {
                        flag = false;
                        break;
                    }
                }

                if (flag)
                {
                    SwimmingInPool swimmingInPool = sim.Posture as SwimmingInPool;
                    if (swimmingInPool == null)
                    {
                        InteractionInstance interactionInstance = interactionDefinition.CreateInstance(sim, sim, new InteractionPriority(InteractionPriorityLevel.High), false, false);
                        Sim.DogPeeStart     dogPeeStart         = interactionInstance as Sim.DogPeeStart;
                        if (dogPeeStart != null)
                        {
                            dogPeeStart.DoNotRoute = true;
                        }
                        else
                        {
                            Sim.CatPeeStart catPeeStart = interactionInstance as Sim.CatPeeStart;
                            if (catPeeStart != null)
                            {
                                catPeeStart.DoNotRoute = true;
                            }
                        }
                        if (sim.InteractionQueue.AddNext(interactionInstance) && simd.IsRaccoon)
                        {
                            sim.AddExitReason(ExitReason.BuffFailureState);
                        }
                        else
                        {
                            BuffInstance buffOfSolveCommodity = buffManager.GetBuffOfSolveCommodity(commodity);
                            if (buffOfSolveCommodity != null && buffOfSolveCommodity.EffectValue <= 0)
                            {
                                ThoughtBalloonManager.BalloonData balloonData = new ThoughtBalloonManager.BalloonData(buffOfSolveCommodity.ThumbString);
                                if (balloonData.IsValid)
                                {
                                    balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon;
                                    balloonData.mCoolDown   = ThoughtBalloonCooldown.None;
                                    sim.ThoughtBalloonManager.ShowBalloon(balloonData);
                                }
                            }

                            moves.SetMax(CommodityKind.Bladder);

                            if (!simd.IsPet)
                            {
                                PuddleManager.AddPuddle(sim.Position);
                                moves.SetValue(CommodityKind.Hygiene, -100f);
                                if (GlobalFunctions.AreOtherSimsNearby(sim, BuffEmbarrassed.DistanceForEmbarrassedBuff))
                                {
                                    buffManager.AddElement(BuffNames.Embarrassed, Origin.FromPeeingSelf);
                                }
                                ActiveTopic.AddToSim(sim, "Embarrassment");
                            }
                            else
                            {
                                MetaAutonomyVenueType metaAutonomyVenueType = sim.LotCurrent.GetMetaAutonomyVenueType();
                                if ((!simd.IsADogSpecies || metaAutonomyVenueType != MetaAutonomyVenueType.DogPark) && World.GetTerrainType(sim.Position) == TerrainType.LotFloor)
                                {
                                    PuddleManager.AddPuddle(sim.Position);
                                }
                            }
                            EventTracker.SendEvent(EventTypeId.kBladderFailure, sim);
                        }
                        Motive motive = moves.GetMotive(CommodityKind.Bladder);
                        if (motive != null)
                        {
                            motive.PotionBladderDecayOverride = false;
                        }
                    }
                    else
                    {
                        swimmingInPool.ContainerPool.PeeInPool(sim);
                    }
                }
                break;
            }

            case CommodityKind.Hunger:
            case CommodityKind.VampireThirst:

                if (simd.IsFrankenstein)
                {
                    OccultFrankenstein.PushFrankensteinShortOut(sim);
                }
                else if (!simd.IsGhost && !simd.IsDead && !IsCheckKillSimInteraction(sim))
                {
                    if (sim.Posture.Satisfies(CommodityKind.ScubaDiving, null) && !simd.IsMermaid)
                    {
                        sim.Kill(SimDescription.DeathType.ScubaDrown);
                    }
                    else if (sim.Posture.Satisfies(CommodityKind.SwimmingInPool, null) && !simd.IsMermaid)
                    {
                        sim.Kill(SimDescription.DeathType.Drown);
                    }
                    else if (SimTemperature.HasFrozenSolidInteraction(sim))
                    {
                        sim.Kill(SimDescription.DeathType.Freeze, null, false);
                    }
                    else if (OccultMermaid.IsDehydrated(sim))
                    {
                        sim.Kill(SimDescription.DeathType.MermaidDehydrated, null, false);
                    }
                    else
                    {
                        sim.Kill(sim.SimDescription.IsVampire ? SimDescription.DeathType.Thirst : SimDescription.DeathType.Starve);
                    }
                }
                break;

            case CommodityKind.Temperature:
            {
                float value = moves.GetValue(CommodityKind.Temperature);
                if (value > 0f)
                {
                    SimTemperature.PushSpontaneouslyCombustInteraction(sim);
                }
                else
                {
                    SimTemperature.PushFreezeInteraction(sim);
                }
                break;
            }

            case CommodityKind.MermaidDermalHydration:
                OccultMermaid.CollapseFromDehydration(sim);
                break;
            }
        }
Esempio n. 3
0
        public static void   FixInvisibleSim(SimDescription sim, bool force = false, bool reset = false)
        {
            try{
                OutfitCategories[] categoriesArray = null;
                switch (sim.Species)
                {
                case CASAgeGenderFlags.Human:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked,
                                                               OutfitCategories.Athletic,
                                                               OutfitCategories.Formalwear,
                                                               OutfitCategories.Sleepwear,
                                                               OutfitCategories.Swimwear };
                    break;

                case CASAgeGenderFlags.Horse:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked,
                                                               OutfitCategories.Racing,
                                                               OutfitCategories.Bridle,
                                                               OutfitCategories.Jumping };
                    break;

                default:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked };
                    break;
                }
                bool necessary = force;
                if (!necessary)
                {
                    foreach (OutfitCategories category in categoriesArray)
                    {
                        if (sim.IsHuman)
                        {
                            if (category == OutfitCategories.Naked)
                            {
                                continue;
                            }
                        }
                        SimOutfit outfit2 = sim.GetOutfit(category, 0);
                        if ((outfit2 == null) || (!outfit2.IsValid))
                        {
                            necessary = true;
                        }
                    }
                }
                if (!necessary)
                {
                    return;
                }
                SimOutfit sourceOutfit = null;
                for (int i = 0; i < 2; i++)
                {
                    OutfitCategoryMap map = null;
                    if (i == 0)
                    {
                        map = sim.mOutfits;
                    }
                    else
                    {
                        map = sim.mMaternityOutfits;
                    }
                    if (map == null)
                    {
                        continue;
                    }
                    foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories)))
                    {
                        if (category == OutfitCategories.Supernatural)
                        {
                            continue;
                        }
                        ArrayList outfits = map[category] as ArrayList;
                        if (outfits == null)
                        {
                            continue;
                        }
                        foreach (SimOutfit anyOutfit in outfits)
                        {
                            if ((anyOutfit != null) && (anyOutfit.IsValid))
                            {
                                sourceOutfit = anyOutfit;
                                break;
                            }
                        }
                    }
                }
                SimBuilder builder = new SimBuilder();
                builder.UseCompression = true;
                var simTone = sim.SkinToneKey;
                List <ResourceKey> choiceTones = new List <ResourceKey>();
                KeySearch          tones       = new KeySearch(0x0354796a);
                foreach (ResourceKey tone in tones)
                {
                    choiceTones.Add(tone);
                }
                tones.Reset();
                if ((simTone.InstanceId == 0) || (!choiceTones.Contains(simTone)))
                {
                    simTone = RandomUtil.GetRandomObjectFromList(choiceTones);
                }
                ResourceKey newTone = simTone;

                builder.Age           = sim.Age;
                builder.Gender        = sim.Gender;
                builder.Species       = sim.Species;
                builder.SkinTone      = newTone;
                builder.SkinToneIndex = sim.SkinToneIndex;
                builder.MorphFat      = sim.mCurrentShape.Fat;
                builder.MorphFit      = sim.mCurrentShape.Fit;
                builder.MorphThin     = sim.mCurrentShape.Thin;
                GeneticsPet.SpeciesSpecificData speciesData = OutfitUtils.GetSpeciesSpecificData(sim);
                try{
                    if (sourceOutfit != null)
                    {
                        foreach (SimOutfit.BlendInfo blend in sourceOutfit.Blends)
                        {
                            builder.SetFacialBlend(blend.key, blend.amount);
                        }
                        CASParts.OutfitBuilder.CopyGeneticParts(builder, sourceOutfit);
                    }
                    else
                    {
                        if (sim.Genealogy != null)
                        {
                            List <SimDescription> parents      = new List <SimDescription>();
                            List <SimDescription> grandParents = new List <SimDescription>();
                            if (sim.Genealogy.Parents != null)
                            {
                                foreach (Genealogy gene in sim.Genealogy.Parents)
                                {
                                    SimDescription relative = gene.SimDescription;
                                    if (relative == null)
                                    {
                                        continue;
                                    }
                                    parents.Add(relative);
                                    if (relative.Genealogy != null)
                                    {
                                        if (relative.Genealogy.Parents != null)
                                        {
                                            foreach (Genealogy grandGene in relative.Genealogy.Parents)
                                            {
                                                var grandRelative = grandGene.SimDescription;
                                                if (grandRelative == null)
                                                {
                                                    continue;
                                                }
                                                grandParents.Add(grandRelative);
                                            }
                                        }
                                    }
                                }
                            }
                            if (parents.Count > 0)
                            {
                                if (sim.IsHuman)
                                {
                                    Genetics.InheritFacialBlends(builder, parents.ToArray(), new Random());
                                }
                                else
                                {
                                    GeneticsPet.InheritBodyShape(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritBasePeltLayer(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritPeltLayers(builder, parents, grandParents, new Random());
                                }
                            }
                        }
                    }
                }catch (Exception exception) {
                    Alive.WriteLog(exception.Message + "\n\n" +
                                   exception.StackTrace + "\n\n" +
                                   exception.Source);
                }
                if (sim.IsRobot)
                {
                    OutfitUtils.AddMissingPartsBots(builder, (OutfitCategories)0x200002, true, sim);
                    Sleep();
                    OutfitUtils.AddMissingPartsBots(builder, OutfitCategories.Everyday, true, sim);
                    Sleep();
                }
                else
                if (sim.IsHuman)
                {
                    OutfitUtils.AddMissingParts(builder, (OutfitCategories)0x200002, true, sim, sim.IsAlien);
                    Sleep();
                    OutfitUtils.AddMissingParts(builder, OutfitCategories.Everyday, true, sim, sim.IsAlien);
                    Sleep();
                }
                else
                {
                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday | (OutfitCategories)0x200000, true, sim, speciesData);
                    Sleep();
                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday, true, sim, speciesData);
                    Sleep();
                }
                ResourceKey uniformKey = new ResourceKey();
                if (sim.IsHuman)
                {
                    if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, OutfitCategories.Everyday))
                    {
                        OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                    }
                }
                OutfitUtils.SetAutomaticModifiers(builder);
                sim.ClearOutfits(OutfitCategories.Career, false);
                sim.ClearOutfits(OutfitCategories.MartialArts, false);
                sim.ClearOutfits(OutfitCategories.Special, false);
                foreach (OutfitCategories category in categoriesArray)
                {
                    ArrayList outfits = null;
                    if (!force)
                    {
                        outfits = sim.Outfits[category] as ArrayList;
                        if (outfits != null)
                        {
                            int index = 0;
                            while (index < outfits.Count)
                            {
                                SimOutfit anyOutfit = outfits[index] as SimOutfit;
                                if (anyOutfit == null)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else
                                if (!anyOutfit.IsValid)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else
                                {
                                    index++;
                                }
                            }
                        }
                    }

                    if ((outfits == null) || (outfits.Count == 0))
                    {
                        OutfitUtils.MakeCategoryAppropriate(builder, category, sim);
                        if (sim.IsHuman)
                        {
                            if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, category))
                            {
                                OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                            }
                        }
                        sim.RemoveOutfits(category, false);
                        CASParts.AddOutfit(sim, category, builder, true);
                    }
                    if (sim.IsUsingMaternityOutfits)
                    {
                        sim.BuildPregnantOutfit(category);
                    }
                }
                if (sim.IsMummy)
                {
                    OccultMummy
                    .OnMerge(sim);
                }
                else
                if (sim.IsFrankenstein)
                {
                    OccultFrankenstein
                    .OnMerge(sim, sim.OccultManager.mIsLifetimeReward);
                }
                else
                if (sim.IsGenie)
                {
                    OccultGenie
                    .OverlayUniform(sim, OccultGenie.CreateUniformName(sim.Age, sim.Gender), ProductVersion.EP6, OutfitCategories.Everyday, CASSkinTones.BlueSkinTone, 0.68f);
                }
                else
                if (sim.IsImaginaryFriend)
                {
                    OccultImaginaryFriend friend = sim.OccultManager.GetOccultType(Sims3.UI.Hud.OccultTypes.ImaginaryFriend) as OccultImaginaryFriend;
                    OccultBaseClass
                    .OverlayUniform(sim, OccultImaginaryFriend.CreateUniformName(sim.Age, friend.Pattern), ProductVersion.EP4, OutfitCategories.Special, CASSkinTones.NoSkinTone, 0f);
                }
                if (sim.IsMermaid)
                {
                    OccultMermaid
                    .AddOutfits(sim, null);
                }
                if (sim.IsWerewolf)
                {
                    if (sim.ChildOrAbove)
                    {
                        SimOutfit newWerewolfOutfit =
                            OccultWerewolf
                            .GetNewWerewolfOutfit(sim.Age, sim.Gender);
                        if (newWerewolfOutfit != null)
                        {
                            sim.AddOutfit(newWerewolfOutfit, OutfitCategories.Supernatural, 0x0);
                        }
                    }
                }
                SimOutfit currentOutfit = null;
                if (sim.CreatedSim != null)
                {
                    if (reset)
                    {
                        StuckSimData stuckSim;
                        if (!StuckSims.TryGetValue(sim.SimDescriptionId, out stuckSim))
                        {
                            stuckSim = new StuckSimData();
                            StuckSims.Add(sim.SimDescriptionId, stuckSim);
                        }
                        if (!stuckSim.Resetting)
                        {
                            stuckSim.Detections++;
                            Vector3 destination = Vector3.Invalid;
                            if (sim.CreatedSim.RoutingComponent != null)
                            {
                                sim.CreatedSim.RoutingComponent.GetDestination(out destination);
                            }
                            if (stuckSim.resetTask == null)
                            {
                                stuckSim.resetTask = new ResetStuckSimTask(sim.CreatedSim, destination, "Invisible");
                            }
                            else
                            {
                                stuckSim.resetTask.Renew();
                            }
                        }
                    }
                    try{
                        sim.CreatedSim.SwitchToOutfitWithoutSpin(Sim.ClothesChangeReason.GoingOutside, OutfitCategories.Everyday, true);
                    }catch (Exception exception) {
                        Alive.WriteLog(exception.Message + "\n\n" +
                                       exception.StackTrace + "\n\n" +
                                       exception.Source);
                    }
                    currentOutfit = sim.CreatedSim.CurrentOutfit;
                }
                else
                {
                    currentOutfit = sim.GetOutfit(OutfitCategories.Everyday, 0);
                }
                if (currentOutfit != null)
                {
                    ThumbnailManager.GenerateHouseholdSimThumbnail(currentOutfit.Key, currentOutfit.Key.InstanceId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, sim.AgeGenderSpecies);
                }
            }catch (Exception exception) {
                Alive.WriteLog(exception.Message + "\n\n" +
                               exception.StackTrace + "\n\n" +
                               exception.Source + "\n\n" +
                               "FixInvisibleSim");
            }finally{
            }
        }
Esempio n. 4
0
        // From OccultManager
        protected static bool AddOccultType(OccultManager ths, OccultTypes type, bool addOutfit, bool isReward, bool fromRestore, OccultBaseClass overrideOccultToAdd)
        {            
            OccultBaseClass newOccult = null;
            OccultBaseClass oldOccult = ths.VerifyOccultList(type);
            if (overrideOccultToAdd != null)
            {
                newOccult = overrideOccultToAdd;
            }
            else
            {
                switch (type)
                {
                    case OccultTypes.Mummy:
                        newOccult = new OccultMummy();
                        break;
                    case OccultTypes.Frankenstein:
                        newOccult = new OccultFrankenstein();
                        break;
                    case OccultTypes.Vampire:
                        newOccult = new OccultVampire();
                        break;
                    case OccultTypes.ImaginaryFriend:
                        OccultImaginaryFriend oldImFr = oldOccult as OccultImaginaryFriend;
                        if (oldImFr == null)
                        {
                            newOccult = new OccultImaginaryFriend();
                        }
                        else
                        {
                            newOccult = new OccultImaginaryFriend(oldImFr);
                        }
                        break;
                    case OccultTypes.Unicorn:
                        newOccult = new OccultUnicorn();
                        break;
                    case OccultTypes.Fairy:
                        newOccult = new OccultFairy();
                        break;
                    case OccultTypes.Witch:
                        newOccult = new OccultWitch();
                        break;
                    case OccultTypes.Genie:
                        newOccult = new OccultGenie();
                        break;
                    case OccultTypes.Werewolf:
                        newOccult = new OccultWerewolf();
                        break;
                    case OccultTypes.PlantSim:
                        newOccult = new OccultPlantSim();
                        break;
                    case OccultTypes.Mermaid:
                        newOccult = new OccultMermaid();
                        break;
                    case OccultTypes.TimeTraveler:
                        newOccult = new OccultTimeTraveler();
                        break;
                    case OccultTypes.Robot:
                        newOccult = new OccultRobot();
                        break;
                }
            }

            if (newOccult == null)
            {
                return false;
            }

            OccultTypes originalTypes = ths.mCurrentOccultTypes;
            Role assignedRole = ths.mOwnerDescription.AssignedRole;
            float alienDNAPercentage = ths.mOwnerDescription.AlienDNAPercentage;

            try
            {
                ths.mCurrentOccultTypes = OccultTypes.None;
                ths.mOwnerDescription.AssignedRole = null;
                ths.mOwnerDescription.mAlienDNAPercentage = 0f;

                if (!newOccult.CanAdd(ths.mOwnerDescription, fromRestore))
                {
                    return false;
                }
            }
            finally
            {
                ths.mCurrentOccultTypes = originalTypes;
                ths.mOwnerDescription.AssignedRole = assignedRole;
                ths.mOwnerDescription.mAlienDNAPercentage = alienDNAPercentage;
            }

            if ((ths.mOwnerDescription.SupernaturalData == null) ||
                ((type == OccultTypes.Fairy) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.Fairy)) ||
                ((type == OccultTypes.Robot) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.Robot)) ||
                ((type == OccultTypes.PlantSim) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.PlantSim)))
            {
                ths.mOwnerDescription.AddSupernaturalData(type);
            }

            ths.mIsLifetimeReward = isReward;

            if (type == OccultTypes.Genie)
            {
                // Corrections for improper handling of the special outfits by OccultGenie
                if (ths.mOwnerDescription.mSpecialOutfitIndices == null)
                {
                    ths.mOwnerDescription.mSpecialOutfitIndices = new Dictionary<uint, int>();
                }

                addOutfit = false;
            }

            if (type == OccultTypes.Unicorn)
            {
                OccultUnicornEx.OnAddition(newOccult as OccultUnicorn, ths.mOwnerDescription, addOutfit);
            }

            ApplyTrait(ths.mOwnerDescription, type);

            MidlifeCrisisManager midlifeCrisisManager = ths.mOwnerDescription.MidlifeCrisisManager;

            try
            {
                // Inactive mummies don't agree with mid-life crisis managers
                ths.mOwnerDescription.MidlifeCrisisManager = null;

                newOccult.OnAddition(ths.mOwnerDescription, addOutfit, ths.mIsLifetimeReward, fromRestore);
            }
            finally
            {
                ths.mOwnerDescription.MidlifeCrisisManager = midlifeCrisisManager;
            }

            ths.mOccultList.Add(newOccult);
            ths.mCurrentOccultTypes |= type;
            EventTracker.SendEvent(new BeAnOccultEvent(EventTypeId.kBeAnOccult, ths.mOwnerDescription.CreatedSim, (uint)type));
            if (ths.mOwnerDescription.CreatedSim != null)
            {
                if (!Cane.IsAllowedToUseCane(ths.mOwnerDescription.CreatedSim))
                {
                    Cane.StopUsingAnyActiveCanes(ths.mOwnerDescription.CreatedSim);
                }
                if (!Backpack.IsAllowedToUseBackpack(ths.mOwnerDescription.CreatedSim))
                {
                    Backpack.StopUsingAnyActiveBackpacks(ths.mOwnerDescription.CreatedSim);
                }
                if (!Jetpack.IsAllowedToUseJetpack(ths.mOwnerDescription.CreatedSim))
                {
                    Jetpack.StopUsingAnyActiveJetpacks(ths.mOwnerDescription.CreatedSim);
                }
            }

            (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).OnSimDaysPerAgingYearChanged();
            ths.ClearOneShot();
            ths.UpdateOccultUI();            
            if (!fromRestore)
            {
                EventTracker.SendEvent(EventTypeId.kBecameOccult, ths.mOwnerDescription.CreatedSim);                
            }

            if (oldOccult != null)
            {
                newOccult.MergeOccultData(oldOccult);
            }

            if (ths.mOwnerDescription.CreatedSim != null)
            {
                Sim.StandingPosture standing = ths.mOwnerDescription.CreatedSim.Standing as Sim.StandingPosture;
                if (standing != null)
                {
                    standing.SetDefaultIdleAnim();
                }
            }

            return true;
        }
Esempio n. 5
0
        // From OccultManager
        protected static bool AddOccultType(OccultManager ths, OccultTypes type, bool addOutfit, bool isReward, bool fromRestore, OccultBaseClass overrideOccultToAdd)
        {
            OccultBaseClass newOccult = null;
            OccultBaseClass oldOccult = ths.VerifyOccultList(type);

            if (overrideOccultToAdd != null)
            {
                newOccult = overrideOccultToAdd;
            }
            else
            {
                switch (type)
                {
                case OccultTypes.Mummy:
                    newOccult = new OccultMummy();
                    break;

                case OccultTypes.Frankenstein:
                    newOccult = new OccultFrankenstein();
                    break;

                case OccultTypes.Vampire:
                    newOccult = new OccultVampire();
                    break;

                case OccultTypes.ImaginaryFriend:
                    OccultImaginaryFriend oldImFr = oldOccult as OccultImaginaryFriend;
                    if (oldImFr == null)
                    {
                        newOccult = new OccultImaginaryFriend();
                    }
                    else
                    {
                        newOccult = new OccultImaginaryFriend(oldImFr);
                    }
                    break;

                case OccultTypes.Unicorn:
                    newOccult = new OccultUnicorn();
                    break;

                case OccultTypes.Fairy:
                    newOccult = new OccultFairy();
                    break;

                case OccultTypes.Witch:
                    newOccult = new OccultWitch();
                    break;

                case OccultTypes.Genie:
                    newOccult = new OccultGenie();
                    break;

                case OccultTypes.Werewolf:
                    newOccult = new OccultWerewolf();
                    break;

                case OccultTypes.PlantSim:
                    newOccult = new OccultPlantSim();
                    break;

                case OccultTypes.Mermaid:
                    newOccult = new OccultMermaid();
                    break;

                case OccultTypes.TimeTraveler:
                    newOccult = new OccultTimeTraveler();
                    break;

                case OccultTypes.Robot:
                    newOccult = new OccultRobot();
                    break;
                }
            }

            if (newOccult == null)
            {
                return(false);
            }

            OccultTypes originalTypes      = ths.mCurrentOccultTypes;
            Role        assignedRole       = ths.mOwnerDescription.AssignedRole;
            float       alienDNAPercentage = ths.mOwnerDescription.AlienDNAPercentage;

            try
            {
                ths.mCurrentOccultTypes                   = OccultTypes.None;
                ths.mOwnerDescription.AssignedRole        = null;
                ths.mOwnerDescription.mAlienDNAPercentage = 0f;

                if (!newOccult.CanAdd(ths.mOwnerDescription, fromRestore))
                {
                    return(false);
                }
            }
            finally
            {
                ths.mCurrentOccultTypes                   = originalTypes;
                ths.mOwnerDescription.AssignedRole        = assignedRole;
                ths.mOwnerDescription.mAlienDNAPercentage = alienDNAPercentage;
            }

            if ((ths.mOwnerDescription.SupernaturalData == null) ||
                ((type == OccultTypes.Fairy) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.Fairy)) ||
                ((type == OccultTypes.Robot) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.Robot)) ||
                ((type == OccultTypes.PlantSim) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.PlantSim)))
            {
                ths.mOwnerDescription.AddSupernaturalData(type);
            }

            ths.mIsLifetimeReward = isReward;

            if (type == OccultTypes.Genie)
            {
                // Corrections for improper handling of the special outfits by OccultGenie
                if (ths.mOwnerDescription.mSpecialOutfitIndices == null)
                {
                    ths.mOwnerDescription.mSpecialOutfitIndices = new Dictionary <uint, int>();
                }

                addOutfit = false;
            }

            if (type == OccultTypes.Unicorn)
            {
                OccultUnicornEx.OnAddition(newOccult as OccultUnicorn, ths.mOwnerDescription, addOutfit);
            }

            ApplyTrait(ths.mOwnerDescription, type);

            MidlifeCrisisManager midlifeCrisisManager = ths.mOwnerDescription.MidlifeCrisisManager;

            try
            {
                // Inactive mummies don't agree with mid-life crisis managers
                ths.mOwnerDescription.MidlifeCrisisManager = null;

                newOccult.OnAddition(ths.mOwnerDescription, addOutfit, ths.mIsLifetimeReward, fromRestore);
            }
            finally
            {
                ths.mOwnerDescription.MidlifeCrisisManager = midlifeCrisisManager;
            }

            ths.mOccultList.Add(newOccult);
            ths.mCurrentOccultTypes |= type;
            EventTracker.SendEvent(new BeAnOccultEvent(EventTypeId.kBeAnOccult, ths.mOwnerDescription.CreatedSim, (uint)type));
            if (ths.mOwnerDescription.CreatedSim != null)
            {
                if (!Cane.IsAllowedToUseCane(ths.mOwnerDescription.CreatedSim))
                {
                    Cane.StopUsingAnyActiveCanes(ths.mOwnerDescription.CreatedSim);
                }
                if (!Backpack.IsAllowedToUseBackpack(ths.mOwnerDescription.CreatedSim))
                {
                    Backpack.StopUsingAnyActiveBackpacks(ths.mOwnerDescription.CreatedSim);
                }
                if (!Jetpack.IsAllowedToUseJetpack(ths.mOwnerDescription.CreatedSim))
                {
                    Jetpack.StopUsingAnyActiveJetpacks(ths.mOwnerDescription.CreatedSim);
                }
            }

            (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).OnSimDaysPerAgingYearChanged();
            ths.ClearOneShot();
            ths.UpdateOccultUI();
            if (!fromRestore)
            {
                EventTracker.SendEvent(EventTypeId.kBecameOccult, ths.mOwnerDescription.CreatedSim);
            }

            if (oldOccult != null)
            {
                newOccult.MergeOccultData(oldOccult);
            }

            if (ths.mOwnerDescription.CreatedSim != null)
            {
                Sim.StandingPosture standing = ths.mOwnerDescription.CreatedSim.Standing as Sim.StandingPosture;
                if (standing != null)
                {
                    standing.SetDefaultIdleAnim();
                }
            }

            return(true);
        }
Esempio n. 6
0
        public static Approach Perform(SimDescription sim, bool force, bool reset)
        {
            try
            {
                OutfitCategories[] categoriesArray = null;

                switch (sim.Species)
                {
                case CASAgeGenderFlags.Human:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday, OutfitCategories.Naked, OutfitCategories.Athletic, OutfitCategories.Formalwear, OutfitCategories.Sleepwear, OutfitCategories.Swimwear };
                    break;

                case CASAgeGenderFlags.Horse:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday, OutfitCategories.Naked, OutfitCategories.Racing, OutfitCategories.Bridle, OutfitCategories.Jumping };
                    break;

                default:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday, OutfitCategories.Naked };
                    break;
                }

                bool necessary = force;

                if (!necessary)
                {
                    foreach (OutfitCategories category in categoriesArray)
                    {
                        if (sim.IsHuman)
                        {
                            if (category == OutfitCategories.Naked)
                            {
                                continue;
                            }
                        }

                        SimOutfit outfit2 = sim.GetOutfit(category, 0);
                        if ((outfit2 == null) || (!outfit2.IsValid))
                        {
                            necessary = true;
                        }
                    }
                }

                if (!necessary)
                {
                    return(Approach.None);
                }

                SimOutfit sourceOutfit = null;

                for (int i = 0; i < 2; i++)
                {
                    OutfitCategoryMap map = null;
                    if (i == 0)
                    {
                        map = sim.mOutfits;
                    }
                    else
                    {
                        map = sim.mMaternityOutfits;
                    }

                    if (map == null)
                    {
                        continue;
                    }

                    foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories)))
                    {
                        if (category == OutfitCategories.Supernatural)
                        {
                            continue;
                        }

                        ArrayList outfits = map[category] as ArrayList;
                        if (outfits == null)
                        {
                            continue;
                        }

                        foreach (SimOutfit anyOutfit in outfits)
                        {
                            if ((anyOutfit != null) && (anyOutfit.IsValid))
                            {
                                sourceOutfit = anyOutfit;
                                break;
                            }
                        }
                    }
                }

                SimBuilder builder = new SimBuilder();
                builder.UseCompression = true;

                ResourceKey newTone = ValidateSkinTone(sim.SkinToneKey);

                builder.Age           = sim.Age;
                builder.Gender        = sim.Gender;
                builder.Species       = sim.Species;
                builder.SkinTone      = newTone;
                builder.SkinToneIndex = sim.SkinToneIndex;
                builder.MorphFat      = sim.mCurrentShape.Fat;
                builder.MorphFit      = sim.mCurrentShape.Fit;
                builder.MorphThin     = sim.mCurrentShape.Thin;

                Approach approach = Approach.Rerolled;

                GeneticsPet.SpeciesSpecificData speciesData = OutfitUtils.GetSpeciesSpecificData(sim);

                try
                {
                    if (sourceOutfit != null)
                    {
                        foreach (SimOutfit.BlendInfo blend in sourceOutfit.Blends)
                        {
                            builder.SetFacialBlend(blend.key, blend.amount);
                        }

                        CASParts.OutfitBuilder.CopyGeneticParts(builder, sourceOutfit);

                        approach = Approach.Recovered;
                    }
                    else
                    {
                        if (sim.Genealogy != null)
                        {
                            List <SimDescription> parents      = new List <SimDescription>();
                            List <SimDescription> grandParents = new List <SimDescription>();

                            foreach (SimDescription parent in Relationships.GetParents(sim))
                            {
                                parents.Add(parent);

                                foreach (SimDescription grandParent in Relationships.GetParents(parent))
                                {
                                    grandParents.Add(grandParent);
                                }
                            }

                            if (parents.Count > 0)
                            {
                                if (sim.IsHuman)
                                {
                                    Genetics.InheritFacialBlends(builder, parents.ToArray(), new Random());
                                }
                                else
                                {
                                    GeneticsPet.InheritBodyShape(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritBasePeltLayer(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritPeltLayers(builder, parents, grandParents, new Random());
                                }

                                approach = Approach.Reinherited;
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(sim, null, "Primary Outfit Creation", e);
                    return(Approach.None);
                }

                if (sim.IsRobot)
                {
                    OutfitUtils.AddMissingPartsBots(builder, (OutfitCategories)0x200002, true, sim);

                    Common.Sleep();

                    OutfitUtils.AddMissingPartsBots(builder, OutfitCategories.Everyday, true, sim);

                    Common.Sleep();
                }
                else if (sim.IsHuman)
                {
                    OutfitUtils.AddMissingParts(builder, (OutfitCategories)0x200002, true, sim, sim.IsAlien);

                    Common.Sleep();

                    OutfitUtils.AddMissingParts(builder, OutfitCategories.Everyday, true, sim, sim.IsAlien);

                    Common.Sleep();
                }
                else
                {
                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday | (OutfitCategories)0x200000, true, sim, speciesData);

                    Common.Sleep();

                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday, true, sim, speciesData);

                    Common.Sleep();
                }

                ResourceKey uniformKey = new ResourceKey();
                if (sim.IsHuman)
                {
                    if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, OutfitCategories.Everyday))
                    {
                        OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                    }
                }

                OutfitUtils.SetAutomaticModifiers(builder);

                sim.ClearOutfits(OutfitCategories.Career, false);
                sim.ClearOutfits(OutfitCategories.MartialArts, false);
                sim.ClearOutfits(OutfitCategories.Special, false);

                foreach (OutfitCategories category in categoriesArray)
                {
                    ArrayList outfits = null;

                    if (!force)
                    {
                        outfits = sim.Outfits[category] as ArrayList;
                        if (outfits != null)
                        {
                            int index = 0;
                            while (index < outfits.Count)
                            {
                                SimOutfit anyOutfit = outfits[index] as SimOutfit;
                                if (anyOutfit == null)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else if (!anyOutfit.IsValid)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else
                                {
                                    index++;
                                }
                            }
                        }
                    }

                    if ((outfits == null) || (outfits.Count == 0))
                    {
                        OutfitUtils.MakeCategoryAppropriate(builder, category, sim);

                        if (sim.IsHuman)
                        {
                            if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, category))
                            {
                                OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                            }
                        }

                        sim.RemoveOutfits(category, false);

                        CASParts.AddOutfit(sim, category, builder, true);
                    }

                    if (sim.IsUsingMaternityOutfits)
                    {
                        sim.BuildPregnantOutfit(category);
                    }
                }

                if (sim.IsMummy)
                {
                    OccultMummy.OnMerge(sim);
                }
                else if (sim.IsFrankenstein)
                {
                    OccultFrankenstein.OnMerge(sim, sim.OccultManager.mIsLifetimeReward);
                }
                else if (sim.IsGenie)
                {
                    OccultGenie.OverlayUniform(sim, OccultGenie.CreateUniformName(sim.Age, sim.Gender), ProductVersion.EP6, OutfitCategories.Everyday, CASSkinTones.BlueSkinTone, 0.68f);
                }
                else if (sim.IsImaginaryFriend)
                {
                    OccultImaginaryFriend friend = sim.OccultManager.GetOccultType(Sims3.UI.Hud.OccultTypes.ImaginaryFriend) as OccultImaginaryFriend;

                    OccultBaseClass.OverlayUniform(sim, OccultImaginaryFriend.CreateUniformName(sim.Age, friend.Pattern), ProductVersion.EP4, OutfitCategories.Special, CASSkinTones.NoSkinTone, 0f);
                }

                if (sim.IsMermaid)
                {
                    OccultMermaid.AddOutfits(sim, null);
                }


                if (sim.IsWerewolf)
                {
                    if (sim.ChildOrAbove)
                    {
                        SimOutfit newWerewolfOutfit = OccultWerewolf.GetNewWerewolfOutfit(sim.Age, sim.Gender);
                        if (newWerewolfOutfit != null)
                        {
                            sim.AddOutfit(newWerewolfOutfit, OutfitCategories.Supernatural, 0x0);
                        }
                    }
                }

                SimOutfit currentOutfit = null;
                if (sim.CreatedSim != null)
                {
                    if (reset)
                    {
                        ResetSimTask.Perform(sim.CreatedSim, false);
                    }

                    try
                    {
                        sim.CreatedSim.SwitchToOutfitWithoutSpin(Sim.ClothesChangeReason.GoingOutside, OutfitCategories.Everyday, true);
                    }
                    catch (Exception e)
                    {
                        Common.DebugException(sim, e);
                    }

                    currentOutfit = sim.CreatedSim.CurrentOutfit;
                }
                else
                {
                    currentOutfit = sim.GetOutfit(OutfitCategories.Everyday, 0);
                }

                if (currentOutfit != null)
                {
                    ThumbnailManager.GenerateHouseholdSimThumbnail(currentOutfit.Key, currentOutfit.Key.InstanceId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, sim.AgeGenderSpecies);
                }

                return(approach);
            }
            catch (Exception e)
            {
                Common.Exception(sim, e);
                return(Approach.None);
            }
        }
Esempio n. 7
0
        protected static OptionResult ApplyOutfit(SimDescription sim, OutfitCategories category)
        {
            ResourceKey newOutfitKey = ResourceKey.kInvalidResourceKey;

            if (sim.IsMummy)
            {
                newOutfitKey = OccultMummy.CreateMummyUniform(sim.Age, sim.Gender).Key;
            }
            else if (sim.IsFrankenstein)
            {
                newOutfitKey = OccultBaseClass.CreateUniform(OccultFrankenstein.CreateUniformName(sim, sim.OccultManager.mIsLifetimeReward), sim.Age, ProductVersion.EP2, CASSkinTones.NoSkinTone, 0f).Key;
            }
            else if (sim.IsImaginaryFriend)
            {
                OccultImaginaryFriend friend = sim.OccultManager.GetOccultType(OccultTypes.ImaginaryFriend) as OccultImaginaryFriend;

                string name;
                newOutfitKey = OccultImaginaryFriend.CreateImaginaryFriendUniform(sim.Age, friend.Pattern, out name).Key;
            }
            else
            {
                SimOutfit source = null;
                if (sim.GetOutfitCount(OutfitCategories.Naked) > 0)
                {
                    source = sim.GetOutfit(OutfitCategories.Naked, 0);
                }
                else if (sim.GetOutfitCount(category) > 0)
                {
                    source = sim.GetOutfit(category, 0);
                }

                if (source != null)
                {
                    using (SimBuilder builder = new SimBuilder())
                    {
                        OutfitUtils.SetOutfit(builder, source, sim);

                        OutfitUtils.MakeCategoryAppropriate(builder, category, sim);

                        newOutfitKey = builder.CacheOutfit(CASParts.GetOutfitName(sim, category, sim.IsUsingMaternityOutfits));
                    }
                }
            }

            if (newOutfitKey == ResourceKey.kInvalidResourceKey)
            {
                return(OptionResult.Failure);
            }

            sim.AddOutfit(new SimOutfit(newOutfitKey), category, false);

            int index = sim.GetOutfitCount(category) - 1;

            ArrayList list = sim.GetCurrentOutfits()[category] as ArrayList;

            object a = list[0];
            object b = list[index];

            list[0]     = b;
            list[index] = a;

            return(OptionResult.SuccessClose);
        }
Esempio n. 8
0
        public override bool Run()
        {
            try
            {
                if (!Target.RouteToWorkbench(Actor))
                {
                    return(false);
                }

                mMakeFemale  = Target.mIsMakingFemaleFrankensim;
                mInventSkill = Actor.SkillManager.AddElement(SkillNames.Inventing) as InventingSkill;
                bool flag = Target.mInventionProgress > 0f;
                if (!flag)
                {
                    Definition interactionDefinition = InteractionDefinition as Definition;
                    mMakeFemale = interactionDefinition.MakeFemale;
                    Target.mIsMakingFemaleFrankensim = mMakeFemale;
                    ConsumeIngredients();
                }

                StandardEntry();
                Target.mIsMakingFrankensim      = true;
                Target.mFrankenSimInventorSimId = Actor.SimDescription.SimDescriptionId;
                StartStages();
                mTimeUntilModelSwap = GetTimeForNextModelChange();
                EnterStateMachine("WorkbenchInvention", "Enter", "x", "workstation");
                SetParameter("shouldSwipe", !flag);
                SetParameter("skillLevel", InventionWorkbench.GetSkillLevelParam(mInventSkill));
                if (!flag)
                {
                    AddSynchronousOneShotScriptEventHandler(0x67, OnAnimationEvent);
                }

                mTotalTime = GetTimeToCompletion();
                AnimateSim("Loop Invent");
                BeginCommodityUpdates();
                if (Actor.SimDescription.TeenOrAbove)
                {
                    Actor.SkillManager.StartGainWithoutSkillMeter(SkillNames.Handiness, InventionWorkbench.kHandinessSkillGainRateDuringMake, true);
                }

                bool succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), MakeLoopCallback, mCurrentStateMachine);
                if (Actor.SimDescription.TeenOrAbove)
                {
                    Actor.SkillManager.StopSkillGain(SkillNames.Handiness);
                }

                EndCommodityUpdates(succeeded);
                AnimateSim("Exit");
                if (!mRecipeKnown && !Actor.OpportunityManager.HasOpportunity(OpportunityNames.EP2_SkillInventing_Frankensim4))
                {
                    Target.ScrapCurrentInvention();
                }

                if (Target.mInventionProgress >= 1f)
                {
                    Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.Gameplay.Gameflow.GameSpeed.Normal, Sims3.Gameplay.Gameflow.SetGameSpeedContext.Gameplay);
                    RouteAwayFromTable();
                    Target.mDummyModel.UnParent();
                    Target.mDummyModel.Destroy();
                    Target.mDummyModel               = null;
                    Target.mInventionProgress        = 0f;
                    Target.mIsMakingFrankensim       = false;
                    Target.mFrankenSimInventorSimId  = 0x0L;
                    Target.mIsMakingFemaleFrankensim = false;
                    Target.mWasFinishedByGnome       = false;
                    Target.mIsMakingCheapToy         = false;
                    CASAgeGenderFlags gender = mMakeFemale ? CASAgeGenderFlags.Female : CASAgeGenderFlags.Male;
                    mFrankensim = OccultFrankenstein.CreateFrankenStein(Actor, gender);
                    mFrankensim.FadeOut(false, false, 0f);
                    mFrankensim.GreetSimOnLot(Target.LotCurrent);
                    mFrankensim.SetPosition(Target, Slot.RoutingSlot_1);
                    mFrankensim.SetForward((Vector3)(Slots.GetForwardOfSlot(Target.ObjectId, Slot.RoutingSlot_1) * -1f));
                    mFrankensim.AddToWorld();
                    InventingSkill skill = Actor.SkillManager.GetSkill <InventingSkill>(SkillNames.Inventing);
                    if (!skill.OppKnowFrankensimRecipeCompleted)
                    {
                        EventTracker.SendEvent(EventTypeId.kDiscoveredNewInvention, Actor, mFrankensim);
                    }
                    mCurrentStateMachine = StateMachineClient.Acquire(mFrankensim, "WorkbenchFrankensim", AnimationPriority.kAPDefault);
                    SetActor("workstation", Target);
                    SetActor("x", mFrankensim);
                    SetActor("y", Actor);
                    AddSynchronousOneShotScriptEventHandler(0x65, OnAnimationEvent);
                    EnterState("x", "Enter");
                    AnimateSim("Exit");
                    AdoptFrankenSim(Actor, mFrankensim);
                    skill.KnowsFrankensimRecipe = true;
                    skill.TestForNewLifetimeOpp();
                    EventTracker.SendEvent(EventTypeId.kFrankensimLearned, Actor);
                }

                StandardExit();
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }