protected static bool GiveTip(BandInstrument ths, Sim tipper, Sim player, int moneyPerLevel, int moneyPerComposition)
        {
            if (ths.mTipJar == null)
            {
                return(false);
            }
            Route r = tipper.CreateRoute();
            RadialRangeDestination destination = new RadialRangeDestination();

            destination.mCenterPoint       = ths.mTipJar.Position;
            destination.mConeVector        = ths.mTipJar.ForwardVector;
            destination.mFacingPreference  = RouteOrientationPreference.TowardsObject;
            destination.mfConeAngle        = 3.141593f;
            destination.mfMinRadius        = 1.25f;
            destination.mfPreferredSpacing = 0.1f;
            destination.mTargetObject      = ths.mTipJar;
            r.AddDestination(destination);
            r.SetValidRooms(0x0L, null);
            r.ExitReasonsInterrupt &= -33;
            r.Plan();
            if (!tipper.DoRoute(r))
            {
                return(false);
            }
            tipper.PlaySoloAnimation("a2o_guitar_tip_x", true);
            BandSkill skill = player.SkillManager.GetSkill <BandSkill>(ths.SkillName);
            int       delta = skill.SkillLevel * moneyPerLevel;

            delta += skill.NumberCompositionsPlayed() * moneyPerComposition;
            delta  = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25);
            delta++;

            RockBand.GiveXpForMoney(player, delta);

            NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta);

            int original = skill.mMoneyMadeFromGuitarPlaying;

            skill.MadeTips(delta, false);

            delta = skill.mMoneyMadeFromGuitarPlaying - original;

            NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta);

            return(true);
        }
Esempio n. 2
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));
        }