Example #1
0
        public void HandleMoochSkill(SimDescription sim, float incSkill)
        {
            Skill skill = sim.SkillManager.AddElement(SkillNames.Mooch);

            if (sim.Child)
            {
                skill.AddSkillPointsLevelClamped(incSkill, TraitTuning.MoochTraitChildSkill);
            }
            else if (sim.Teen)
            {
                skill.AddSkillPointsLevelClamped(incSkill, TraitTuning.MoochTraitTeenSkill);
            }
            else
            {
                skill.AddPoints(incSkill);
            }
        }
Example #2
0
        public static void AfterMoochMoney(Sim actor, Sim target, float moochSkillPoints, int moochSkillLevel)
        {
            try
            {
                Skill skill = actor.SkillManager.AddElement(SkillNames.Mooch);
                if (actor.SimDescription.Child)
                {
                    skill.AddSkillPointsLevelClamped(moochSkillPoints, TraitTuning.MoochTraitChildSkill);
                }
                else if (actor.SimDescription.Teen)
                {
                    skill.AddSkillPointsLevelClamped(moochSkillPoints, TraitTuning.MoochTraitTeenSkill);
                }
                else
                {
                    skill.AddPoints(moochSkillPoints);
                }

                int delta = Mooch.MoochAmounts[moochSkillLevel];
                if (RandomUtil.RandomChance01(TraitTuning.MoochTraitMoneyQuadChance))
                {
                    delta *= 0x4;
                }
                else if (RandomUtil.RandomChance01(TraitTuning.MoochTraitMoneyDoubleChance))
                {
                    delta *= 0x2;
                }
                delta = (int)(delta * RandomUtil.RandomFloatGaussianDistribution(TraitTuning.MoochTraitMoneyRandomBegin, TraitTuning.MoochTraitMoneyRandomEnd));

                NRaas.StoryProgression.Main.Money.AdjustFunds(target.SimDescription, "GiveAway", -delta);

                NRaas.StoryProgression.Main.Money.AdjustFunds(actor.SimDescription, "GiveAway", delta);

                actor.ShowTNSIfSelectable(SocialCallback.LocalizeString(actor.IsFemale, "MoochMoney", new object[] { actor, delta, target }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, target.ObjectId);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }