示例#1
0
        public LogicData CreateItem(CSVRow row)
        {
            LogicData data = null;

            switch (this.m_tableIndex)
            {
            case LogicDataType.BUILDING:
            {
                data = new LogicBuildingData(row, this);
                break;
            }

            case LogicDataType.LOCALE:
            {
                data = new LogicLocaleData(row, this);
                break;
            }

            case LogicDataType.RESOURCE:
            {
                data = new LogicResourceData(row, this);
                break;
            }

            case LogicDataType.CHARACTER:
            {
                data = new LogicCharacterData(row, this);
                break;
            }

            case LogicDataType.ANIMATION:
            {
                data = new LogicAnimationData(row, this);
                break;
            }

            case LogicDataType.PROJECTILE:
            {
                data = new LogicProjectileData(row, this);
                break;
            }

            case LogicDataType.BUILDING_CLASS:
            {
                data = new LogicBuildingClassData(row, this);
                break;
            }

            case LogicDataType.OBSTACLE:
            {
                data = new LogicObstacleData(row, this);
                break;
            }

            case LogicDataType.EFFECT:
            {
                data = new LogicEffectData(row, this);
                break;
            }

            case LogicDataType.PARTICLE_EMITTER:
            {
                data = new LogicParticleEmitterData(row, this);
                break;
            }

            case LogicDataType.EXPERIENCE_LEVEL:
            {
                data = new LogicExperienceLevelData(row, this);
                break;
            }

            case LogicDataType.TRAP:
            {
                data = new LogicTrapData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_BADGE:
            {
                data = new LogicAllianceBadgeData(row, this);
                break;
            }

            case LogicDataType.GLOBAL:
            case LogicDataType.CLIENT_GLOBAL:
            {
                data = new LogicGlobalData(row, this);
                break;
            }

            case LogicDataType.TOWNHALL_LEVEL:
            {
                data = new LogicTownhallLevelData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_PORTAL:
            {
                data = new LogicAlliancePortalData(row, this);
                break;
            }

            case LogicDataType.NPC:
            {
                data = new LogicNpcData(row, this);
                break;
            }

            case LogicDataType.DECO:
            {
                data = new LogicDecoData(row, this);
                break;
            }

            case LogicDataType.RESOURCE_PACK:
            {
                data = new LogicResourcePackData(row, this);
                break;
            }

            case LogicDataType.SHIELD:
            {
                data = new LogicShieldData(row, this);
                break;
            }

            case LogicDataType.MISSION:
            {
                data = new LogicMissionData(row, this);
                break;
            }

            case LogicDataType.BILLING_PACKAGE:
            {
                data = new LogicBillingPackageData(row, this);
                break;
            }

            case LogicDataType.ACHIEVEMENT:
            {
                data = new LogicAchievementData(row, this);
                break;
            }

            case LogicDataType.SPELL:
            {
                data = new LogicSpellData(row, this);
                break;
            }

            case LogicDataType.HINT:
            {
                data = new LogicHintData(row, this);
                break;
            }

            case LogicDataType.HERO:
            {
                data = new LogicHeroData(row, this);
                break;
            }

            case LogicDataType.LEAGUE:
            {
                data = new LogicLeagueData(row, this);
                break;
            }

            case LogicDataType.NEWS:
            {
                data = new LogicNewsData(row, this);
                break;
            }

            case LogicDataType.WAR:
            {
                data = new LogicWarData(row, this);
                break;
            }

            case LogicDataType.REGION:
            {
                data = new LogicRegionData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_BADGE_LAYER:
            {
                data = new LogicAllianceBadgeLayerData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_LEVEL:
            {
                data = new LogicAllianceLevelData(row, this);
                break;
            }

            case LogicDataType.HELPSHIFT:
            {
                data = new LogicHelpshiftData(row, this);
                break;
            }

            case LogicDataType.CREDIT:
            case LogicDataType.FAQ:
            case LogicDataType.VARIABLE:
            {
                data = new LogicData(row, this);
                break;
            }

            case LogicDataType.GEM_BUNDLE:
            {
                data = new LogicGemBundleData(row, this);
                break;
            }

            case LogicDataType.VILLAGE_OBJECT:
            {
                data = new LogicVillageObjectData(row, this);
                break;
            }

            case LogicDataType.CALENDAR_EVENT_FUNCTION:
            {
                data = new LogicCalendarEventFunctionData(row, this);
                break;
            }

            case LogicDataType.BOOMBOX:
            {
                data = new LogicBoomboxData(row, this);
                break;
            }

            case LogicDataType.EVENT_ENTRY:
            {
                data = new LogicEventEntryData(row, this);
                break;
            }

            case LogicDataType.DEEPLINK:
            {
                data = new LogicDeeplinkData(row, this);
                break;
            }

            case LogicDataType.LEAGUE_VILLAGE2:
            {
                data = new LogicLeagueVillage2Data(row, this);
                break;
            }

            default:
            {
                Debugger.Error("Invalid data table id: " + this.m_tableIndex);
                break;
            }
            }

            return(data);
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            for (int i = 0; i < this.GetArraySize("Dependencies"); i++)
            {
                LogicMissionData dependency = LogicDataTables.GetMissionByName(this.GetValue("Dependencies", i), this);

                if (dependency != null)
                {
                    this.m_missionDependencies.Add(dependency);
                }
            }

            this.m_action               = this.GetValue("Action", 0);
            this.m_deprecated           = this.GetBooleanValue("Deprecated", 0);
            this.m_missionCategory      = this.GetIntegerValue("MissionCategory", 0);
            this.m_fixVillageObjectData = LogicDataTables.GetVillageObjectByName(this.GetValue("FixVillageObject", 0), this);

            if (this.m_fixVillageObjectData != null)
            {
                this.m_buildBuildingLevel = this.GetIntegerValue("BuildBuildingLevel", 0);
                this.m_missionType        = 13;
            }

            if (string.Equals(this.m_action, "travel"))
            {
                this.m_missionType = 14;
            }
            else if (string.Equals(this.m_action, "upgrade2"))
            {
                this.m_characterData = LogicDataTables.GetCharacterByName(this.GetValue("Character", 0), this);
                this.m_missionType   = 17;
            }
            else if (string.Equals(this.m_action, "duel"))
            {
                this.m_attackNpcData = LogicDataTables.GetNpcByName(this.GetValue("AttackNPC", 0), this);
                this.m_missionType   = 18;
            }
            else if (string.Equals(this.m_action, "duel_end"))
            {
                this.m_attackNpcData = LogicDataTables.GetNpcByName(this.GetValue("AttackNPC", 0), this);
                this.m_missionType   = 19;
            }
            else if (string.Equals(this.m_action, "duel_end2"))
            {
                this.m_missionType = 20;
            }
            else if (string.Equals(this.m_action, "show_builder_menu"))
            {
                this.m_missionType = 21;
            }

            this.m_buildBuildingData = LogicDataTables.GetBuildingByName(this.GetValue("BuildBuilding", 0), this);

            if (this.m_buildBuildingData != null)
            {
                this.m_buildBuildingCount = this.GetIntegerValue("BuildBuildingCount", 0);
                this.m_buildBuildingLevel = this.GetIntegerValue("BuildBuildingLevel", 0) - 1;
                this.m_missionType        = string.Equals(this.m_action, "unlock") ? 15 : 5;

                if (this.m_buildBuildingCount < 0)
                {
                    Debugger.Error("missions.csv: BuildBuildingCount is invalid!");
                }
            }
            else
            {
                if (this.m_missionType == -1)
                {
                    this.m_openAchievements = this.GetBooleanValue("OpenAchievements", 0);

                    if (this.m_openAchievements)
                    {
                        this.m_missionType = 7;
                    }
                    else
                    {
                        this.m_defendNpcData = LogicDataTables.GetNpcByName(this.GetValue("DefendNPC", 0), this);

                        if (this.m_defendNpcData != null)
                        {
                            this.m_missionType = 1;
                        }
                        else
                        {
                            this.m_attackNpcData = LogicDataTables.GetNpcByName(this.GetValue("AttackNPC", 0), this);

                            if (this.m_attackNpcData != null)
                            {
                                this.m_missionType = 2;
                                this.m_showMap     = this.GetBooleanValue("ShowMap", 0);
                            }
                            else
                            {
                                this.m_changeName = this.GetBooleanValue("ChangeName", 0);

                                if (this.m_changeName)
                                {
                                    this.m_missionType = 6;
                                }
                                else
                                {
                                    this.m_trainTroopCount = this.GetIntegerValue("TrainTroops", 0);

                                    if (this.m_trainTroopCount > 0)
                                    {
                                        this.m_missionType = 4;
                                    }
                                    else
                                    {
                                        this.m_switchSides = this.GetBooleanValue("SwitchSides", 0);

                                        if (this.m_switchSides)
                                        {
                                            this.m_missionType = 8;
                                        }
                                        else
                                        {
                                            this.m_showWarBase = this.GetBooleanValue("ShowWarBase", 0);

                                            if (this.m_showWarBase)
                                            {
                                                this.m_missionType = 9;
                                            }
                                            else
                                            {
                                                this.m_openInfo = this.GetBooleanValue("OpenInfo", 0);

                                                if (this.m_openInfo)
                                                {
                                                    this.m_missionType = 11;
                                                }
                                                else
                                                {
                                                    this.m_showDonate = this.GetBooleanValue("ShowDonate", 0);

                                                    if (this.m_showDonate)
                                                    {
                                                        this.m_missionType = 10;
                                                    }
                                                    else
                                                    {
                                                        this.m_showStates = this.GetBooleanValue("WarStates", 0);

                                                        if (this.m_showStates)
                                                        {
                                                            this.m_missionType = 12;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            this.m_villagers = this.GetIntegerValue("Villagers", 0);

            if (this.m_villagers > 0)
            {
                this.m_missionType = 16;
            }

            this.m_forceCamera = this.GetBooleanValue("ForceCamera", 0);

            if (this.m_missionType == -1)
            {
                Debugger.Error(string.Format("missions.csv: invalid mission ({0})", this.GetName()));
            }

            this.m_rewardResourceData  = LogicDataTables.GetResourceByName(this.GetValue("RewardResource", 0), this);
            this.m_rewardResourceCount = this.GetIntegerValue("RewardResourceCount", 0);

            if (this.m_rewardResourceData != null)
            {
                if (this.m_rewardResourceCount != 0)
                {
                    if (this.m_rewardResourceCount < 0)
                    {
                        Debugger.Error("missions.csv: RewardResourceCount is negative!");

                        this.m_rewardResourceData  = null;
                        this.m_rewardResourceCount = 0;
                    }
                }
                else
                {
                    this.m_rewardResourceData = null;
                }
            }
            else if (this.m_rewardResourceCount != 0)
            {
                Debugger.Warning("missions.csv: RewardResourceCount defined but RewardResource is not!");
                this.m_rewardResourceCount = 0;
            }

            this.m_customData = this.GetIntegerValue("CustomData", 0);
            this.m_rewardXp   = this.GetIntegerValue("RewardXP", 0);

            if (this.m_rewardXp < 0)
            {
                Debugger.Warning("missions.csv: RewardXP is negative!");
                this.m_rewardXp = 0;
            }

            this.m_rewardCharacterData  = LogicDataTables.GetCharacterByName(this.GetValue("RewardTroop", 0), this);
            this.m_rewardCharacterCount = this.GetIntegerValue("RewardTroopCount", 0);

            if (this.m_rewardCharacterData != null)
            {
                if (this.m_rewardCharacterCount != 0)
                {
                    if (this.m_rewardCharacterCount < 0)
                    {
                        Debugger.Error("missions.csv: RewardTroopCount is negative!");

                        this.m_rewardCharacterData  = null;
                        this.m_rewardCharacterCount = 0;
                    }
                }
                else
                {
                    this.m_rewardCharacterData = null;
                }
            }
            else if (this.m_rewardCharacterCount != 0)
            {
                Debugger.Warning("missions.csv: RewardTroopCount defined but RewardTroop is not!");
                this.m_rewardCharacterCount = 0;
            }

            this.m_delay        = this.GetIntegerValue("Delay", 0);
            this.m_villageType  = this.GetIntegerValue("VillageType", 0);
            this.m_firstStep    = this.GetBooleanValue("FirstStep", 0);
            this.m_tutorialText = this.GetValue("TutorialText", 0);

            if (this.m_tutorialText.Length > 0)
            {
                // BLABLABLA
            }
        }