public async Task <GateSpinData> SpinGateAsync(GalaxyGate gate, int spinamount) { var spinUrl = string.Format(Urls.SpinGate, Urls.BaseUrl, AccountData.UserId, AccountData.SessionId, (int)gate, gate.GetFullName().ToLower(), spinamount); if (GateData.Samples > 0) { spinUrl = string.Format(Urls.SpinGateSample, Urls.BaseUrl, AccountData.UserId, AccountData.SessionId, (int)gate, gate.GetFullName().ToLower(), spinamount); } var resultString = await _httpClient.GetAsyncNoLimit(spinUrl); var serializer = new XmlSerializer(typeof(GateSpinData)); GateSpinData result; using (var reader = new StringReader(resultString)) { result = (GateSpinData)serializer.Deserialize(reader) as GateSpinData; } EvaluateGateSpin(result, spinamount); return(result); }
public async Task <GateSpinData> SpinGateAsync(GalaxyGate gate, bool useMultiplier) { var spinUrl = string.Empty; if (useMultiplier && IsMultiplierAvailable(gate)) { spinUrl = string.Format(Urls.SpinGateMultiplier, Urls.BaseUrl, AccountData.UserId, AccountData.SessionId, (int)gate, gate.GetFullName().ToLower()); if (GateData.Samples > 0) { spinUrl = string.Format(Urls.SpinGateSampleMultiplier, Urls.BaseUrl, AccountData.UserId, AccountData.SessionId, (int)gate, gate.GetFullName().ToLower()); } } else { spinUrl = string.Format(Urls.SpinGate, Urls.BaseUrl, AccountData.UserId, AccountData.SessionId, (int)gate, gate.GetFullName().ToLower()); if (GateData.Samples > 0) { spinUrl = string.Format(Urls.SpinGateSample, Urls.BaseUrl, AccountData.UserId, AccountData.SessionId, (int)gate, gate.GetFullName().ToLower()); } } var resultString = string.Empty; try { resultString = await _httpClient.GetAsyncNoLimit(spinUrl); var serializer = new XmlSerializer(typeof(GateSpinData)); GateSpinData result; using (var reader = new StringReader(resultString)) { result = (GateSpinData)serializer.Deserialize(reader) as GateSpinData; } EvaluateGateSpin(result); return(result); } catch (Exception e) { return(default(GateSpinData)); } }
private bool IsMultiplierAvailable(GalaxyGate gate) { var gateName = gate.GetFullName().ToLower(); var data = GateData.MultiplierInfo.MultiplierInfo.FirstOrDefault(x => x.Mode.ToLower() == gateName); if (data == null) { return(false); } return(data.Value >= 0); }