public LogicData(CSVRow row, LogicDataTable table)
        {
            this.m_row      = row;
            this.m_table    = table;
            this.m_globalId = GlobalID.CreateGlobalID((int)table.GetTableIndex() + 1, table.GetItemCount());

            this.m_tidIndex            = -1;
            this.m_infoTidIndex        = -1;
            this.m_iconSWFIndex        = -1;
            this.m_iconExportNameIndex = -1;
        }
Exemple #2
0
 public LogicParticleEmitterData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicParticleEmitterData.
 }
Exemple #3
0
        public static void CreateReferences()
        {
            LogicDataTables.m_tables[(int)LogicDataType.PARTICLE_EMITTER].CreateReferences();

            for (int i = 0; i < LogicDataTables.m_tables.Length; i++)
            {
                if ((LogicDataType)i != LogicDataType.PARTICLE_EMITTER)
                {
                    if (LogicDataTables.m_tables[i] != null)
                    {
                        LogicDataTables.m_tables[i].CreateReferences();
                    }
                }
            }

            for (int i = 0; i < LogicDataTables.m_tables.Length; i++)
            {
                if (LogicDataTables.m_tables[i] != null)
                {
                    LogicDataTables.m_tables[i].CreateReferences2();
                }
            }

            // LogicDataTables.m_animationTable.CreateReferences();

            LogicDataTable buildingDataTable = LogicDataTables.m_tables[(int)LogicDataType.BUILDING];

            for (int i = 0; i < buildingDataTable.GetItemCount(); i++)
            {
                LogicBuildingData buildingData = (LogicBuildingData)buildingDataTable.GetItemAt(i);

                if (buildingData.IsAllianceCastle())
                {
                    LogicDataTables.m_allianceCastleData = buildingData;
                }

                if (buildingData.IsTownHall() && LogicDataTables.m_townHallData == null)
                {
                    LogicDataTables.m_townHallData = buildingData;
                }

                if (buildingData.IsTownHallVillage2() && LogicDataTables.m_townHallVillage2Data == null)
                {
                    LogicDataTables.m_townHallVillage2Data = buildingData;
                }
            }

            LogicDataTables.m_bowData                = LogicDataTables.GetBuildingByName("Bow", null);
            LogicDataTables.m_darkTowerData          = LogicDataTables.GetBuildingByName("Dark Tower", null);
            LogicDataTables.m_ancientArtilleryData   = LogicDataTables.GetBuildingByName("Ancient Artillery", null);
            LogicDataTables.m_workerData             = LogicDataTables.GetBuildingByName("Worker Building", null);
            LogicDataTables.m_laboratoryVillage2Data = LogicDataTables.GetBuildingByName("Laboratory2", null);
            LogicDataTables.m_diamondsData           = LogicDataTables.GetResourceByName("Diamonds", null);
            LogicDataTables.m_goldData               = LogicDataTables.GetResourceByName("Gold", null);
            LogicDataTables.m_elixirData             = LogicDataTables.GetResourceByName("Elixir", null);
            LogicDataTables.m_darkElixirData         = LogicDataTables.GetResourceByName("DarkElixir", null);
            LogicDataTables.m_gold2Data              = LogicDataTables.GetResourceByName("Gold2", null);
            LogicDataTables.m_elixir2Data            = LogicDataTables.GetResourceByName("Elixir2", null);
            LogicDataTables.m_warGoldData            = LogicDataTables.GetResourceByName("WarGold", null);
            LogicDataTables.m_warElixirData          = LogicDataTables.GetResourceByName("WarElixir", null);
            LogicDataTables.m_warDarkElixirData      = LogicDataTables.GetResourceByName("WarDarkElixir", null);
            LogicDataTables.m_skeletonData           = LogicDataTables.GetCharacterByName("Skeleton", null);
            LogicDataTables.m_balloonSkeletonData    = LogicDataTables.GetCharacterByName("Balloon Skeleton", null);
        }
 public LogicGemBundleData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicGemBundleData.
 }
 public LogicVillageObjectData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicVillageObjectData.
 }
Exemple #6
0
 public LogicCalendarEventFunctionData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicCalendarEventFunctionData.
 }
Exemple #7
0
 public LogicBuildingClassData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicBuildingClassData.
 }
Exemple #8
0
 protected LogicGameObjectData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     this.m_villageType = -1;
 }
Exemple #9
0
 public LogicResourceData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicResourceData.
 }
 public LogicLeagueVillage2Data(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicLeagueVillage2Data.
 }
 public LogicSpellData(CSVRow row, LogicDataTable table) : base(row, table)
 {
 }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_buildingCaps       = new LogicArrayList <int>();
            this.m_buildingGearupCaps = new LogicArrayList <int>();
            this.m_trapCaps           = new LogicArrayList <int>();
            this.m_treasuryCaps       = new LogicArrayList <int>();

            LogicTownhallLevelData previousItem = null;

            if (this.GetInstanceID() > 0)
            {
                previousItem = (LogicTownhallLevelData)this.m_table.GetItemAt(this.GetInstanceID() - 1);
            }

            LogicDataTable buildingTable = LogicDataTables.GetTable(LogicDataType.BUILDING);

            for (int i = 0; i < buildingTable.GetItemCount(); i++)
            {
                LogicData item = buildingTable.GetItemAt(i);

                int cap    = this.GetIntegerValue(item.GetName(), 0);
                int gearup = this.GetIntegerValue(item.GetName() + "_gearup", 0);

                if (previousItem != null)
                {
                    if (cap == 0)
                    {
                        cap = previousItem.m_buildingCaps[i];
                    }

                    if (gearup == 0)
                    {
                        gearup = previousItem.m_buildingGearupCaps[i];
                    }
                }

                this.m_buildingCaps.Add(cap);
                this.m_buildingGearupCaps.Add(gearup);
            }

            LogicDataTable trapTable = LogicDataTables.GetTable(LogicDataType.TRAP);

            for (int i = 0; i < trapTable.GetItemCount(); i++)
            {
                int cap = this.GetIntegerValue(trapTable.GetItemAt(i).GetName(), 0);

                if (previousItem != null)
                {
                    if (cap == 0)
                    {
                        cap = previousItem.m_trapCaps[i];
                    }
                }

                this.m_trapCaps.Add(cap);
            }

            LogicDataTable resourceTable = LogicDataTables.GetTable(LogicDataType.RESOURCE);

            for (int i = 0; i < resourceTable.GetItemCount(); i++)
            {
                this.m_treasuryCaps.Add(this.GetIntegerValue("Treasury" + resourceTable.GetItemAt(i).GetName(), 0));
            }

            this.m_attackCost                      = this.GetIntegerValue("AttackCost", 0);
            this.m_attackCostVillage2              = this.GetIntegerValue("AttackCostVillage2", 0);
            this.m_resourceStorageLootPercentage   = this.GetIntegerValue("ResourceStorageLootPercentage", 0);
            this.m_darkElixirStorageLootPercentage = this.GetIntegerValue("DarkElixirStorageLootPercentage", 0);
            this.m_resourceStorageLootCap          = this.GetIntegerValue("ResourceStorageLootCap", 0);
            this.m_darkElixirStorageLootCap        = this.GetIntegerValue("DarkElixirStorageLootCap", 0);
            this.m_warPrizeResourceCap             = this.GetIntegerValue("WarPrizeResourceCap", 0);
            this.m_warPrizeDarkElixirCap           = this.GetIntegerValue("WarPrizeDarkElixirCap", 0);
            this.m_warPrizeAllianceExpCap          = this.GetIntegerValue("WarPrizeAllianceExpCap", 0);
            this.m_cartLootCapResource             = this.GetIntegerValue("CartLootCapResource", 0);
            this.m_cartLootReengagementResource    = this.GetIntegerValue("CartLootReengagementResource", 0);
            this.m_cartLootCapDarkElixir           = this.GetIntegerValue("CartLootCapDarkElixir", 0);
            this.m_cartLootReengagementDarkElixir  = this.GetIntegerValue("CartLootReengagementDarkElixir", 0);
            this.m_strengthMaxTroopTypes           = this.GetIntegerValue("StrengthMaxTroopTypes", 0);
            this.m_strengthMaxSpellTypes           = this.GetIntegerValue("StrengthMaxSpellTypes", 0);
            this.m_friendlyCost                    = this.GetIntegerValue("FriendlyCost", 0);
            this.m_packElixir                      = this.GetIntegerValue("PackElixir", 0);
            this.m_packGold             = this.GetIntegerValue("PackGold", 0);
            this.m_packDarkElixir       = this.GetIntegerValue("PackDarkElixir", 0);
            this.m_packGold2            = this.GetIntegerValue("PackGold2", 0);
            this.m_packElixir2          = this.GetIntegerValue("PackElixir2", 0);
            this.m_duelPrizeResourceCap = this.GetIntegerValue("DuelPrizeResourceCap", 0);
            this.m_changeTroopCost      = this.GetIntegerValue("ChangeTroopCost", 0);

            if ((uint)this.m_darkElixirStorageLootPercentage > 100 || (uint)this.m_darkElixirStorageLootPercentage > 100)
            {
                Debugger.Error("townhall_levels.csv: Invalid loot percentage!");
            }
        }
 public LogicTownhallLevelData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     this.m_maxHousingSpace = -1;
 }
        public void CalculateHousingSpaceCap()
        {
            this.m_maxHousingSpace = 0;

            if (this.GetInstanceID() > 0)
            {
                this.m_table.GetItemAt(this.GetInstanceID() - 1); // Thx supercell for the crappy code.
            }

            LogicDataTable buildingTable  = LogicDataTables.GetTable(LogicDataType.BUILDING);
            int            dataTableCount = this.m_table.GetItemCount();

            if (dataTableCount > 0)
            {
                int unitHousingCostMultiplierForTotal         = LogicDataTables.GetGlobals().GetUnitHousingCostMultiplierForTotal();
                int spellHousingCostMultiplierForTotal        = LogicDataTables.GetGlobals().GetSpellHousingCostMultiplierForTotal();
                int heroHousingCostMultiplierForTotal         = LogicDataTables.GetGlobals().GetHeroHousingCostMultiplierForTotal();
                int allianceUnitHousingCostMultiplierForTotal = LogicDataTables.GetGlobals().GetAllianceUnitHousingCostMultiplierForTotal();

                int idx = 0;

                do
                {
                    LogicBuildingData buildingData = (LogicBuildingData)buildingTable.GetItemAt(idx);
                    int count = this.m_buildingCaps[idx];

                    if (count > 0)
                    {
                        int multiplier  = unitHousingCostMultiplierForTotal;
                        int maxUpgLevel = buildingData.GetMaxUpgradeLevelForTownHallLevel(this.GetInstanceID());

                        if (maxUpgLevel >= 0)
                        {
                            int housingSpace = buildingData.GetUnitStorageCapacity(maxUpgLevel);

                            if (!buildingData.IsAllianceCastle())
                            {
                                if (buildingData.IsForgesMiniSpells() || buildingData.IsForgesSpells())
                                {
                                    multiplier = spellHousingCostMultiplierForTotal;
                                }
                                else if (buildingData.IsHeroBarrack())
                                {
                                    housingSpace = buildingData.GetHeroData().GetHousingSpace();
                                    multiplier   = heroHousingCostMultiplierForTotal;
                                }
                            }
                            else
                            {
                                multiplier = allianceUnitHousingCostMultiplierForTotal;
                            }

                            if (housingSpace > 0)
                            {
                                this.m_maxHousingSpace += multiplier * count * housingSpace / 100;
                            }
                        }
                    }
                } while (++idx != dataTableCount);
            }
        }
 public LogicShieldData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicShieldData.
 }
 public LogicAchievementData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicAchievementData.
 }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_villageType     = this.GetIntegerValue("UIGroup", 0);
            this.m_diamondReward   = this.GetIntegerValue("DiamondReward", 0);
            this.m_expReward       = this.GetIntegerValue("ExpReward", 0);
            this.m_actionCount     = this.GetIntegerValue("ActionCount", 0);
            this.m_actionDataLevel = this.GetIntegerValue("ActionDataLevel", 0);
            this.m_level           = this.GetIntegerValue("Level", 0);
            this.m_levelCount      = this.GetIntegerValue("LevelCount", 0);
            this.m_uiPriority      = this.GetIntegerValue("UIPriority", 0);

            this.m_completedTID = this.GetValue("CompletedTID", 0);
            this.m_showValue    = this.GetBooleanValue("ShowValue", 0);
            this.m_androidId    = this.GetValue("AndroidID", 0);

            if (this.m_actionCount == 0)
            {
                Debugger.Error("Achievement has invalid ActionCount 0");
            }

            string action = this.GetValue("Action", 0);

            switch (action)
            {
            case "npc_stars":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_NPC_STARS;
                break;

            case "upgrade":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_UPGRADE;
                this.m_buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0), this);

                if (this.m_buildingData == null)
                {
                    Debugger.Error("LogicAchievementData - Building data is NULL for upgrade achievement");
                }

                break;

            case "victory_points":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_VICTORY_POINTS;
                break;

            case "unit_unlock":
                this.m_actionType    = LogicAchievementData.ACTION_TYPE_UNIT_UNLOCK;
                this.m_characterData = LogicDataTables.GetCharacterByName(this.GetValue("ActionData", 0), this);

                if (this.m_characterData == null)
                {
                    Debugger.Error("LogicCharacterData - Character data is NULL for unit_unlock achievement");
                }

                break;

            case "clear_obstacles":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_CLEAR_OBSTACLES;
                break;

            case "donate_units":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DONATE_UNITS;
                break;

            case "loot":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_LOOT;
                this.m_resourceData = LogicDataTables.GetResourceByName(this.GetValue("ActionData", 0), this);

                if (this.m_resourceData == null)
                {
                    Debugger.Error("LogicAchievementData - Resource data is NULL for loot achievement");
                }

                break;

            case "destroy":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_DESTROY;
                this.m_buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0), this);

                if (this.m_buildingData == null)
                {
                    Debugger.Error("LogicAchievementData - Building data is NULL for destroy achievement");
                }

                break;

            case "win_pvp_attack":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WIN_PVP_ATTACK;
                break;

            case "win_pvp_defense":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WIN_PVP_DEFENSE;
                break;

            case "league":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_LEAGUE;
                break;

            case "war_stars":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WAR_STARS;
                break;

            case "war_loot":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WAR_LOOT;
                break;

            case "donate_spells":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DONATE_SPELLS;
                break;

            case "account_bound":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_ACCOUNT_BOUND;
                break;

            case "vs_battle_trophies":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_VERSUS_BATTLE_TROPHIES;
                break;

            case "gear_up":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_GEAR_UP;
                break;

            case "repair_building":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_REPAIR_BUILDING;
                this.m_buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0), this);

                if (this.m_buildingData == null)
                {
                    Debugger.Error("LogicAchievementData - Building data is NULL for repair_building achievement");
                }

                break;

            case "clan_games_points":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_CLAN_GAMES_POINTS;
                break;

            case "dragon_slayer":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DRAGON_SLAYER;
                break;

            case "league_war_stars":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_LEAGUE_WAR_STARS;
                break;

            case "scid_bound":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_SUPERCELLID_BOUND;
                break;

            case "season_challenge_points":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_SEASON_CHALLENGE_POINTS;
                break;

            case "activate_super_licence":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_ACTIVATE_SUPER_LICENCE;
                break;

            case "donate_sieges":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DONATE_SIEGES;
                break;

            default:
                Debugger.Error(string.Format("Unknown Action in achievements {0}", action));
                break;
            }

            this.m_achievementLevel = new LogicArrayList <LogicAchievementData>();

            string         achievementName = this.GetName().Substring(0, this.GetName().Length - 1);
            LogicDataTable table           = LogicDataTables.GetTable(LogicDataType.ACHIEVEMENT);

            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.m_achievementLevel.Add(achievementData);
                    }
                }
            }

            Debugger.DoAssert(this.m_achievementLevel.Size() == this.m_levelCount, string.Format(
                                  "Expected same amount of achievements named {0}X to be same as LevelCount={1} for {2}.",
                                  achievementName,
                                  this.m_levelCount,
                                  this.GetName()));
        }
 public LogicRegionData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicRegionData.
 }
Exemple #19
0
 public LogicProjectileData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicProjectileData.
 }
 public LogicMissionData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     this.m_missionType         = -1;
     this.m_missionDependencies = new LogicArrayList <LogicMissionData>();
 }
 public LogicGlobalData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicGlobalData.
 }
 public LogicHelpshiftData(CSVRow row, LogicDataTable table) : base(row, table)
 {
 }
Exemple #23
0
 public LogicTrapData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicTrapData.
 }
Exemple #24
0
 public LogicExperienceLevelData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicExperienceLevelData.
 }
 public LogicEventEntryData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicEventEntryData.
 }
Exemple #26
0
 public LogicCharacterData(CSVRow row, LogicDataTable table) : base(row, table)
 {
 }
 public LogicAlliancePortalData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicAlliancePortalData.
 }
 public LogicAllianceBadgeLayerData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicAllianceBadgeLayerData.
 }
Exemple #29
0
 public static bool CanReloadTable(LogicDataTable table)
 {
     return(true);
 }
 public LogicBoomboxData(CSVRow row, LogicDataTable table) : base(row, table)
 {
     // LogicBoomboxData.
 }