// Deprecated method that Nick was using, that hard-codes the DeviceID. Bad! //public bool Login(string username, string password) //{ // string deviceId = "masdkAhsmGPs" + username + "="; // _loginApiCall = _apiCall.Login(username, password, deviceId); // bool successful = _loginApiCall != null; // if (successful) // LoadStats(); // return successful; //} // Deprecated function Nick was using //public bool GetForts() //{ // FortsApiCall fortsApiCall = _apiCall.Forts(Lattitude, Longitude); // LoadForts(fortsApiCall); // return fortsApiCall != null; // this is null if the call failed //} //Deprecated function Nick was using //public bool PerformHarvest() //{ // HarvestAll harvestAll = _apiCall.HarvestAll(Lattitude, Longitude); // LoadHarvest(harvestAll); // return harvestAll != null; // this is null if the call failed //} private void LoadForts(FortsApiCall fortsApiCall) { if (fortsApiCall != null && fortsApiCall.PlayerForts != null && fortsApiCall.PlayerForts.Forts != null) { _fortsList = new List<Zoneski>(); foreach (Forts fort in fortsApiCall.PlayerForts.Forts) { Zoneski zoneski = new Zoneski(); zoneski.ControlState = ZoneControlStateConverter(fort.ZoneControlState); zoneski.ZoneName = fort.ZoneName; zoneski.ZoneId = fort.ZoneId.ToString(); zoneski.Latitude = fort.Latitude.ToString(); zoneski.Longitude = fort.Longitude.ToString(); zoneski.CurrentGasInTank = fort.CurrentGasInTank; _fortsList.Add(zoneski); } } }
private void LoadZones(ZonesPinsApiCall zonesPins) { if (zonesPins != null && zonesPins.Zones != null) { _zonesList = new List<Zoneski>(); foreach (Zone zone in zonesPins.Zones) { Zoneski zoneski = new Zoneski(); zoneski.ControlState = ZoneControlStateConverter(zone.ControlState); zoneski.ZoneName = zone.ZoneName; zoneski.ZoneId = zone.ZoneId.ToString(); zoneski.Latitude = zone.Latitude.ToString(); zoneski.Longitude = zone.Longitude.ToString(); _zonesList.Add(zoneski); } } }
public bool LaunchBots(Zoneski zone, int myLevel) { string attackFormation = "0"; if (myLevel >= 42) { attackFormation = "1024"; // Shockwave 4 } else if (myLevel >= 29) { attackFormation = "1023"; // Shockwave 3 } else if (myLevel >= 13) { attackFormation = "1022"; // Shockwave 2 } else if (myLevel >= 3) { attackFormation = "1021"; // Shockwave 1 } else { attackFormation = "1011"; // Zone Assault 1 } LaunchApiCall launchData = _apiCall.Launch(zone.Latitude, zone.Longitude, zone.ZoneId, attackFormation); if (launchData != null) // gather launch data only if the call was successful { _launch.BotsAfterLaunch = launchData.HUD.BotCountAfterLastDeployment; _launch.BotsPerSecond = launchData.HUD.BotsPerSecond; _launch.BotsLaunched = launchData.Summary.Breakdown.BotsLaunched; _launch.EnergyAfterLaunch = launchData.HUD.EnergyCountAfterLastDeployment; _launch.EnergyPerSecond = launchData.HUD.EnergyPerSecond; _launch.PlayerCapturedZone = launchData.Summary.Rewards.PlayerCapturedZone; } return launchData != null; // this is null if the call failed }