예제 #1
0
        public override void Parse(XmlDbRow row)
        {
            base.Parse(row);

            mMinIntensityDuration = row.GetFloat("MinIntensityDuration", 0);
            mTransitionTime.First = row.GetFloat("MinTransitionTime", 0);
            mTransitionTime.Second = row.GetFloat("MaxTransitionTime", 0);
            mIntensityWeights = new List<int>();
            mIntensityWeights.Add(row.GetInt("LightWeight", 0));
            mIntensityWeights.Add(row.GetInt("ModerateWeight", 0));
            mIntensityWeights.Add(row.GetInt("HeavyWeight", 0));
            mIntensityChangeWeights = new List<int>();

            foreach (string strValue in row.GetStringList("NumIntensityChangeWeights", ','))
            {
                float value;
                if (float.TryParse(strValue, out value))
                {
                    mIntensityChangeWeights.Add((int)value);
                }
                else
                {
                    mIntensityChangeWeights.Add(0);
                }
            }
        }
예제 #2
0
        public override void Parse(XmlDbRow row)
        {
            base.Parse(row);

            mMinIntensityDuration  = row.GetFloat("MinIntensityDuration", 0);
            mTransitionTime.First  = row.GetFloat("MinTransitionTime", 0);
            mTransitionTime.Second = row.GetFloat("MaxTransitionTime", 0);
            mIntensityWeights      = new List <int>();
            mIntensityWeights.Add(row.GetInt("LightWeight", 0));
            mIntensityWeights.Add(row.GetInt("ModerateWeight", 0));
            mIntensityWeights.Add(row.GetInt("HeavyWeight", 0));
            mIntensityChangeWeights = new List <int>();

            foreach (string strValue in row.GetStringList("NumIntensityChangeWeights", ','))
            {
                float value;
                if (float.TryParse(strValue, out value))
                {
                    mIntensityChangeWeights.Add((int)value);
                }
                else
                {
                    mIntensityChangeWeights.Add(0);
                }
            }
        }
예제 #3
0
        public WeightedStage(XmlDbRow row)
            : base(row)
        {
            if (!BooterLogger.Exists(row, "NextStages", Name))
            {
                return;
            }
            if (!BooterLogger.Exists(row, "NextWeights", Name))
            {
                return;
            }

            List <string> nextStages  = row.GetStringList("NextStages", ',');
            List <string> nextWeights = row.GetStringList("NextWeights", ',');

            if (nextStages.Count != nextWeights.Count)
            {
                BooterLogger.AddError(Name + " NextStages/NextWeights Size Mismatch");

                mNextStages  = new Pair <string, int>[] { new Pair <string, int> ("", 0) };
                mNextWeights = new int[] { 1 };

                return;
            }

            mNextStages  = new Pair <string, int> [nextStages.Count];
            mNextWeights = new int[nextWeights.Count];

            for (int i = 0; i < nextStages.Count; i++)
            {
                mNextStages[i].First = nextStages[i];

                if (!int.TryParse(nextWeights[i], out mNextWeights[i]))
                {
                    BooterLogger.AddError(Name + " NextWeights not numeric: " + nextWeights[i]);
                    return;
                }
            }

            foreach (int weight in mNextWeights)
            {
                mTotalWeight += weight;
            }
        }
예제 #4
0
        public MoodletTest(XmlDbRow row)
        {
            string name = row.GetString("GUID");

            if (!row.Exists("BuffName"))
            {
                BooterLogger.AddError(name + " BuffName Missing");
            }
            else
            {
                foreach (string buffStr in row.GetStringList("BuffName", ','))
                {
                    BuffNames buff;
                    if (ParserFunctionsEx.Parse(buffStr, out buff))
                    {
                        mBuffs.Add(buff);
                    }
                    else
                    {
                        BooterLogger.AddError(name + " Unknown BuffName: " + buffStr);
                    }
                }
            }

            if (row.Exists("Origin"))
            {
                foreach (string originStr in row.GetStringList("Origin", ','))
                {
                    Origin origin;
                    if (ParserFunctionsEx.Parse(originStr, out origin))
                    {
                        mOrigins.Add(origin);
                    }
                    else
                    {
                        BooterLogger.AddError(name + " Unknown Origin: " + origin);
                    }

                    mOrigins.Add(origin);
                }
            }
        }
예제 #5
0
        public MoodletTest(XmlDbRow row)
        {
            string name = row.GetString("GUID");

            if (!row.Exists("BuffName"))
            {
                BooterLogger.AddError(name + " BuffName Missing");
            }
            else
            {
                foreach (string buffStr in row.GetStringList("BuffName", ','))
                {
                    BuffNames buff;
                    if (ParserFunctionsEx.Parse(buffStr, out buff))
                    {
                        mBuffs.Add(buff);
                    }
                    else
                    {
                        BooterLogger.AddError(name + " Unknown BuffName: " + buffStr);
                    }
                }
            }

            if (row.Exists("Origin"))
            {
                foreach (string originStr in row.GetStringList("Origin", ','))
                {
                    Origin origin;
                    if (ParserFunctionsEx.Parse(originStr, out origin))
                    {
                        mOrigins.Add(origin);
                    }
                    else
                    {
                        BooterLogger.AddError(name + " Unknown Origin: " + origin);
                    }

                    mOrigins.Add(origin);
                }
            }
        }
예제 #6
0
        public WeightedStage(XmlDbRow row)
            : base(row)
        {
            if (!BooterLogger.Exists(row, "NextStages", Name)) return;
            if (!BooterLogger.Exists(row, "NextWeights", Name)) return;

            List<string> nextStages = row.GetStringList("NextStages", ',');
            List<string> nextWeights = row.GetStringList("NextWeights", ',');

            if (nextStages.Count != nextWeights.Count)
            {
                BooterLogger.AddError(Name + " NextStages/NextWeights Size Mismatch");

                mNextStages = new Pair<string, int>[] { new Pair<string, int> ("", 0) };
                mNextWeights = new int[] { 1 };

                return;
            }

            mNextStages = new Pair<string, int>[nextStages.Count];
            mNextWeights = new int[nextWeights.Count];

            for (int i = 0; i < nextStages.Count; i++)
            {
                mNextStages[i].First = nextStages[i];

                if (!int.TryParse(nextWeights[i], out mNextWeights[i]))
                {
                    BooterLogger.AddError(Name + " NextWeights not numeric: " + nextWeights[i]);
                    return;
                }
            }

            foreach (int weight in mNextWeights)
            {
                mTotalWeight += weight;
            }
        }
예제 #7
0
            public ITUNSettings(string name, XmlDbRow row)
                : this(name)
            {
                mFlags = Flags.None;

                if (row.Exists("Autonomous"))
                {
                    mAutonomous = row.GetBool("Autonomous");
                    mFlags     |= Flags.Autonomous;
                }

                if (row.Exists("UserDirected"))
                {
                    mUserDirected = row.GetBool("UserDirected");
                    mFlags       |= Flags.UserDirected;
                }

                if (row.Exists("AgeSpecies"))
                {
                    mAgeSpecies = row.GetEnum <CASAGSAvailabilityFlags>("AgeSpecies", CASAGSAvailabilityFlags.None);
                    if (mAgeSpecies == CASAGSAvailabilityFlags.None)
                    {
                        BooterLogger.AddError("Unknown AgeSpecies: " + row.GetString("AgeSpecies"));
                    }
                    else
                    {
                        mFlags |= Flags.AgeSpecies;

                        mAgeSpeciesList = null;
                    }
                }

                if (row.Exists("Availability"))
                {
                    mAvailability = row.GetEnum <Availability.FlagField>("Availability", Availability.FlagField.None);
                    if (mAvailability == Availability.FlagField.None)
                    {
                        BooterLogger.AddError("Unknown Availability: " + row.GetString("Availability"));
                    }
                    else
                    {
                        mFlags |= Flags.Availability;
                    }
                }

                if (row.Exists("Advertised"))
                {
                    ParseAdvertised(row.GetStringList("Advertised", ','));
                }
            }
예제 #8
0
        public GenericTest(XmlDbRow row)
        {
            string name = row.GetString("GUID");

            foreach (string e in row.GetStringList("Event", ','))
            {
                EventTypeId id;
                if (!ParserFunctions.TryParseEnum<EventTypeId>(e, out id, EventTypeId.kEventNone))
                {
                    BooterLogger.AddError(name + " Unknown Event: " + e);
                }

                mEvents.Add(id);
            }
        }
예제 #9
0
        public GenericTest(XmlDbRow row)
        {
            string name = row.GetString("GUID");

            foreach (string e in row.GetStringList("Event", ','))
            {
                EventTypeId id;
                if (!ParserFunctions.TryParseEnum <EventTypeId>(e, out id, EventTypeId.kEventNone))
                {
                    BooterLogger.AddError(name + " Unknown Event: " + e);
                }

                mEvents.Add(id);
            }
        }
예제 #10
0
            public SymptomChance(XmlDbRow row, int index)
            {
                mChance = row.GetFloat("SymptomChance" + index);

                List <string> symptoms = row.GetStringList("Symptoms" + index, ',');

                foreach (string symptomName in symptoms)
                {
                    SymptomBooter.Data symptom = SymptomBooter.GetSymptom(symptomName);
                    if (symptom == null)
                    {
                        BooterLogger.AddError("Unknown Symptom: " + symptomName);
                    }
                    else
                    {
                        mSymptoms.Add(symptom);
                    }
                }
            }
예제 #11
0
        public SocialTest(XmlDbRow row)
        {
            string name = row.GetString("GUID");

            if (BooterLogger.Exists(row, "Socials", name))
            {
                mSocials = row.GetStringList("SocialName", ',');

                for (int i = mSocials.Count - 1; i >= 0; i--)
                {
                    if (ActionData.Get(mSocials[i]) == null)
                    {
                        BooterLogger.AddError(name + " Invalid Social: " + mSocials[i]);

                        mSocials.RemoveAt(i);
                    }
                }
            }

            if (BooterLogger.Exists(row, "AllowAccept", name))
            {
                mAllowAccept = row.GetBool("AllowAccept");
            }

            if (BooterLogger.Exists(row, "AllowReject", name))
            {
                mAllowReject = row.GetBool("AllowReject");
            }

            if (BooterLogger.Exists(row, "AllowRecipient", name))
            {
                mAllowRecipient = row.GetBool("AllowRecipient");
            }

            if (BooterLogger.Exists(row, "AllowInitiator", name))
            {
                mAllowInitiator = row.GetBool("AllowInitiator");
            }
        }
예제 #12
0
        public SocialTest(XmlDbRow row)
        {
            string name = row.GetString("GUID");

            if (BooterLogger.Exists(row, "Socials", name))
            {
                mSocials = row.GetStringList("SocialName", ',');

                for (int i = mSocials.Count - 1; i >= 0; i--)
                {
                    if (ActionData.Get(mSocials[i]) == null)
                    {
                        BooterLogger.AddError(name + " Invalid Social: " + mSocials[i]);

                        mSocials.RemoveAt(i);
                    }
                }
            }

            if (BooterLogger.Exists(row, "AllowAccept", name))
            {
                mAllowAccept = row.GetBool("AllowAccept");
            }

            if (BooterLogger.Exists(row, "AllowReject", name))
            {
                mAllowReject = row.GetBool("AllowReject");
            }

            if (BooterLogger.Exists(row, "AllowRecipient", name))
            {
                mAllowRecipient = row.GetBool("AllowRecipient");
            }

            if (BooterLogger.Exists(row, "AllowInitiator", name))
            {
                mAllowInitiator = row.GetBool("AllowInitiator");
            }
        }
예제 #13
0
            public ITUNSettings(string name, XmlDbRow row)
                : this(name)
            {
                mFlags = Flags.None;

                if (row.Exists("Autonomous"))
                {
                    mAutonomous = row.GetBool("Autonomous");
                    mFlags |= Flags.Autonomous;
                }

                if (row.Exists("UserDirected"))
                {
                    mUserDirected = row.GetBool("UserDirected");
                    mFlags |= Flags.UserDirected;
                }

                if (row.Exists("AgeSpecies"))
                {
                    mAgeSpecies = row.GetEnum<CASAGSAvailabilityFlags>("AgeSpecies", CASAGSAvailabilityFlags.None);
                    if (mAgeSpecies == CASAGSAvailabilityFlags.None)
                    {
                        BooterLogger.AddError("Unknown AgeSpecies: " + row.GetString("AgeSpecies"));
                    }
                    else
                    {
                        mFlags |= Flags.AgeSpecies;

                        mAgeSpeciesList = null;
                    }
                }

                if (row.Exists("Availability"))
                {
                    mAvailability = row.GetEnum<Availability.FlagField>("Availability", Availability.FlagField.None);
                    if (mAvailability == Availability.FlagField.None)
                    {
                        BooterLogger.AddError("Unknown Availability: " + row.GetString("Availability"));
                    }
                    else
                    {
                        mFlags |= Flags.Availability;
                    }
                }

                if (row.Exists("Advertised"))
                {
                    ParseAdvertised(row.GetStringList("Advertised", ','));
                }
            }
예제 #14
0
            public Stage(XmlDbRow row)
            {
                if (BooterLogger.Exists(row, "Name", "Stage"))
                {
                    mName = row.GetString("Name");
                }

                if (!row.TryGetEnum <VectorControl.StageType>("Type", out mType, VectorControl.StageType.None))
                {
                    BooterLogger.AddError(Name + " Invalid Type: " + row.GetString("Type"));
                }

                float infectionRate = row.GetFloat("InfectionRate", 0);

                mOutdoorInfectionRate = row.GetFloat("OutdoorInfectionRate", infectionRate);
                if (mOutdoorInfectionRate > 1)
                {
                    mOutdoorInfectionRate = 1;
                }

                mRoomInfectionRate = row.GetFloat("RoomInfectionRate", mOutdoorInfectionRate * 1.5f);
                if (mRoomInfectionRate > 1)
                {
                    mRoomInfectionRate = 1;
                }

                mSocialInfectionRate = row.GetFloat("SocialInfectionRate", mRoomInfectionRate * 1.5f);
                if (mSocialInfectionRate > 1)
                {
                    mSocialInfectionRate = 1;
                }
                mFightInfectionRate = row.GetFloat("FightInfectionRate", mSocialInfectionRate);
                if (mFightInfectionRate > 1)
                {
                    mFightInfectionRate = 1;
                }

                mWoohooInfectionRate = row.GetFloat("WoohooInfectionRate", mSocialInfectionRate * 1.5f);
                if (mWoohooInfectionRate > 1)
                {
                    mWoohooInfectionRate = 1;
                }

                mMutationRate = row.GetFloat("MutationRate", 0);

                mGoodRelationshipDelta = row.GetInt("GoodRelationshipDelta", 0);
                mBadRelationshipDelta  = row.GetInt("BadRelationshipDelta", 0);

                mSymptomScoring        = row.GetString("SymptomScoring");
                mSymptomScoringMinimum = row.GetInt("SymptomScoringMinimum", 0);

                mStoryUnknown    = row.GetString("StoryUnknown");
                mStoryIdentified = row.GetString("StoryIdentified");

                if (row.Exists("CanInoculate")) // Default is True
                {
                    mCanInoculate = row.GetBool("CanInoculate");
                }
                else if (row.Exists("CanInnoculate"))
                {
                    mCanInoculate = row.GetBool("CanInnoculate");
                }

                int numSymptoms = row.GetInt("NumSymptoms", 0) + 1;

                for (int i = 1; i <= numSymptoms; i++)
                {
                    if (i == numSymptoms)
                    {
                        if (row.Exists("SymptomChance" + i))
                        {
                            BooterLogger.AddError(Name + " More Symptoms than NumSymptoms");
                        }
                        break;
                    }

                    mSymptoms.Add(new SymptomChance(row, i));
                }

                int numResistances = row.GetInt("NumResistances", 0) + 1;

                for (int i = 1; i <= numResistances; i++)
                {
                    if (i == numResistances)
                    {
                        if (row.Exists("Resistance" + i))
                        {
                            BooterLogger.AddError(Name + " More Resistance than NumResistances");
                        }
                        break;
                    }

                    ResistanceBooter.Data resistance = ResistanceBooter.GetResistance(row.GetString("Resistance" + i));
                    if (resistance == null)
                    {
                        BooterLogger.AddError(Name + " Unknown Resistance " + i + ": " + row.GetString("Resistance" + i));
                    }
                    else
                    {
                        mResistances.Add(resistance);
                    }
                }

                int numMutables = row.GetInt("NumMutables", 0) + 1;

                for (int i = 1; i <= numMutables; i++)
                {
                    if (i == numMutables)
                    {
                        if (row.Exists("Mutable" + i))
                        {
                            BooterLogger.AddError(Name + " More Mutable than NumMutables");
                        }
                        break;
                    }

                    List <string> mutable = row.GetStringList("Mutable" + i, ',');
                    if (mutable.Count != 3)
                    {
                        BooterLogger.AddError(Name + " Unknown Mutable " + i + ": " + row.GetString("Mutable" + i));
                        continue;
                    }

                    int minimum;
                    if (!int.TryParse(mutable[1], out minimum))
                    {
                        BooterLogger.AddError(Name + " Mutable " + i + " Invalid Minimum: " + mutable[1]);
                        continue;
                    }

                    int maximum;
                    if (!int.TryParse(mutable[2], out maximum))
                    {
                        BooterLogger.AddError(Name + " Mutable " + i + " Invalid Maximum: " + mutable[2]);
                        continue;
                    }

                    mMutables.Add(new Mutable(mutable[0], minimum, maximum));
                }
            }
예제 #15
0
        // From AcademicDegreeManager:CreateAcademicDegreeTable
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            AcademicDegreeNames academicDegree = AcademicDegreeNames.Undefined;

            if (!row.TryGetEnum<AcademicDegreeNames>("AcademicDegreeEnum", out academicDegree, AcademicDegreeNames.Undefined))
            {
                academicDegree = unchecked((AcademicDegreeNames)ResourceUtils.HashString64(row.GetString("AcademicDegreeEnum")));
            }

            BooterLogger.AddTrace("AcademicDegreeEnum: " + row.GetString("AcademicDegreeEnum"));

            string degreeNameKey = row.GetString("AcademicDegreeName");
            string degreeDescKey = row.GetString("AcademicDegreeDesc");
            string degreeIcon = row.GetString("AcademicDegreeIcon");
            int degreeCreditHours = row.GetInt("AcademicDegreeRequiredCreditHours");
            float degreeCostPerCredit = row.GetFloat("AcademicDegreeCostPerCredit");
            string degreeResponsibilitiesKey = row.GetString("ResponsibilityTooltipKey");

            JobId academicDefaultCourseID;
            if (!row.TryGetEnum<JobId>("AcademicDefaultCourseID", out academicDefaultCourseID, JobId.AcademicsGenericRabbitHoleCourse))
            {
                // Custom
                academicDefaultCourseID = unchecked((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultCourseID")));
            }

            JobId academicDefaultLectureID;
            if (!row.TryGetEnum<JobId>("AcademicDefaultLectureID", out academicDefaultLectureID, JobId.Invalid))
            {
                // Custom
                academicDefaultLectureID = unchecked((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultLectureID")));                
            }

            JobId academicDefaultLabID;
            if (!row.TryGetEnum<JobId>("AcademicDefaultLabID", out academicDefaultLabID, JobId.Invalid))
            {
                // Custom
                academicDefaultLabID = unchecked((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultLabID")));
            }

            List<OccupationNames> associatedOccupations = new List<OccupationNames>();
            List<string> list2 = row.GetStringList("AssociatedOccupationNameEnum", ',', true);
            for (int i = 0x0; i < list2.Count; i++)
            {
                OccupationNames occupation;
                if (!ParserFunctions.TryParseEnum<OccupationNames>(list2[i], out occupation, OccupationNames.Undefined))
                {
                    occupation = unchecked((OccupationNames)ResourceUtils.HashString64(row.GetString(list2[i])));
                }

                if (occupation != OccupationNames.Undefined)
                {
                    associatedOccupations.Add(occupation);
                }
            }

            OccupationNames grantedOccupation;
            if (!ParserFunctions.TryParseEnum<OccupationNames>("GrantedOccupationNameEnum", out grantedOccupation, OccupationNames.Undefined))
            {
                // Custom
                grantedOccupation = unchecked((OccupationNames)ResourceUtils.HashString64(row.GetString("GrantedOccupationNameEnum")));
            }

            List<TraitNames> beneficialTraits;
            List<TraitNames> detrimentalTraits;
            List<TraitNames> suggestedTraits;
            ParserFunctions.TryParseCommaSeparatedList<TraitNames>(row["BeneficialTraits"], out beneficialTraits, TraitNames.Unknown);
            ParserFunctions.TryParseCommaSeparatedList<TraitNames>(row["DetrimentalTraits"], out detrimentalTraits, TraitNames.Unknown);
            ParserFunctions.TryParseCommaSeparatedList<TraitNames>(row["SuggestedTraits"], out suggestedTraits, TraitNames.Unknown);

            AcademicDegreeStaticData staticData = null;
            if (!AcademicDegreeManager.sDictionary.TryGetValue((ulong)academicDegree, out staticData))
            {
                staticData = new AcademicDegreeStaticData(academicDegree, degreeNameKey, degreeDescKey, degreeResponsibilitiesKey, degreeIcon, degreeCreditHours, degreeCostPerCredit, academicDefaultCourseID, academicDefaultLectureID, academicDefaultLabID, associatedOccupations, grantedOccupation, beneficialTraits, detrimentalTraits, suggestedTraits);
            }
            else
            {
                staticData.BeneficialTraits.AddRange(beneficialTraits);
                staticData.DetrimentalTraits.AddRange(detrimentalTraits);
                staticData.SuggestedTraits.AddRange(suggestedTraits);
                staticData.AssociatedOccupations.AddRange(associatedOccupations);
            }

            string skillsThatGrantXP = row.GetString("SkillsThatGrantXP");
            if (!string.IsNullOrEmpty(skillsThatGrantXP))
            {
                foreach (string str6 in skillsThatGrantXP.Split(new char[] { ';' }))
                {
                    string[] strArray2 = str6.Split(new char[] { ',' });
                    if (strArray2.Length != 0x2) continue;

                    float num4 = ParserFunctions.ParseFloat(strArray2[0x1], -1234123f);
                    if (num4 == -1234123f) continue;

                    // Custom
                    SkillNames skillName = SkillManager.sSkillEnumValues.ParseEnumValue(strArray2[0x0]);
                    if (skillName == SkillNames.None) continue;

                    staticData.AddSkill(skillName, num4);
                }
            }

            AcademicDegreeManager.sDictionary[(ulong)academicDegree] = staticData;
        }
예제 #16
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            string guid = row.GetString("Guid");
            if (string.IsNullOrEmpty(guid))
            {
                BooterLogger.AddError(file + ": Guid empty");
                return;
            }

            AfterschoolActivityType type = unchecked((AfterschoolActivityType)ResourceUtils.HashString64(guid));

            AfterschoolActivityData data = new AfterschoolActivityData();

            data.mActivity = new AfterschoolActivity(type);

            List<string> skills = row.GetStringList("Skills", ',');
            if (skills != null)
            {
                foreach (string skillStr in skills)
                {
                    SkillNames skill = SkillManager.sSkillEnumValues.ParseEnumValue(skillStr);
                    if (skill == SkillNames.None)
                    {
                        BooterLogger.AddError(file + ": " + guid + " Unknown skill " + skillStr);
                        return;
                    }
                    else
                    {
                        data.mActivity.ActivitySkillNameList.Add(skill);
                    }
                }
            }

            if (data.mActivity.ActivitySkillNameList.Count == 0)
            {
                BooterLogger.AddError(file + ": " + guid + " Activity Must Have a Skill");
                return;
            }

            DaysOfTheWeek days;
            if (!row.TryGetEnum<DaysOfTheWeek>("DaysOfTheWeek", out days, DaysOfTheWeek.All))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown DaysOfTheWeek " + row.GetString("DaysOfTheWeek"));
                return;
            }

            data.mActivity.DaysForActivity = days;

            CASAgeGenderFlags genders;
            if (!row.TryGetEnum<CASAgeGenderFlags>("Genders", out genders, CASAgeGenderFlags.GenderMask))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown Genders " + row.GetString("Genders"));
                return;
            }

            data.mGenders = genders;

            CASAgeGenderFlags ages;
            if (!row.TryGetEnum<CASAgeGenderFlags>("Ages", out ages, CASAgeGenderFlags.AgeMask))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown Ages " + row.GetString("Ages"));
                return;
            }

            data.mAges = ages;

            if (row.Exists("PreLoop"))
            {
                data.mPreLoop = new Common.MethodStore(row.GetString("PreLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mPreLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing PreLoop " + row.GetString("PreLoop"));
                    return;
                }
            }

            if (row.Exists("Loop"))
            {
                data.mLoop = new Common.MethodStore(row.GetString("Loop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing Loop " + row.GetString("Loop"));
                    return;
                }
            }

            if (row.Exists("PostLoop"))
            {
                data.mPostLoop = new Common.MethodStore(row.GetString("PostLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mPostLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing PostLoop " + row.GetString("PostLoop"));
                    return;
                }
            }

            Activities.Add(type, data);

            BooterLogger.AddTrace(file + ": " + guid + " Loaded");
        }
예제 #17
0
        public static ArrayList ParseRewards(XmlDbRow dr, string[] columnKeys, int numRewards)
        {
            try
            {
                ArrayList list = new ArrayList();
                for (int i = 0; i < numRewards; i++)
                {
                    bool flag = false;
                    List<string> entry = dr.GetStringList(columnKeys[i], ',', false);
                    if (entry.Count > 0)
                    {
                        RewardType type;
                        for (int j = 0; j < entry.Count; j++)
                        {
                            entry[j] = entry[j].Trim();
                        }

                        if (ParserFunctions.TryParseEnum<RewardType>(entry[0], out type, RewardType.Undefined))
                        {
                            RewardInfo info = null;
                            switch (type)
                            {
                                case RewardType.BookSkill:
                                    info = RewardsManager.ParseBookSkillRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.Buff:
                                    info = RewardsManager.ParseBuffRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.CareerDemotion:
                                case RewardType.CareerFired:
                                case RewardType.CareerPromotion:
                                case RewardType.UnknownRecipe:
                                case RewardType.UnlearnedComposition:
                                case RewardType.CompedMeal:
                                case RewardType.BookQualityIncrease:
                                case RewardType.ConcertsPerformed:
                                    info = new RewardInfo();
                                    info.mType = type;
                                    flag = true;
                                    break;

                                case RewardType.Ingredient:
                                    info = RewardsManager.ParseIngredientRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.Money:
                                    info = RewardsManager.ParseMoneyRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.RandomGroupMeal:
                                    info = RewardsManager.ParseRandomGroupMealRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.RandomPlantable:
                                    info = RewardsManager.ParseRandomPlantableRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.RandomObject:
                                    info = RewardsManager.ParseRandomObjectReward(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.SkillPercentage:
                                    info = ParseSkillRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.RandomFish:
                                    info = RewardsManager.ParseRandomFishRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.PaintingValueBoost:
                                    info = RewardsManager.ParsePaintingValueBoostRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.GroupMeal:
                                    info = RewardsManager.ParseGroupMealReward(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.ObjectInMail:
                                    info = RewardsManager.ParseObjectInMailReward(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.Harvestable:
                                    info = RewardsManager.ParseHarvestableRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.OmniPlantSeeds:
                                    info = RewardsManager.ParseOmniPlantSeedsRewardInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.AncientCoin:
                                    info = RewardsManager.ParseAncientCoinInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.VisaPoints:
                                    info = RewardsManager.ParseVisaPointsInfo(entry);
                                    flag = info != null;
                                    break;

                                case RewardType.TreasureComponentRow:
                                    info = RewardsManager.ParseTreasureComponentRow(entry);
                                    flag = info != null;
                                    break;

                                default:
                                    info = new RewardInfo();
                                    info.mType = type;
                                    if (entry.Count == 0x2)
                                    {
                                        flag = int.TryParse(entry[0x1], out info.mAmount);
                                    }
                                    break;
                            }
                            if (flag)
                            {
                                list.Add(info);
                            }
                        }
                        else
                        {
                            Type rewardType = dr.GetClassType(columnKeys[i]);
                            if (rewardType != null)
                            {
                                RewardInfoEx reward = (RewardInfoEx)rewardType.GetConstructor(new Type[0]).Invoke(new object[0]);
                                if (reward != null)
                                {
                                    list.Add(reward);
                                }
                                else
                                {
                                    BooterLogger.AddError("Unknown reward: " + dr.GetString(columnKeys[i]));
                                }
                            }
                            else
                            {
                                BooterLogger.AddError("Unknown reward: " + dr.GetString(columnKeys[i]));
                            }
                        }
                    }
                }

                if (list.Count != 0)
                {
                    return list;
                }
            }
            catch (Exception e)
            {
                Common.Exception("ParseRewards", e);
            }
            return null;
        }
예제 #18
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            string guid = row.GetString("Guid");

            if (string.IsNullOrEmpty(guid))
            {
                BooterLogger.AddError(file + ": Guid empty");
                return;
            }

            AfterschoolActivityType type = unchecked ((AfterschoolActivityType)ResourceUtils.HashString64(guid));

            AfterschoolActivityData data = new AfterschoolActivityData();

            data.mActivity = new AfterschoolActivity(type);

            List <string> skills = row.GetStringList("Skills", ',');

            if (skills != null)
            {
                foreach (string skillStr in skills)
                {
                    SkillNames skill = SkillManager.sSkillEnumValues.ParseEnumValue(skillStr);
                    if (skill == SkillNames.None)
                    {
                        BooterLogger.AddError(file + ": " + guid + " Unknown skill " + skillStr);
                        return;
                    }
                    else
                    {
                        data.mActivity.ActivitySkillNameList.Add(skill);
                    }
                }
            }

            if (data.mActivity.ActivitySkillNameList.Count == 0)
            {
                BooterLogger.AddError(file + ": " + guid + " Activity Must Have a Skill");
                return;
            }

            DaysOfTheWeek days;

            if (!row.TryGetEnum <DaysOfTheWeek>("DaysOfTheWeek", out days, DaysOfTheWeek.All))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown DaysOfTheWeek " + row.GetString("DaysOfTheWeek"));
                return;
            }

            data.mActivity.DaysForActivity = days;

            CASAgeGenderFlags genders;

            if (!row.TryGetEnum <CASAgeGenderFlags>("Genders", out genders, CASAgeGenderFlags.GenderMask))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown Genders " + row.GetString("Genders"));
                return;
            }

            data.mGenders = genders;

            CASAgeGenderFlags ages;

            if (!row.TryGetEnum <CASAgeGenderFlags>("Ages", out ages, CASAgeGenderFlags.AgeMask))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown Ages " + row.GetString("Ages"));
                return;
            }

            data.mAges = ages;

            if (row.Exists("PreLoop"))
            {
                data.mPreLoop = new Common.MethodStore(row.GetString("PreLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mPreLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing PreLoop " + row.GetString("PreLoop"));
                    return;
                }
            }

            if (row.Exists("Loop"))
            {
                data.mLoop = new Common.MethodStore(row.GetString("Loop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing Loop " + row.GetString("Loop"));
                    return;
                }
            }

            if (row.Exists("PostLoop"))
            {
                data.mPostLoop = new Common.MethodStore(row.GetString("PostLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mPostLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing PostLoop " + row.GetString("PostLoop"));
                    return;
                }
            }

            Activities.Add(type, data);

            BooterLogger.AddTrace(file + ": " + guid + " Loaded");
        }
예제 #19
0
        private static ArrayList ParseModifiers(XmlDbRow dr, string[] columnKeys, int numRewards)
        {
            ArrayList list = new ArrayList();
            for (int i = 0x0; i < numRewards; i++)
            {
                bool flag = false;
                List<string> stringList = dr.GetStringList(columnKeys[i], ',');
                if (stringList.Count > 0x0)
                {
                    ModifierType type;
                    ParserFunctions.TryParseEnum<ModifierType>(stringList[0x0], out type, ModifierType.Undefined);
                    ModifierInfo info = null;
                    switch (type)
                    {
                        case ModifierType.Mood:
                        case ModifierType.RelationshipWithBoss:
                        case ModifierType.RelationshipWithCoworkers:
                            info = new ModifierInfo();
                            info.mType = type;
                            flag = int.TryParse(stringList[0x1], out info.mAmount);
                            break;

                        case ModifierType.Skill:
                            info = ParseSkillModifierInfo(stringList);
                            flag = info != null;
                            break;
                    }
                    if (flag)
                    {
                        list.Add(info);
                    }
                }
            }
            if (list.Count != 0x0)
            {
                return list;
            }
            return null;
        }
예제 #20
0
        // From AcademicDegreeManager:CreateAcademicDegreeTable
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            AcademicDegreeNames academicDegree = AcademicDegreeNames.Undefined;

            if (!row.TryGetEnum <AcademicDegreeNames>("AcademicDegreeEnum", out academicDegree, AcademicDegreeNames.Undefined))
            {
                academicDegree = unchecked ((AcademicDegreeNames)ResourceUtils.HashString64(row.GetString("AcademicDegreeEnum")));
            }

            BooterLogger.AddTrace("AcademicDegreeEnum: " + row.GetString("AcademicDegreeEnum"));

            string degreeNameKey             = row.GetString("AcademicDegreeName");
            string degreeDescKey             = row.GetString("AcademicDegreeDesc");
            string degreeIcon                = row.GetString("AcademicDegreeIcon");
            int    degreeCreditHours         = row.GetInt("AcademicDegreeRequiredCreditHours");
            float  degreeCostPerCredit       = row.GetFloat("AcademicDegreeCostPerCredit");
            string degreeResponsibilitiesKey = row.GetString("ResponsibilityTooltipKey");

            JobId academicDefaultCourseID;

            if (!row.TryGetEnum <JobId>("AcademicDefaultCourseID", out academicDefaultCourseID, JobId.AcademicsGenericRabbitHoleCourse))
            {
                // Custom
                academicDefaultCourseID = unchecked ((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultCourseID")));
            }

            JobId academicDefaultLectureID;

            if (!row.TryGetEnum <JobId>("AcademicDefaultLectureID", out academicDefaultLectureID, JobId.Invalid))
            {
                // Custom
                academicDefaultLectureID = unchecked ((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultLectureID")));
            }

            JobId academicDefaultLabID;

            if (!row.TryGetEnum <JobId>("AcademicDefaultLabID", out academicDefaultLabID, JobId.Invalid))
            {
                // Custom
                academicDefaultLabID = unchecked ((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultLabID")));
            }

            List <OccupationNames> associatedOccupations = new List <OccupationNames>();
            List <string>          list2 = row.GetStringList("AssociatedOccupationNameEnum", ',', true);

            for (int i = 0x0; i < list2.Count; i++)
            {
                OccupationNames occupation;
                if (!ParserFunctions.TryParseEnum <OccupationNames>(list2[i], out occupation, OccupationNames.Undefined))
                {
                    occupation = unchecked ((OccupationNames)ResourceUtils.HashString64(row.GetString(list2[i])));
                }

                if (occupation != OccupationNames.Undefined)
                {
                    associatedOccupations.Add(occupation);
                }
            }

            OccupationNames grantedOccupation;

            if (!ParserFunctions.TryParseEnum <OccupationNames>("GrantedOccupationNameEnum", out grantedOccupation, OccupationNames.Undefined))
            {
                // Custom
                grantedOccupation = unchecked ((OccupationNames)ResourceUtils.HashString64(row.GetString("GrantedOccupationNameEnum")));
            }

            List <TraitNames> beneficialTraits;
            List <TraitNames> detrimentalTraits;
            List <TraitNames> suggestedTraits;

            ParserFunctions.TryParseCommaSeparatedList <TraitNames>(row["BeneficialTraits"], out beneficialTraits, TraitNames.Unknown);
            ParserFunctions.TryParseCommaSeparatedList <TraitNames>(row["DetrimentalTraits"], out detrimentalTraits, TraitNames.Unknown);
            ParserFunctions.TryParseCommaSeparatedList <TraitNames>(row["SuggestedTraits"], out suggestedTraits, TraitNames.Unknown);

            AcademicDegreeStaticData staticData = null;

            if (!AcademicDegreeManager.sDictionary.TryGetValue((ulong)academicDegree, out staticData))
            {
                staticData = new AcademicDegreeStaticData(academicDegree, degreeNameKey, degreeDescKey, degreeResponsibilitiesKey, degreeIcon, degreeCreditHours, degreeCostPerCredit, academicDefaultCourseID, academicDefaultLectureID, academicDefaultLabID, associatedOccupations, grantedOccupation, beneficialTraits, detrimentalTraits, suggestedTraits);
            }
            else
            {
                staticData.BeneficialTraits.AddRange(beneficialTraits);
                staticData.DetrimentalTraits.AddRange(detrimentalTraits);
                staticData.SuggestedTraits.AddRange(suggestedTraits);
                staticData.AssociatedOccupations.AddRange(associatedOccupations);
            }

            string skillsThatGrantXP = row.GetString("SkillsThatGrantXP");

            if (!string.IsNullOrEmpty(skillsThatGrantXP))
            {
                foreach (string str6 in skillsThatGrantXP.Split(new char[] { ';' }))
                {
                    string[] strArray2 = str6.Split(new char[] { ',' });
                    if (strArray2.Length != 0x2)
                    {
                        continue;
                    }

                    float num4 = ParserFunctions.ParseFloat(strArray2[0x1], -1234123f);
                    if (num4 == -1234123f)
                    {
                        continue;
                    }

                    // Custom
                    SkillNames skillName = SkillManager.sSkillEnumValues.ParseEnumValue(strArray2[0x0]);
                    if (skillName == SkillNames.None)
                    {
                        continue;
                    }

                    staticData.AddSkill(skillName, num4);
                }
            }

            AcademicDegreeManager.sDictionary[(ulong)academicDegree] = staticData;
        }
예제 #21
0
        private static ArrayList ParseRequirements(XmlDbRow dr, OpportunityNames opportunityKey)
        {
            ArrayList list = new ArrayList();
            for (int i = 1; i <= 8; i++)
            {
                List<string> entry = dr.GetStringList("Requirement" + i, ',', false);
                if (entry.Count > 0)
                {
                    RequirementType type;
                    ParserFunctions.TryParseEnum<RequirementType>(entry[0], out type, RequirementType.Undefined);

                    Opportunity.OpportunitySharedData.RequirementInfo info = null;

                    if (type == RequirementType.Undefined)
                    {
                        info = new Opportunity.OpportunitySharedData.RequirementInfo();
                        info.mData = dr.GetString("Requirement" + i);
                        info.mType = RequirementType.Undefined;
                    }
                    else
                    {
                        switch (type)
                        {
                            case RequirementType.Career:
                                info = ParseCareerRequirements(entry);
                                break;

                            case RequirementType.Skill:
                                info = ParseSkillRequirements(entry);
                                break;

                            case RequirementType.Trait:
                                info = OpportunityManager.ParseTraitRequirements(entry);
                                break;

                            case RequirementType.WorldHasRabbitHoleType:
                                info = OpportunityManager.ParseWorldHasRabbitHoleRequirement(entry);
                                break;

                            case RequirementType.LearnableRecipeExists:
                            case RequirementType.HasAcquaintanceOrHigher:
                            case RequirementType.HasYAAcquaintanceOrHigher:
                            case RequirementType.HasNonFriendCoworker:
                            case RequirementType.WorldHasPregnantSim:
                            case RequirementType.HasChildOrTeenAcquaintanceOrHigher:
                            case RequirementType.IsElder:
                            case RequirementType.WorldHasCommunityLot:
                            case RequirementType.HasHighRelationshipWithDeadSim:
                            case RequirementType.Unemployed:
                            case RequirementType.HasSingleSim:
                                info = new Opportunity.OpportunitySharedData.RequirementInfo();
                                info.mType = type;
                                break;

                            case RequirementType.HasObjectOnHomeLot:
                            case RequirementType.WorldHasLotWith:
                                info = OpportunityManager.ParseObjectRequirement(entry);
                                info.mType = type;
                                break;

                            case RequirementType.KnowsRecipe:
                                info = OpportunityManager.ParseKnowsRecipeRequirement(entry);
                                break;

                            case RequirementType.HasStrangers:
                                info = OpportunityManager.ParseHasStrangersRequirement(entry);
                                break;

                            case RequirementType.HasNonHouseholdAdultSims:
                                info = OpportunityManager.ParseHasNonHouseholdAdultSimsRequirement(entry);
                                break;

                            case RequirementType.WorldHasInvitableSimInCareer:
                            case RequirementType.WorldHasSimInCareer:
                            case RequirementType.WorldHasSkillTutorableSimInCareer:
                                info = OpportunityManager.ParseWorldHasSimInCareerRequirement(entry);
                                info.mType = type;
                                break;

                            case RequirementType.HasInvitableCoworker:
                                info = OpportunityManager.ParseHasInvitableCoworkerRequirement(entry);
                                break;

                            case RequirementType.HasGrade:
                                info = OpportunityManager.ParseHasGradeRequirement(entry);
                                break;

                            case RequirementType.HasPlanted:
                                info = OpportunityManager.ParseHasPlantedRequirement(entry);
                                break;

                            case RequirementType.HasWrittenXBooksOfGenre:
                                info = OpportunityManager.ParseHasWrittenXBooksOfGenreRequirement(entry);
                                break;

                            case RequirementType.OpportunityNotComplete:
                                info = ParseOpportunityNotCompleteRequirement(entry);
                                break;

                            case RequirementType.OpportunityComplete:
                                info = ParseOpportunityCompleteRequirement(entry);
                                break;

                            case RequirementType.CanWriteGenre:
                                info = OpportunityManager.ParseCanWriteGenreRequirement(entry);
                                break;

                            case RequirementType.WorldHasSpecificSim:
                                info = OpportunityManager.ParseWorldHasSpecificSimRequirement(entry);
                                break;

                            case RequirementType.WorldHasCommunityLotType:
                                info = OpportunityManager.ParseWorldHasCommunityLotTypeRequirement(entry, type);
                                break;

                            case RequirementType.NotInCareer:
                                info = ParseNotInCareerRequirement(entry);
                                break;

                            case RequirementType.HasVacationLocal:
                                info = OpportunityManager.ParseHasVacationLocalRequirement(entry);
                                break;

                            case RequirementType.WorldHasSimInRole:
                                info = OpportunityManager.WorldHasSimInRoleRequirement(entry);
                                break;

                            case RequirementType.WorldHasSimOnSpecificLot:
                                info = OpportunityManager.WorldHasSimOnSpecificLot(entry);
                                break;

                            case RequirementType.WorldHasEmptyTreasureSpawner:
                                info = OpportunityManager.WorldHasEmptyTreasureSpawner(entry);
                                break;

                            case RequirementType.VisaLevel:
                                info = OpportunityManager.ParseVisaLevelRequirements(entry, opportunityKey);
                                break;

                            case RequirementType.HasBuff:
                                info = OpportunityManager.ParseBuffRequirements(entry);
                                break;

                            case RequirementType.KnowsInvention:
                                info = OpportunityManager.ParseKnownInventionRequirement(entry);
                                break;

                            case RequirementType.KnowsSculpture:
                                info = OpportunityManager.ParseKnownSculptureRequirement(entry);
                                break;

                            case RequirementType.Celebrity:
                                info = OpportunityManager.ParseCelebrityRequirements(entry);
                                break;

                            case RequirementType.HasCompletedNGigs:
                                info = OpportunityManager.ParseHasCompletedNGigsRequirements(entry);
                                break;

                            case RequirementType.HasPet:
                                info = OpportunityManager.ParseHasPetRequirement(entry);
                                break;
                        }
                    }
                    
                    if (info != null)
                    {
                        list.Add(info);
                    }
                }
            }
            return list;
        }