Ejemplo n.º 1
0
        public static void OnGotBuff(Event e)
        {
            HasGuidEvent <BuffNames> buffEvent = e as HasGuidEvent <BuffNames>;

            Dictionary <ulong, bool> sims;

            if (!sBuffChecks.TryGetValue(buffEvent.Guid, out sims))
            {
                sims = new Dictionary <ulong, bool>();
                sBuffChecks.Add(buffEvent.Guid, sims);
            }

            if (sims.ContainsKey(e.Actor.SimDescription.SimDescriptionId))
            {
                return;
            }
            sims.Add(e.Actor.SimDescription.SimDescriptionId, true);

            List <Homemaker> careers = GetCareerForSim(e);

            if (careers != null)
            {
                switch (buffEvent.Guid)
                {
                case BuffNames.StirCrazy:
                    if (careers[0].ImmuneToStirCrazy)
                    {
                        e.Actor.BuffManager.RemoveElement(buffEvent.Guid);
                    }
                    break;
                }

                if (HomemakerGoodParentMoodletBooter.IsBuff(buffEvent.Guid))
                {
                    Homemaker.AddMarks(careers, Homemaker.StipendValue.GoodMoodlet, 1);
                }
            }

            careers = GetCareerOfGuardian(e, false);
            if (careers != null)
            {
                if (HomemakerGoodChildMoodletBooter.IsBuff(buffEvent.Guid))
                {
                    Homemaker.AddMarks(careers, Homemaker.StipendValue.GoodMoodlet, 1);
                }
                else if (HomemakerBadMoodletBooter.IsBuff(buffEvent.Guid))
                {
                    Homemaker.AddMarks(careers, Homemaker.StipendValue.BadMoodlet, 1);
                }
            }

            if (HomemakerBadLotMoodletBooter.IsBuff(buffEvent.Guid))
            {
                Homemaker.AddMarks(GetCareerForHousehold(e.Actor.LotCurrent.Household), Homemaker.StipendValue.BadMoodlet, 1);
            }
            else if (HomemakerGoodLotMoodletBooter.IsBuff(buffEvent.Guid))
            {
                Homemaker.AddMarks(GetCareerForHousehold(e.Actor.LotCurrent.Household), Homemaker.StipendValue.GoodMoodlet, 1);
            }
        }
Ejemplo n.º 2
0
        public override bool IsSuccess(Event e)
        {
            if (e.Id != EventTypeId.kGotBuff)
            {
                return(false);
            }

            HasGuidEvent <BuffNames> buffEvent = e as HasGuidEvent <BuffNames>;

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

            if (!mBuffs.Contains(buffEvent.Guid))
            {
                return(false);
            }

            if (mOrigins.Count > 0)
            {
                BuffInstance buff = e.Actor.BuffManager.GetElement(buffEvent.Guid);
                if (buff != null)
                {
                    if (!mOrigins.Contains(buff.BuffOrigin))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
        protected override Scenario Handle(Event e, ref ListenerAction result)
        {
            HasGuidEvent <BuffNames> bEvent = e as HasGuidEvent <BuffNames>;

            if (bEvent == null)
            {
                return(null);
            }

            if (!Allow(bEvent.Guid))
            {
                return(null);
            }

            return(base.Handle(e, ref result));
        }
Ejemplo n.º 4
0
        protected static void OnBuff(Event e)
        {
            HasGuidEvent <BuffNames> buffEvent = e as HasGuidEvent <BuffNames>;

            if (buffEvent == null)
            {
                return;
            }

            if (buffEvent.Guid != BuffNames.Werewolf)
            {
                return;
            }

            Transform(e.Actor.SimDescription);
        }
Ejemplo n.º 5
0
        protected static void OnLearnedSkill(Event e)
        {
            HasGuidEvent <SkillNames> skillEvent = e as HasGuidEvent <SkillNames>;

            if (skillEvent == null)
            {
                return;
            }

            if (skillEvent.Guid != SkillNames.Collecting)
            {
                return;
            }

            EnactCorrections(skillEvent.HasGuidObject as Collecting);
        }
Ejemplo n.º 6
0
        public static void OnSkillLearned(Event e)
        {
            HasGuidEvent <SkillNames> skillEvent = e as HasGuidEvent <SkillNames>;

            if (HomemakerTaughtSkillBooter.IsSkill(skillEvent.Guid))
            {
                Homemaker.AddMarks(GetCareerOfGuardian(e), Homemaker.StipendValue.TaughtChildSkill, 1);
            }

            if (HomemakerChildSkillBooter.IsSkill(skillEvent.Guid))
            {
                Homemaker.AddMarks(GetCareerOfGuardian(e), Homemaker.StipendValue.ChildLearnedSkill, 1);
            }

            if (HomemakerParentSkillBooter.IsSkill(skillEvent.Guid))
            {
                Homemaker.AddMarks(GetCareerForSim(e), Homemaker.StipendValue.ParentLearnedSkill, 1);
            }
        }
Ejemplo n.º 7
0
        protected override Scenario Handle(Event e, ref ListenerAction result)
        {
            HasGuidEvent <SkillNames> skillEvent = e as HasGuidEvent <SkillNames>;

            if (skillEvent == null)
            {
                return(null);
            }

            if (skillEvent.Actor == null)
            {
                return(null);
            }

            if (skillEvent.Actor.SkillManager == null)
            {
                return(null);
            }

            mLevel = skillEvent.Actor.SkillManager.GetSkillLevel(skillEvent.Guid);

            return(base.Handle(e, ref result));
        }
Ejemplo n.º 8
0
        public static void OnLeveled(Event e)
        {
            HasGuidEvent <SkillNames> skillEvent = e as HasGuidEvent <SkillNames>;

            if (skillEvent == null)
            {
                return;
            }

            if (skillEvent.Guid != SkillNames.Athletic)
            {
                return;
            }

            Sim actor = e.Actor as Sim;

            if (actor == null)
            {
                return;
            }

            if (actor.InteractionQueue == null)
            {
                return;
            }

            InteractionInstance interaction = actor.InteractionQueue.GetCurrentInteraction();

            if (interaction == null)
            {
                return;
            }

            AthleticGameObject gameobj = interaction.Target as AthleticGameObject;

            if (gameobj == null)
            {
                return;
            }

            Sim trainer = gameobj.OtherActor(actor);

            if (trainer == null)
            {
                return;
            }

            if (trainer.Household == actor.Household)
            {
                return;
            }

            float cash = GetPay(trainer);

            if (cash == 0)
            {
                return;
            }

            cash *= 2;

            if (sAccrued.ContainsKey(actor.SimDescription.SimDescriptionId))
            {
                sAccrued[actor.SimDescription.SimDescriptionId] += cash;
            }
            else
            {
                sAccrued.Add(actor.SimDescription.SimDescriptionId, cash);
            }
        }
Ejemplo n.º 9
0
        public static void OnLeveled(Event e)
        {
            HasGuidEvent <SkillNames> skillEvent = e as HasGuidEvent <SkillNames>;

            if (skillEvent == null)
            {
                return;
            }

            if (skillEvent.Guid != SkillNames.MartialArts)
            {
                return;
            }

            Sim actor = e.Actor as Sim;

            if (actor == null)
            {
                return;
            }

            if (actor.InteractionQueue == null)
            {
                return;
            }

            InteractionInstance interaction = actor.InteractionQueue.GetCurrentInteraction();

            if (interaction == null)
            {
                return;
            }

            TrainingDummy gameobj = interaction.Target as TrainingDummy;

            if (gameobj == null)
            {
                return;
            }

            Sim trainer = gameobj.OtherActor(actor);

            if (trainer == null)
            {
                return;
            }

            if (trainer.Household == actor.Household)
            {
                return;
            }

            float cash = GetPay(trainer);

            if (cash == 0)
            {
                return;
            }

            cash *= 2;

            Common.Notify("Bonus: " + cash);

            AddAccrued(actor, trainer, cash);
        }