Exemple #1
0
        public List <string> AddResultsToDataTbls(DataOptions results)
        {
            var fileDbType = new List <string>();

            var types = results.GetContainerTypes();

            if (types.Contains(typeof(Battle)) && types.Contains(typeof(Fighter)))
            {
                if (types.Contains(typeof(Battle)))
                {
                    dataTbls.battleData = (BattleDataOptions)results.GetDataOptionsFromUnderlyingType(typeof(Battle));
                    fileDbType.Add("Battle");
                }
                if (types.Contains(typeof(Fighter)))
                {
                    dataTbls.fighterData = (FighterDataOptions)results.GetDataOptionsFromUnderlyingType(typeof(Fighter));
                    fileDbType.Add("Fighter");
                }

                buildFighterDataTab(dataTbls.battleData.GetBattleAtIndex(0).battle_id);
            }
            if (types.Exists(x => x.IsSubclassOf(typeof(Event))))
            {
                dataTbls.eventData = (EventDataOptions)results.GetDataOptionsFromUnderlyingType(typeof(Event));
                dataTbls.eventData.SetFoundEventTypes(dataTbls.battleData.event_type);  //Some unique values in battleData, so we combine the two sets.

                fileDbType.Add("Event");
            }
            if (types.Contains(typeof(Item)))
            {
                dataTbls.itemData = (ItemDataOptions)results.GetDataOptionsFromUnderlyingType(typeof(Item));
                var itemEvents = dataTbls.itemData.GetAsEvents();
                dataTbls.eventData.AddUniqueEvents(itemEvents);
                fileDbType.Add("Item");
            }
            if (types.Contains(typeof(SpiritFighter)))
            {
                dataTbls.spiritFighterData = (SpiritFighterDataOptions)results.GetDataOptionsFromUnderlyingType(typeof(SpiritFighter));
                fileDbType.Add("Spirit Fighter");
            }
            if (types.Contains(typeof(SpiritBoard)))
            {
                dataTbls.spiritBoardData = (SpiritBoardDataOptions)results.GetDataOptionsFromUnderlyingType(typeof(SpiritBoard));
                fileDbType.Add("Spirit Board");
            }
            if (types.Contains(typeof(Spirit)))
            {
                dataTbls.spiritData = (SpiritDataOptions)results.GetDataOptionsFromUnderlyingType(typeof(Spirit));
                fileDbType.Add("Spirit");
            }
            if (types.Contains(typeof(SpiritAbilities)))
            {
                var abilities = results.GetItemsOfType(typeof(SpiritAbilities));
                var names     = abilities?.Select(x => x?.GetPropertyValueFromName(SpiritAbilities.fieldKey)).ToList();
                dataTbls.battleData.AddRecommendedSkills(names);
                dataTbls.fighterData.AddNewAbilities(names);
                fileDbType.Add("Spirit Ability");
            }
            if (types.Contains(typeof(Bgm)))
            {
                var bgms  = results.GetItemsOfType(typeof(Bgm));
                var names = bgms?.Select(x => x?.GetPropertyValueFromName(Bgm.fieldKey));
                dataTbls.battleData.stage_bgm = names;
                fileDbType.Add("BGM");
            }
            if (types.Contains(typeof(Stage)))
            {
                var stages = results.GetItemsOfType(typeof(Stage));
                var names  = stages?.Select(x => x?.GetPropertyValueFromName(Stage.fieldKey));
                dataTbls.battleData.ui_stage_id = names;
                fileDbType.Add("Stage");
            }

            return(fileDbType);
        }