Example #1
0
        private static void LaunchAttack(bool legionOnlyZone, AccountData account)
        {
            string zoneId = GetZoneId();
            string latitude = GetLatLong()[0];
            string longitude = GetLatLong()[1];
            string attackId = GetAttackId(account);
            string defenseId = GetDefenseId(account);
            string formationId = attackId;
            if (legionOnlyZone && account.Level >= 2)
            {
                formationId = defenseId;
            }

            LaunchApiCall launchData = APICall.Launch(latitude, longitude, zoneId, formationId);
            if (null != launchData.HUD)
            {
                account.BotsAfterLaunch = launchData.HUD.BotCountAfterLastDeployment;
                account.BotsPerSecond = launchData.HUD.BotsPerSecond;
                account.BotsLaunched = launchData.Summary.Breakdown.BotsLaunched;
                account.LastBotDeploymentTimeUTC = launchData.HUD.LastBotDeployTimeUTC;
                AttackLoopEnabled = true;
                account.Level = launchData.HUD.Level;
            }
            else
            {
                AttackLoopEnabled = false;
            }

            if (launchData.Zone.ControlState == 1 && launchData.Zone.FacelessCount == 0 && launchData.Zone.SwarmCount == 0)
            {
                LegionOnlyZone = true;
            }
            else
            {
                LegionOnlyZone = false;
            }

            if (account.CanAttackNow())
            {
                LaunchAttack(LegionOnlyZone, account);
            }
        }