Beispiel #1
0
        protected static bool LoadSocializingActionAvailability(BooterHelper.DataBootFile actionAvailability)
        {
            if (actionAvailability.GetTable("ActiveTopic") == null)
            {
                BooterLogger.AddError(actionAvailability + ": No ActiveTopic");
                return false;
            }

            SocialManager.ParseStcActionAvailability(actionAvailability.Data);
            SocialManager.ParseActiveTopic(actionAvailability.Data);

            return true;
        }
Beispiel #2
0
        private static void ParseOpportunitySetup(BooterHelper.DataBootFile file, int total)
        {
            XmlDbTable table = file.GetTable("OpportunitiesSetup");
            if (table == null) return;

            BooterLogger.AddTrace(file + ": Found Setup = " + table.Rows.Count);

            if (total != table.Rows.Count)
            {
                BooterLogger.AddError(file + ": Found Too few Setup " + total + " < " + table.Rows.Count);
            }

            foreach (XmlDbRow row in table.Rows)
            {
                OpportunityNames names = GenericManager<OpportunityNames, Opportunity, Opportunity>.ParseGuid(row["GUID"]);

                #region NEWCODE
                if (names == OpportunityNames.Undefined)
                {
                    names = unchecked((OpportunityNames)ResourceUtils.HashString64(row["GUID"]));
                }
                #endregion

                if (GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary.ContainsKey((ulong)names))
                {
                    string[] strArray5;
                    string[] strArray6;
                    Opportunity opportunity = GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary[(ulong) names];
                    Opportunity.OpportunitySharedData sharedData = opportunity.SharedData;
                    string name = row.GetString("Object");
                    if (name != string.Empty)
                    {
                        ParserFunctions.TryParseEnum<OpportunityObjectTypes>(name, out sharedData.mSetupObjectType, OpportunityObjectTypes.Undefined);
                    }
                    sharedData.mSetupObjectData = row.GetString("ObjectData");
                    if (sharedData.mSetupObjectType == OpportunityObjectTypes.Keystone)
                    {
                        OpportunityManager.sKeystonesThatComeFromAdventures[sharedData.mSetupObjectData] = true;
                    }
                    sharedData.mSetupObjectTreasureSpawner = row.GetString("ObjectTreasureSpawner");
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.SetupObjectRequiredOnCompletion, row.GetBool("RequiredOnCompletion"));
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnCompletion, row.GetBool("DeleteOnCompletion"));
                    if (!string.IsNullOrEmpty(row.GetString("DeleteOnFailure")))
                    {
                        sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnFailure, row.GetBool("DeleteOnFailure"));
                    }
                    else
                    {
                        sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnFailure, sharedData.HasFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnCompletion));
                    }
                    if (sharedData.HasFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnCompletion))
                    {
                        sharedData.HasFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnFailure);
                    }
                    string str2 = row.GetString("ObjectStateForCompletion");
                    if (str2 != string.Empty)
                    {
                        string[] strArray = null;
                        if (ParserFunctions.ParseCommaSeparatedString(str2, out strArray))
                        {
                            ParserFunctions.TryParseEnum<OpportunityObjectState>(strArray[0x0], out sharedData.mSetupObjectCompletionState, OpportunityObjectState.Undefined);
                            if (strArray.Length == 0x2)
                            {
                                sharedData.mSetupObjectCompletionStateData = strArray[0x1];
                            }
                        }
                    }
                    row.TryGetEnum<OpportunityCompletionTNSType>("CompletionTNSType", out sharedData.mCompletionTNSType, OpportunityCompletionTNSType.Info);
                    Opportunity.OpportunitySharedData.DestinationInventoryType simInventory = Opportunity.OpportunitySharedData.DestinationInventoryType.SimInventory;
                    row.TryGetEnum<Opportunity.OpportunitySharedData.DestinationInventoryType>("DestinationInventory", out simInventory, Opportunity.OpportunitySharedData.DestinationInventoryType.SimInventory);
                    sharedData.mDestinationInventoryType = simInventory;
                    string str3 = row.GetString("Target");
                    if (str3 != string.Empty)
                    {
                        ParserFunctions.TryParseEnum<OpportunityTargetTypes>(str3, out sharedData.mTargetType, OpportunityTargetTypes.Undefined);
                    }
                    else if (name != string.Empty)
                    {
                        sharedData.mTargetType = OpportunityTargetTypes.SetupObject;
                    }
                    sharedData.mTargetData = row.GetString("TargetData");
                    string str4 = row.GetString("Source");
                    if (str4 != string.Empty)
                    {
                        ParserFunctions.TryParseEnum<OpportunityTargetTypes>(str4, out sharedData.mSourceType, OpportunityTargetTypes.Undefined);
                    }
                    sharedData.mSourceData = row.GetString("SourceData");
                    string str5 = row.GetString("TargetInteractionName");
                    if (str5 != string.Empty)
                    {
                        sharedData.mTargetInteractionName = "Gameplay/Excel/Opportunities/OpportunitiesSetup:" + str5;
                    }
                    sharedData.mSocialTextKeys = row.GetStringList("TargetSocialTextKeys", ',');
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.TargetInteractionIgnoreTarget, row.GetBool("TargetInteractionIgnoreTarget"));
                    sharedData.mTargetInteractionLikingToAccept = row.GetFloat("TargetInteractionLikingToAccept");
                    ParserFunctions.TryParseEnum<Role.RoleType>(row.GetString("TargetRoleRequired"), out sharedData.mTargetRoleRequired, Role.RoleType.None);
                    string str6 = row.GetString("TargetWorldRequired");
                    if ((str6 == "HomeWorld") || (sharedData.mProductVersion == ProductVersion.BaseGame))
                    {
                        sharedData.mTargetWorldRequired = WorldName.SunsetValley;
                    }
                    else
                    {
                        ParserFunctions.TryParseEnum<WorldName>(str6, out sharedData.mTargetWorldRequired, WorldName.Undefined);
                    }
                    sharedData.mTargetInteractionLength = row.GetFloat("TargetInteractionLength");
                    sharedData.mTargetInteractionDays = row.GetString("TargetInteractionDays");
                    sharedData.mTargetInteractionStartTime = ParserFunctions.ParseTime(row.GetString("TargetInteractionStartTime"));
                    sharedData.mTargetInteractionEndTime = ParserFunctions.ParseTime(row.GetString("TargetInteractionEndTime"));
                    string str7 = row.GetString("TargetInteractionCommodity");
                    if (!string.IsNullOrEmpty(str7))
                    {
                        string[] strArray2 = null;
                        if (ParserFunctions.ParseCommaSeparatedString(str7, out strArray2) && (strArray2.Length == 0x2))
                        {
                            ParserFunctions.TryParseEnum<CommodityKind>(strArray2[0x0], out sharedData.mTargetCommodity, CommodityKind.None);
                            float.TryParse(strArray2[0x1], out sharedData.mTargetCommodityDesiredValue);
                        }
                    }
                    string str8 = row.GetString("TargetInteractionItemRequired");
                    if (str8 != string.Empty)
                    {
                        string[] strArray3 = null;
                        if (ParserFunctions.ParseSemicolonSeparatedString(str8, out strArray3, false))
                        {
                            for (int i = 0x0; i < strArray3.Length; i++)
                            {
                                string[] strArray4 = null;
                                if (ParserFunctions.ParseCommaSeparatedString(strArray3[i].Trim(), out strArray4, false))
                                {
                                    for (int j = 0x0; j < strArray4.Length; j++)
                                    {
                                        strArray4[j] = strArray4[j].Trim();
                                    }
                                    if ((!OpportunityManager.ParseTargetInteractionItemInfo(strArray4, ref sharedData) && OpportunityManager.sDoValidation) && (sharedData.mRequiredItems != null))
                                    {
                                        int count = sharedData.mRequiredItems.Count;
                                    }
                                }
                            }
                        }
                    }
                    int num3 = (sharedData.mRequiredItems == null) ? 0x0 : sharedData.mRequiredItems.Count;
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.UseCollectibleProgressText, row.GetBool("TargetUseCollectibleProgressText"));
                    string str10 = row.GetString("TargetDeletionSortingFunction");
                    if ((!string.IsNullOrEmpty(str10) && (OpportunityManager.sOpportunitiesSortClassType != null)) && ParserFunctions.ParseSemicolonSeparatedString(str10, out strArray5))
                    {
                        int length = strArray5.Length;
                        for (int k = 0x0; k < strArray5.Length; k++)
                        {
                            MethodInfo method = OpportunityManager.sOpportunitiesSortClassType.GetMethod(strArray5[k], BindingFlags.Public | BindingFlags.Static);
                            if (method != null)
                            {
                                sharedData.mRequiredItems[k].mInventorySortFn = Delegate.CreateDelegate(typeof(InventoryItemSortDelegate), method) as InventoryItemSortDelegate;
                            }
                        }
                    }
                    if (ParserFunctions.ParseSemicolonSeparatedString(row.GetString("TargetInteractionNumberItemsRequired"), out strArray6))
                    {
                        int num10 = strArray6.Length;
                        for (int m = 0x0; m < strArray6.Length; m++)
                        {
                            List<int> list;
                            int num6 = 0x0;
                            int num7 = 0x0;
                            ParserFunctions.ParseCommaSeperatedInt(strArray6[m], out list);
                            if (list.Count == 0x1)
                            {
                                num6 = num7 = list[0x0];
                            }
                            else if (list.Count == 0x2)
                            {
                                num6 = Math.Min(list[0x0], list[0x1]);
                                num7 = Math.Max(list[0x0], list[0x1]);
                            }
                            sharedData.mRequiredItems[m].mTargetInteractionNumberItemsRequiredMin = num6;
                            sharedData.mRequiredItems[m].mTargetInteractionNumberItemsRequiredMax = num7;
                        }
                    }
                    if ((sharedData.mRequiredItems == null) || ((sharedData.mRequiredItems.Count == 0x1) && (sharedData.mRequiredItems[0x0].mTargetInteractionNumberItemsRequiredMin <= 0x0)))
                    {
                        sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.UseCollectibleProgressText, false);
                    }
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.TargetInteractionItemsDeleted, row.GetBool("TargetInteractionItemsDeleted"));
                    string str12 = row.GetString("TargetProceduralDeletionFunction");
                    if (!string.IsNullOrEmpty(str12) && (OpportunityManager.sOpportunitiesDeletionDelegateClassType != null))
                    {
                        MethodInfo info2 = OpportunityManager.sOpportunitiesDeletionDelegateClassType.GetMethod(str12, BindingFlags.Public | BindingFlags.Static);
                        if (info2 != null)
                        {
                            sharedData.mTargetProceduralDeletionDelegate = Delegate.CreateDelegate(typeof(OpportunityTargetProceduralDeletionDelegate), info2) as OpportunityTargetProceduralDeletionDelegate;
                        }
                    }
                    if ((OpportunityManager.sDoValidation && (sharedData.mRequiredItems != null)) && (sharedData.mRequiredItems.Count > 0x0))
                    {
                        for (int n = 0x0; n < sharedData.mRequiredItems.Count; n++)
                        {
                            if (((sharedData.TargetInteractionItemRequired(n) != null) && (sharedData.mTargetProceduralDeletionDelegate == null)) && ((sharedData.mRequiredItems[n].mTargetInteractionNumberItemsRequiredMin <= 0x0) && (sharedData.mGuid != OpportunityNames.EP1_Quest_Necteaux6)))
                            {
                                OpportunityNames mGuid = sharedData.mGuid;
                            }
                        }
                    }
                    string str13 = row.GetString("AdventureMapTagTarget");
                    if (!string.IsNullOrEmpty(str13))
                    {
                        string[] strArray7;
                        ParserFunctions.ParseCommaSeparatedString(str13, out strArray7);
                        if (strArray7.Length == 0x2)
                        {
                            ParserFunctions.TryParseEnum<AdventureMapTagTargetType>(strArray7[0x0], out sharedData.mAdventureMapTagTargetType, AdventureMapTagTargetType.None);
                            if (sharedData.mAdventureMapTagTargetType != AdventureMapTagTargetType.None)
                            {
                                sharedData.mAdventureMapTagTarget = strArray7[0x1];
                            }
                        }
                    }
                    string str14 = row.GetString("OppMapDagDisplayType");
                    if (!string.IsNullOrEmpty(str14))
                    {
                        ParserFunctions.TryParseEnum<Opportunity.OpportunitySharedData.MapTagOppDisplayType>(str14, out sharedData.MapTagDisplayType, Opportunity.OpportunitySharedData.MapTagOppDisplayType.Normal);
                    }
                    DaysOfTheWeek none = DaysOfTheWeek.None;
                    if (row.TryGetEnum<DaysOfTheWeek>("EventDay", out none, DaysOfTheWeek.None))
                    {
                        sharedData.mEventDay = none;

                        if (row.GetString("EventStartTime") != null)
                        {
                            sharedData.mEventStartTime = ParserFunctions.ParseTime(row.GetString("EventStartTime"));
                        }
                        else
                        {
                            BooterLogger.AddError(file + ": EventStartTime missing " + row["GUID"]);
                        }

                        if (row.GetString("EventEndTime") != null)
                        {
                            sharedData.mEventEndTime = ParserFunctions.ParseTime(row.GetString("EventEndTime"));
                        }
                        else
                        {
                            BooterLogger.AddError(file + ": EventEndTime missing " + row["GUID"]);
                        }

                        sharedData.mEventSetup = row.GetString("EventSetup");
                    }
                    opportunity.SourceData = sharedData.mSourceData;
                    opportunity.SourceType = sharedData.mSourceType;
                    opportunity.TargetData = sharedData.mTargetData;
                    opportunity.TargetType = sharedData.mTargetType;
                }
            }
        }
Beispiel #3
0
        private static void ParseOpportunityNames(BooterHelper.DataBootFile file, int total)
        {
            XmlDbTable table = file.GetTable("Names");
            if (table == null) return;

            BooterLogger.AddTrace(file + ": Found Names = " + table.Rows.Count);

            if (total != table.Rows.Count)
            {
                BooterLogger.AddError(file + ": Found Too few Names " + total + " < " + table.Rows.Count);
            }

            foreach (XmlDbRow row in table.Rows)
            {
                OpportunityNames names = GenericManager<OpportunityNames, Opportunity, Opportunity>.ParseGuid(row["GUID"]);

                // new Code
                if (names == OpportunityNames.Undefined)
                {
                    names = unchecked((OpportunityNames)ResourceUtils.HashString64(row["GUID"]));
                }

                bool sDoValidation = OpportunityManager.sDoValidation;
                if (GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary.ContainsKey((ulong)names))
                {
                    Opportunity.OpportunitySharedData sharedData = GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary[(ulong)names].SharedData;
                    sharedData.mName.Add("Gameplay/Excel/Opportunities/Names:" + row.GetString("OpportunityName"));
                    sharedData.mDescription.Add("Gameplay/Excel/Opportunities/Names:" + row.GetString("OpportunityDescription"));
                    string str3 = row.GetString("OpportunityHint");
                    sharedData.mHint.Add(string.IsNullOrEmpty(str3) ? string.Empty : ("Gameplay/Excel/Opportunities/Names:" + str3));
                    string str4 = row.GetString("CompletionText");
                    sharedData.mCompletionText.Add(string.IsNullOrEmpty(str4) ? string.Empty : ("Gameplay/Excel/Opportunities/Names:" + str4));
                    string str5 = row.GetString("SecondaryCompletionText");
                    sharedData.mSecondaryCompletionText.Add(string.IsNullOrEmpty(str5) ? string.Empty : ("Gameplay/Excel/Opportunities/Names:" + str5));
                    string str6 = row.GetString("FailureText");
                    sharedData.mFailureText.Add(string.IsNullOrEmpty(str6) ? string.Empty : ("Gameplay/Excel/Opportunities/Names:" + str6));
                    string str7 = row.GetString("ProgressText");
                    sharedData.mProgressText.Add(string.IsNullOrEmpty(str7) ? string.Empty : ("Gameplay/Excel/Opportunities/Names:" + str7));
                }
                else
                {
                    BooterLogger.AddError(file + ": Names Unknown Opp " + row["GUID"]);
                }
            }
        }
Beispiel #4
0
        private static void ParseOpportunityRequirements(BooterHelper.DataBootFile file, int total)
        {
            XmlDbTable table = file.GetTable("OpportunitiesRequirements");
            if (table == null) return;

            BooterLogger.AddTrace(file + ": Found Req = " + table.Rows.Count);

            if (total != table.Rows.Count)
            {
                BooterLogger.AddError(file + ": Found Too few Req " + total + " < " + table.Rows.Count);
            }

            foreach (XmlDbRow row in table.Rows)
            {
                OpportunityNames opportunityKey = GenericManager<OpportunityNames, Opportunity, Opportunity>.ParseGuid(row["GUID"]);

                // New code
                if (opportunityKey == OpportunityNames.Undefined)
                {
                    opportunityKey = unchecked((OpportunityNames)ResourceUtils.HashString64(row["GUID"]));
                }

                bool sDoValidation = OpportunityManager.sDoValidation;
                if (GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary.ContainsKey((ulong)opportunityKey))
                {
                    Opportunity opp = GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary[(ulong)opportunityKey];

                    Opportunity.OpportunitySharedData sharedData = opp.SharedData;
                    sharedData.mRequirementList = ParseRequirements(row, opportunityKey);
                    List<string> stringList = row.GetStringList("CustomRequirementFunction", ',');
                    if (stringList.Count > 0)
                    {
                        sharedData.mRequirementDelegate = (OpportunityRequirementDelegate)OpportunityManager.ParseDelegatePair(stringList[0], stringList[1], typeof(OpportunityRequirementDelegate));
                    }
                }
                else
                {
                    BooterLogger.AddError(file + ": Req Unknown Opp " + row["GUID"]);
                }
            }
        }
Beispiel #5
0
        private static void ParseOpportunityCompletion(BooterHelper.DataBootFile file, int total)
        {
            XmlDbTable table = file.GetTable("OpportunitiesCompletion");
            if (table == null) return;

            BooterLogger.AddTrace(file + ": Found Completion = " + table.Rows.Count);

            if (total != table.Rows.Count)
            {
                BooterLogger.AddError(file + ": Found Too few Completion " + total + " < " + table.Rows.Count);
            }

            foreach (XmlDbRow row in table.Rows)
            {
                OpportunityNames names = GenericManager<OpportunityNames, Opportunity, Opportunity>.ParseGuid(row["GUID"]);

                // New code
                if (names == OpportunityNames.Undefined)
                {
                    names = unchecked((OpportunityNames)ResourceUtils.HashString64(row["GUID"]));
                }

                OpportunityNames names2 = GenericManager<OpportunityNames, Opportunity, Opportunity>.ParseGuid(row["TriggerOpportunityOnCompletion"]);
                bool sDoValidation = OpportunityManager.sDoValidation;
                if (GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary.ContainsKey((ulong)names))
                {
                    Opportunity.OpportunitySharedData sharedData = GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary[(ulong)names].SharedData;
                    sharedData.mCompletionTriggerOpportunity = names2;
                    if (names2 != OpportunityNames.Undefined)
                    {
                        GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary[(ulong)names2].SharedData.mParentOpportunity = names;
                    }
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.TriggerQuietly, row.GetBool("TriggerQuietly"));
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.ShowRewardText, row.GetBool("ShowRewardText"));
                    sharedData.mCompletionWinChance = row.GetFloat("CompletionWinChance");
                    sharedData.mWinRewardsList = ParseRewards(row, OpportunityManager.sCompletionWinRewardColumns, 0x4);
                    sharedData.mLossRewardsList = ParseRewards(row, OpportunityManager.sCompletionLossRewardColumns, 0x4);
                    sharedData.mFailureRewardsList = ParseRewards(row, OpportunityManager.sFailureRewardColumns, 0x4);
                    sharedData.mModifierList = ParseModifiers(row, OpportunityManager.sCompletionModifierColumns, 0x4);
                    List<string> stringList = row.GetStringList("CustomOnWinCompletionFunction", ',');
                    if (stringList.Count > 0x0)
                    {
                        bool flag2 = OpportunityManager.sDoValidation;
                        sharedData.mWinCompletionDelegate = (OpportunityCompletionDelegate)OpportunityManager.ParseDelegatePair(stringList[0x0], stringList[0x1], typeof(OpportunityCompletionDelegate));
                    }
                    List<string> list2 = row.GetStringList("CustomOnLossCompletionFunction", ',');
                    if (list2.Count > 0x0)
                    {
                        bool flag3 = OpportunityManager.sDoValidation;
                        sharedData.mLossCompletionDelegate = (OpportunityCompletionDelegate)OpportunityManager.ParseDelegatePair(list2[0x0], list2[0x1], typeof(OpportunityCompletionDelegate));
                    }
                }
            }

            foreach (Opportunity opportunity in GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary.Values)
            {
                OpportunityTargetTypes types;
                string str;
                OpportunityTargetTypes types2;
                string str2;
                if (((opportunity.SharedData.mSourceType == OpportunityTargetTypes.PreviousSource) || (opportunity.SharedData.mSourceType == OpportunityTargetTypes.PreviousTarget)) && (OpportunityManager.FindOriginalSourceOrTarget(opportunity, opportunity.SharedData.mSourceType, out types, out str) != null))
                {
                    opportunity.SharedData.mOriginalSourceType = types;
                }
                if (((opportunity.SharedData.mTargetType == OpportunityTargetTypes.PreviousSource) || (opportunity.SharedData.mTargetType == OpportunityTargetTypes.PreviousTarget)) && (OpportunityManager.FindOriginalSourceOrTarget(opportunity, opportunity.SharedData.mTargetType, out types2, out str2) != null))
                {
                    opportunity.SharedData.mOriginalTargetType = types2;
                }
            }
        }