Esempio n. 1
0
        public async void SetWaypoints(int systemId, bool clearOtherWaypoints)
        {
            if (Current == null)
            {
                return;
            }
            var token = GetAccessToken();

            if (string.IsNullOrEmpty(token))
            {
                return;
            }

            var charId = EveAuthInstance.VerifyAsync(token).Result.CharacterId;

            var payload = new Waypoint
            {
                ClearOtherWaypoints = clearOtherWaypoints,
                First       = false,
                SolarSystem = new Type
                {
                    href = String.Format("https://crest-tq.eveonline.com/solarsystems/{0}/", systemId),
                    id   = systemId
                }
            };

            var stringPayload = JsonConvert.SerializeObject(payload);
            var postData      = new StringContent(stringPayload, Encoding.UTF8, "application/json");

            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                await httpClient.PostAsync($"https://crest-tq.eveonline.com/characters/{charId}/ui/autopilot/waypoints/", postData);

                // There is no response, if the action is successful the market details window will open.
            }
        }
Esempio n. 2
0
        public int GetLocation()
        {
            if (Current == null)
            {
                return(0);
            }
            var token = GetAccessToken();

            if (!string.IsNullOrEmpty(token))
            {
                var resp = EveAuthInstance.VerifyAsync(token).Result;
                if (resp == null)
                {
                    return(0);
                }

                var charId = resp.CharacterId;

                var c = new HttpClient();
                c.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
                var response = c.GetAsync($"https://crest-tq.eveonline.com/characters/{charId}/location/");
                var json     = response.Result.Content.ReadAsStringAsync().Result;
                var obj      = JObject.Parse(json);

                // Offline, return Jita 4/4
                if (!obj.HasValues)
                {
                    return(0);
                }

                var solarSystemId = (int)obj.SelectToken("solarSystem.id");

                return(solarSystemId);
            }


            return(0);
        }
Esempio n. 3
0
        public async void OpenMarketWindow(int typeId)
        {
            if (Current == null)
            {
                return;
            }
            var token = GetAccessToken();

            if (string.IsNullOrEmpty(token))
            {
                return;
            }

            var charId = EveAuthInstance.VerifyAsync(token).Result.CharacterId;

            var payload = new OpenWindow
            {
                type = new Type
                {
                    href = String.Format("https://crest-tq.eveonline.com/inventory/types/{0}/", typeId),
                    id   = typeId
                }
            };

            var stringPayload = JsonConvert.SerializeObject(payload);
            var postData      = new StringContent(stringPayload, Encoding.UTF8, "application/json");

            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                await httpClient.PostAsync($"https://crest-tq.eveonline.com/characters/{charId}/ui/openwindow/marketdetails/", postData);

                // There is no response, if the action is successful the market details window will open.
            }
        }