예제 #1
0
        /// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void CreateReferences()
        {
            base.CreateVillageReferences();

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

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

            this._action               = this.GetValue("Action", 0);
            this._deprecated           = this.GetBooleanValue("Deprecated", 0);
            this._missionCategory      = this.GetIntegerValue("MissionCategory", 0);
            this._fixVillageObjectData = LogicDataTables.GetVillageObjectByName(this.GetValue("FixVillageObject", 0));

            if (this._fixVillageObjectData != null)
            {
                this._buildBuildingLevel = this.GetIntegerValue("BuildBuildingLevel", 0);
                this._missionType        = 13;
            }

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

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

            if (this._buildBuildingData != null)
            {
                this._buildBuildingCount = this.GetIntegerValue("BuildBuildingCount", 0);
                this._buildBuildingLevel = this.GetIntegerValue("BuildBuildingLevel", 0) - 1;
                this._missionType        = string.Equals(this._action, "unlock") ? 15 : 5;

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

                    if (this._openAchievements)
                    {
                        this._missionType = 7;
                    }
                    else
                    {
                        this._defendNpcData = LogicDataTables.GetNpcByName(this.GetValue("DefendNPC", 0));

                        if (this._defendNpcData != null)
                        {
                            this._missionType = 1;
                        }
                        else
                        {
                            this._attackNpcData = LogicDataTables.GetNpcByName(this.GetValue("AttackNPC", 0));

                            if (this._attackNpcData != null)
                            {
                                this._missionType = 2;
                                this._showMap     = this.GetBooleanValue("ShowMap", 0);
                            }
                            else
                            {
                                this._changeName = this.GetBooleanValue("ChangeName", 0);

                                if (this._changeName)
                                {
                                    this._missionType = 6;
                                }
                                else
                                {
                                    this._trainTroopCount = this.GetIntegerValue("TrainTroops", 0);

                                    if (this._trainTroopCount > 0)
                                    {
                                        this._missionType = 4;
                                    }
                                    else
                                    {
                                        this._switchSides = this.GetBooleanValue("SwitchSides", 0);

                                        if (this._switchSides)
                                        {
                                            this._missionType = 8;
                                        }
                                        else
                                        {
                                            this._showWarBase = this.GetBooleanValue("ShowWarBase", 0);

                                            if (this._showWarBase)
                                            {
                                                this._missionType = 9;
                                            }
                                            else
                                            {
                                                this._openInfo = this.GetBooleanValue("OpenInfo", 0);

                                                if (this._openInfo)
                                                {
                                                    this._missionType = 11;
                                                }
                                                else
                                                {
                                                    this._showDonate = this.GetBooleanValue("ShowDonate", 0);

                                                    if (this._showDonate)
                                                    {
                                                        this._missionType = 10;
                                                    }
                                                    else
                                                    {
                                                        this._showStates = this.GetBooleanValue("WarStates", 0);

                                                        if (this._showStates)
                                                        {
                                                            this._missionType = 12;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

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

            if (this._villagers > 0)
            {
                this._missionType = 16;
            }

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

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

            this._rewardResourceData  = LogicDataTables.GetResourceByName(this.GetValue("RewardResource", 0));
            this._rewardResourceCount = this.GetIntegerValue("RewardResourceCount", 0);

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

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

            this._customData = this.GetIntegerValue("CustomData", 0);
            this._rewardXp   = this.GetIntegerValue("RewardXP", 0);

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

            this._rewardCharacterData  = LogicDataTables.GetCharacterByName(this.GetValue("RewardTroop", 0));
            this._rewardCharacterCount = this.GetIntegerValue("RewardTroopCount", 0);

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

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

            this._delay        = this.GetIntegerValue("Delay", 0);
            this._villageType  = this.GetIntegerValue("VillageType", 0);
            this._firstStep    = this.GetBooleanValue("FirstStep", 0);
            this._tutorialText = this.GetValue("TutorialText", 0);

            if (this._tutorialText.Length > 0)
            {
                // BLABLABLA
            }
        }
예제 #2
0
        /// <summary>
        ///     Creates a new data item.
        /// </summary>
        public LogicData CreateItem(CSVRow row)
        {
            LogicData data = null;

            switch (this._tableIndex)
            {
            case 0:
            {
                data = new LogicBuildingData(row, this);
                break;
            }

            case 1:
            {
                data = new LogicLocaleData(row, this);
                break;
            }

            case 2:
            {
                data = new LogicResourceData(row, this);
                break;
            }

            case 3:
            {
                data = new LogicCharacterData(row, this);
                break;
            }

            case 5:
            {
                data = new LogicProjectileData(row, this);
                break;
            }

            case 6:
            {
                data = new LogicBuildingClassData(row, this);
                break;
            }

            case 7:
            {
                data = new LogicObstacleData(row, this);
                break;
            }

            case 8:
            {
                data = new LogicEffectData(row, this);
                break;
            }

            case 9:
            {
                data = new LogicParticleEmitterData(row, this);
                break;
            }

            case 10:
            {
                data = new LogicExperienceLevelData(row, this);
                break;
            }

            case 11:
            {
                data = new LogicTrapData(row, this);
                break;
            }

            case 12:
            {
                data = new LogicAllianceBadgeData(row, this);
                break;
            }

            case 13:
            {
                data = new LogicGlobalData(row, this);
                break;
            }

            case 14:
            {
                data = new LogicTownhallLevelData(row, this);
                break;
            }

            case 15:
            {
                data = new LogicAlliancePortalData(row, this);
                break;
            }

            case 16:
            {
                data = new LogicNpcData(row, this);
                break;
            }

            case 17:
            {
                data = new LogicDecoData(row, this);
                break;
            }

            case 18:
            {
                data = new LogicResourcePackData(row, this);
                break;
            }

            case 19:
            {
                data = new LogicShieldData(row, this);
                break;
            }

            case 20:
            {
                data = new LogicMissionData(row, this);
                break;
            }

            case 21:
            {
                data = new LogicBillingPackageData(row, this);
                break;
            }

            case 22:
            {
                data = new LogicAchievementData(row, this);
                break;
            }

            case 23:
            {
                data = new LogicFaqData(row, this);
                break;
            }

            case 25:
            {
                data = new LogicSpellData(row, this);
                break;
            }

            case 26:
            {
                data = new LogicHintData(row, this);
                break;
            }

            case 27:
            {
                data = new LogicHeroData(row, this);
                break;
            }

            case 28:
            {
                data = new LogicLeagueData(row, this);
                break;
            }

            case 29:
            {
                data = new LogicNewsData(row, this);
                break;
            }

            case 30:
            {
                data = new LogicWarData(row, this);
                break;
            }

            case 31:
            {
                data = new LogicRegionData(row, this);
                break;
            }

            case 32:
            {
                data = new LogicGlobalData(row, this);
                break;
            }

            case 33:
            {
                data = new LogicAllianceBadgeLayerData(row, this);
                break;
            }

            case 34:
            {
                data = new LogicAllianceLevelData(row, this);
                break;
            }

            case 36:
            {
                data = new LogicVariableData(row, this);
                break;
            }

            case 37:
            {
                data = new LogicGemBundleData(row, this);
                break;
            }

            case 38:
            {
                data = new LogicVillageObjectData(row, this);
                break;
            }

            case 39:
            {
                data = new LogicCalendarEventFunctionData(row, this);
                break;
            }

            case 40:
            {
                data = new LogicBoomboxData(row, this);
                break;
            }

            case 41:
            {
                data = new LogicEventEntryData(row, this);
                break;
            }

            case 42:
            {
                data = new LogicDeeplinkData(row, this);
                break;
            }

            case 43:
            {
                data = new LogicLeague2Data(row, this);
                break;
            }

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

            return(data);
        }