Example #1
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            if (sSkills == null)
            {
                sSkills = new Dictionary <Sims3.Gameplay.Skills.SkillNames, InteractionDefinition>();

                sSkills.Add(Sims3.Gameplay.Skills.SkillNames.Guitar, GuitarPlayForTips.Singleton);
                sSkills.Add(Sims3.Gameplay.Skills.SkillNames.BassGuitar, BassGuitarPlayForTips.Singleton);
                sSkills.Add(Sims3.Gameplay.Skills.SkillNames.Piano, PianoPlayForTips.Singleton);
                sSkills.Add(Sims3.Gameplay.Skills.SkillNames.Drums, DrumsPlayForTips.Singleton);
                sSkills.Add(Sims3.Gameplay.Skills.SkillNames.LaserHarp, LaserHarpPlayForTips.Singleton);
            }

            List <Sims3.Gameplay.Skills.SkillNames> choices = new List <Sims3.Gameplay.Skills.SkillNames>();

            SimData data = Options.GetSim(Sim);

            foreach (Sims3.Gameplay.Skills.SkillNames skill in sSkills.Keys)
            {
                if (!Skills.AllowSkill(this, Sim, data, skill))
                {
                    continue;
                }

                choices.Add(skill);
            }

            if (choices.Count == 0)
            {
                IncStat("No Choices");
                return(false);
            }

            BandInstrument        instrument = null;
            InteractionDefinition definition = null;

            RandomUtil.RandomizeListOfObjects(choices);

            foreach (Sims3.Gameplay.Skills.SkillNames skill in choices)
            {
                switch (skill)
                {
                case Sims3.Gameplay.Skills.SkillNames.Guitar:
                    instrument = Inventories.InventoryFind <Guitar>(Sim);
                    if (instrument == null)
                    {
                        instrument = ManagedBuyProduct <Guitar> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills);
                    }
                    break;

                case Sims3.Gameplay.Skills.SkillNames.BassGuitar:
                    instrument = Inventories.InventoryFind <BassGuitar>(Sim);
                    if (instrument == null)
                    {
                        instrument = ManagedBuyProduct <BassGuitar> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills);
                    }
                    break;

                case Sims3.Gameplay.Skills.SkillNames.Piano:
                    instrument = Inventories.InventoryFind <Piano>(Sim);
                    if (instrument == null)
                    {
                        instrument = ManagedBuyProduct <Piano> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills);
                    }
                    break;

                case Sims3.Gameplay.Skills.SkillNames.Drums:
                    instrument = Inventories.InventoryFind <Drums>(Sim);
                    if (instrument == null)
                    {
                        instrument = ManagedBuyProduct <Drums> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills);
                    }
                    break;

                case Sims3.Gameplay.Skills.SkillNames.LaserHarp:
                    instrument = Inventories.InventoryFind <LaserHarp>(Sim);
                    if (instrument == null)
                    {
                        instrument = ManagedBuyProduct <LaserHarp> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills);
                    }
                    break;
                }

                if (instrument != null)
                {
                    definition = sSkills[skill];
                    break;
                }
            }

            if (instrument == null)
            {
                IncStat("No Instrument");
                return(false);
            }

            Lot lot = Sim.CreatedSim.LotCurrent;

            if ((Sim.LotHome == lot) || (lot.IsWorldLot) || (lot.IsResidentialLot))
            {
                if (!Situations.PushVisit(this, Sim, Lots.GetCommunityLot(Sim.CreatedSim, null, true)))
                {
                    IncStat("Push Lot Fail");
                    return(false);
                }
            }

            return(Situations.PushInteraction(this, Sim, instrument, definition));
        }
Example #2
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            mNet = 0;

            Camera camera = ManagedBuyProduct <Camera> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills);

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

            Photography skill = Sim.SkillManager.GetSkill <Photography>(SkillNames.Photography);

            if (skill == null)
            {
                skill = Sim.SkillManager.AddElement(SkillNames.Photography) as Photography;
            }

            List <PhotographSize> sizes = new List <PhotographSize>();

            foreach (PhotographSize size in sSizes)
            {
                if (Photography.SizeUnlocked(skill, size))
                {
                    sizes.Add(size);
                }
            }

            if (sizes.Count == 0)
            {
                IncStat("No Sizes");
                return(false);
            }

            List <PaintingStyle> styles = new List <PaintingStyle>();

            foreach (PaintingStyle style in sStyles)
            {
                if (Photography.StyleUnlocked(skill, style))
                {
                    styles.Add(style);
                }
            }

            if (styles.Count == 0)
            {
                IncStat("No Styles");
                return(false);
            }

            List <SubjectDefinition> subjects = new List <SubjectDefinition>();

            foreach (CollectionDefinition collection in PhotographySubjects.sCollectionDefinitions.Values)
            {
                if (!collection.AvailableForSkill(skill))
                {
                    continue;
                }

                if (collection.Location != WorldName.UserCreated)
                {
                    continue;
                }

                foreach (SubjectDefinition definition in collection.Subjects)
                {
                    try
                    {
                        if (!definition.AvailableForSkill(skill))
                        {
                            continue;
                        }
                    }
                    catch
                    {
                        continue;
                    }

                    subjects.Add(definition);
                }
            }

            if (subjects.Count == 0)
            {
                IncStat("No Subjects");
                return(false);
            }

            int additional = AddScoring("AdditionalPhoto", Sim);

            int total = Sims3.Gameplay.Core.RandomUtil.GetInt(GetValue <Option, int>() + additional);

            if (total <= 0)
            {
                total = 1;
            }

            int totalFunds = 0;

            for (int i = 0; i < total; i++)
            {
                PhotographSize size  = Sims3.Gameplay.Core.RandomUtil.GetRandomObjectFromList(sizes);
                PaintingStyle  style = Sims3.Gameplay.Core.RandomUtil.GetRandomObjectFromList(styles);

                int cost = Photography.GetCostToTakePhoto(skill, camera, size, style);
                if (Sim.FamilyFunds < cost)
                {
                    continue;
                }

                float x    = 0f;
                float num3 = 1f;
                float num5 = 0f;
                float num6 = 1f;

                SubjectDefinition subject = Sims3.Gameplay.Core.RandomUtil.GetRandomObjectFromList(subjects);

                skill.ApplyMultiplier(ref num6, camera.CameraTuning.ValueMultiplier, "Value", "CameraTuning");

                bool newSubject, firstShotTodayOfSubject, collectionComplete;
                UpdateRecords(skill, camera, subject, style, size, out newSubject, out firstShotTodayOfSubject, out collectionComplete);

                if (newSubject)
                {
                    skill.ApplyBonus(ref x, (float)subject.SkillPoints, "Skill Gain", "Subject Tuning (New Subject)");
                    skill.ApplyBonus(ref num5, (float)subject.Value, "Value", "Subject Tuning (New Subject)");
                }
                else if (firstShotTodayOfSubject)
                {
                    skill.ApplyBonus(ref x, subject.SkillPoints * Photography.kFirstShotOfTheDaySkillGainMultiplier, "Skill Gain", "Subject Tuning (First Time Today)");
                    skill.ApplyBonus(ref num5, subject.Value * Photography.kFirstShotOfTheDayValueMultiplier, "Value", "Subject Tuning (First Time Today)");
                }

                if (Sims3.Gameplay.Core.RandomUtil.RandomChance((skill.MaxSkillLevel - (skill.SkillLevel - 1)) * 10))
                {
                    skill.ApplyMultiplier(ref num6, Photography.kBadPhotoValueMultiplier, "Value", "Bad Photo (kBadPhotoValueMultiplier)");
                }

                skill.ApplyMultiplier(ref num6, Photography.sValueMultipliers[skill.SkillLevel], "Value", "Sim's Skill Level");
                skill.ApplyMultiplier(ref num6, Photography.sSizeData[size].ValueMultiplier, "Value", "Photo Size");
                skill.ApplyMultiplier(ref num6, Photography.sStyleData[style].ValueMultiplier, "Value", "Photo Style");

                if (collectionComplete)
                {
                    skill.ApplyMultiplier(ref num6, subject.Collection.ValueMultiplierWhenComplete, "Value", "Collection Tuning (Complete)");
                }
                else
                {
                    skill.ApplyMultiplier(ref num6, subject.Collection.ValueMultiplier, "Value", "Collection Tuning");
                }

                if (Sim.TraitManager.HasElement(TraitNames.PhotographersEye))
                {
                    skill.ApplyMultiplier(ref num6, TraitTuning.PhotographersEyePhotographValueMultiplier, "Value", "Photographer's Eye (TraitTuning)");
                }

                skill.ApplyMultiplier(ref num3, camera.CameraTuning.SkillGainMultiplier, "Skill Gain", "CameraTuning");

                int funds = (int)((Photography.kBaseValuePerPhoto + num5) * num6);

                if ((funds < cost) && (additional > 0))
                {
                    IncStat("Try Again");
                    total++;
                    additional--;
                }

                skill.EarnedMoneyFromPhotography((uint)funds);
                skill.UpdateXpForEarningMoney(funds);

                totalFunds += funds;

                AddStat("Subject: " + subject.Name, funds);

                AddStat("Funds", funds);

                Money.AdjustFunds(Sim, "Photography", -cost);

                AddStat("Cost", cost);

                skill.SpentMoneyOnPhotography((uint)cost);

                AddScoring("Net", funds - cost);

                mNet += (funds - cost);

                float points = (Photography.kBaseSkillGainPerPhoto + x) * num3;

                AddStat("Skill", points);

                skill.AddPoints(points);
                skill.CheckForCompletedOpportunities();
            }

            Money.AdjustFunds(Sim, "Photography", totalFunds);

            return(mNet > 0);
        }
Example #3
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            ManagedBuyProduct <ComputerLaptop> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryComputers);

            List <Computer> computers = new List <Computer>();

            List <Computer> inventory = new List <Computer>();

            foreach (Computer computer in Inventories.InventoryFindAll <Computer>(Sim))
            {
                inventory.Add(computer);

                if (!computer.IsComputerUsable(Sim.CreatedSim, true, false, true))
                {
                    continue;
                }

                computers.Add(computer);
            }

            if (computers.Count == 0)
            {
                Computer broken = null;

                foreach (Lot lot in ManagerLot.GetOwnedLots(Sim))
                {
                    foreach (Computer computer in lot.GetObjects <Computer>())
                    {
                        if (!computer.IsComputerUsable(Sim.CreatedSim, true, false, true))
                        {
                            broken = computer;
                            continue;
                        }

                        computers.Add(computer);
                    }
                }

                if (computers.Count == 0)
                {
                    if (inventory.Count > 0)
                    {
                        foreach (Computer computer in inventory)
                        {
                            Money.Sell(Sim, computer);
                        }

                        IncStat("Sell Broken");
                    }

                    if (broken != null)
                    {
                        IncStat("Push Repair");

                        Add(frame, new ScheduledRepairScenario(Sim, broken), ScenarioResult.Start);
                        return(false);
                    }
                    else
                    {
                        IncStat("No Computer");
                        return(false);
                    }
                }
            }
            else if ((Sim.CreatedSim.LotCurrent == null) || (!Sim.CreatedSim.LotCurrent.CanSimTreatAsHome(Sim.CreatedSim)))
            {
                Situations.PushGoHome(this, Sim);
            }

            if (GetValue <RefineWritingOption, bool>())
            {
                return(Situations.PushInteraction(this, Sim, RandomUtil.GetRandomObjectFromList(computers), Computer.PracticeWriting.Singleton));
            }
            else
            {
                return(Situations.PushInteraction(this, Sim, RandomUtil.GetRandomObjectFromList(computers), NRaas.StoryProgressionSpace.Interactions.WriteNovelEx.Singleton));
            }
        }