Exemple #1
0
        protected override bool PrivateAllow(IScoringGenerator stats, SimDescription sim, SimData settings, AllowCheck check)
        {
            if (sim.LotHome == null)
            {
                stats.IncStat("Allow: Homeless");
                return(false);
            }

            if (!settings.GetValue <AllowPersonalityOption, bool>())
            {
                stats.IncStat("Allow: User Denied");
                return(false);
            }

            SimPersonality personality = stats as SimPersonality;

            if (personality == null)
            {
                IHasPersonality hasPersonality = stats as IHasPersonality;
                if (hasPersonality != null)
                {
                    personality = hasPersonality.Personality;
                }
                else
                {
                    Scenario scenario = stats as Scenario;
                    if (scenario != null)
                    {
                        personality = scenario.Manager as SimPersonality;
                    }
                }
            }

            if (personality == null)
            {
                Common.DebugStackLog(stats.GetType().ToString());
                //stats.IncStat("Allow: Incorrect Manager");
                //return false;
            }
            else if (settings.HasValue <DisallowPersonalityOption, SimPersonality>(personality))
            {
                stats.IncStat("Allow: Personality Denied");
                return(false);
            }

            return(true);
        }
Exemple #2
0
        protected static bool OnAllowSkill(Common.IStatGenerator stats, SimData settings, SkillNames skill)
        {
            if (settings.HasValue <DisallowSkillOption, SkillNames>(skill))
            {
                stats.IncStat("Allow: " + skill + " Denied");
                return(false);
            }
            else if (settings.GetValue <AllowOnlyExistingSkillOption, bool>())
            {
                if (settings.SimDescription.SkillManager.GetSkillLevel(skill) < 1)
                {
                    stats.IncStat("Allow: " + skill + " Only Existing Denied");
                    return(false);
                }
            }

            return(true);
        }