public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_mapInstanceName = this.GetValue("MapInstanceName", 0);
            this.m_expLevel        = this.GetIntegerValue("ExpLevel", 0);
            this.m_levelFile       = this.GetValue("LevelFile", 0);
            this.m_goldCount       = this.GetIntegerValue("Gold", 0);
            this.m_elixirCount     = this.GetIntegerValue("Elixir", 0);
            this.m_alwaysUnlocked  = this.GetBooleanValue("AlwaysUnlocked", 0);
            this.m_playerName      = this.GetValue("PlayerName", 0);
            this.m_allianceName    = this.GetValue("AllianceName", 0);
            this.m_allianceBadge   = this.GetIntegerValue("AllianceBadge", 0);
            this.m_singlePlayer    = this.GetBooleanValue("SinglePlayer", 0);

            int unitCountSize = this.GetArraySize("UnitType");

            if (unitCountSize > 0)
            {
                this.m_unitCount.EnsureCapacity(unitCountSize);

                for (int i = 0; i < unitCountSize; i++)
                {
                    int count = this.GetIntegerValue("UnitCount", i);

                    if (count > 0)
                    {
                        this.m_unitCount.Add(new LogicDataSlot(LogicDataTables.GetCharacterByName(this.GetValue("UnitType", i), this), count));
                    }
                }
            }

            int mapDependencySize = this.GetArraySize("MapDependencies");

            for (int i = 0; i < mapDependencySize; i++)
            {
                LogicNpcData data = LogicDataTables.GetNpcByName(this.GetValue("MapDependencies", i), this);

                if (data != null)
                {
                    this.m_dependencies.Add(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
            }
        }