/// <summary> /// Called when all instances has been loaded for initialized members in instance. /// </summary> public override void CreateReferences() { this._villageType = this.GetIntegerValue("UIGroup", 0); this._diamondReward = this.GetIntegerValue("DiamondReward", 0); this._expReward = this.GetIntegerValue("ExpReward", 0); this._actionCount = this.GetIntegerValue("ActionCount", 0); this._level = this.GetIntegerValue("Level", 0); this._levelCount = this.GetIntegerValue("LevelCount", 0); this._completedTID = this.GetValue("CompetedTID", 0); this._showValue = this.GetBooleanValue("ShowValue", 0); this._androidId = this.GetValue("AndroidID", 0); if (this._actionCount == 0) { Debugger.Error("Achievement has invalid ActionCount 0"); } string action = this.GetValue("Action", 0); switch (action) { case "npc_stars": this._actionType = 0; break; case "upgrade": this._actionType = 1; this._buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0)); if (this._buildingData == null) { Debugger.Error("LogicAchievementData - Building data is NULL for upgrade achievement"); } break; case "victory_points": this._actionType = 2; break; case "unit_unlock": this._actionType = 3; this._characterData = LogicDataTables.GetCharacterByName(this.GetValue("ActionData", 0)); if (this._characterData == null) { Debugger.Error("LogicCharacterData - Character data is NULL for unit_unlock achievement"); } break; case "clear_obstacles": this._actionType = 4; break; case "donate_units": this._actionType = 5; break; case "loot": this._actionType = 6; this._resourceData = LogicDataTables.GetResourceByName(this.GetValue("ActionData", 0)); if (this._resourceData == null) { Debugger.Error("LogicAchievementData - Resource data is NULL for loot achievement"); } break; case "destroy": this._actionType = 9; this._buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0)); if (this._buildingData == null) { Debugger.Error("LogicAchievementData - Building data is NULL for destroy achievement"); } break; case "win_pvp_attack": this._actionType = 10; break; case "win_pvp_defense": this._actionType = 11; break; case "league": this._actionType = 12; break; case "war_stars": this._actionType = 13; break; case "war_loot": this._actionType = 14; break; case "donate_spells": this._actionType = 15; break; case "account_bound": this._actionType = 16; break; case "vs_battle_trophies": this._actionType = 17; break; case "gear_up": this._actionType = 18; break; case "repair_building": this._actionType = 19; this._buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0)); if (this._buildingData == null) { Debugger.Error("LogicAchievementData - Building data is NULL for repair_building achievement"); } break; default: Debugger.Error(string.Format("Unknown Action in achievements {0}", action)); break; } this._achievementLevel = new LogicArrayList <LogicAchievementData>(); String achievementName = this.GetName().Substring(0, this.GetName().Length - 1); LogicDataTable table = LogicDataTables.GetTable(22); for (int i = 0; i < table.GetItemCount(); i++) { LogicAchievementData achievementData = (LogicAchievementData)table.GetItemAt(i); if (achievementData.GetName().Contains(achievementName)) { if (achievementData.GetName().Substring(0, achievementData.GetName().Length - 1).Equals(achievementName)) { this._achievementLevel.Add(achievementData); } } } Debugger.DoAssert(this._achievementLevel.Count == this._levelCount, string.Format("Expected same amount of achievements named {0}X to be same as LevelCount={1} for {2}.", achievementName, this._levelCount, this.GetName())); }
/// <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); }