diff --git a/main.go b/main.go index 2fc24ba..753ae22 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,7 @@ import ( ESI "./client" + ESILocation "./client/location" ESIPlanetaryInteraction "./client/planetary_interaction" ESISkills "./client/skills" ESIUniverse "./client/universe" @@ -58,6 +59,7 @@ var ( "esi-skills.read_skills.v1", "esi-planets.manage_planets.v1", "esi-wallet.read_character_wallet.v1", + "esi-location.read_location.v1", }, Endpoint: oauth2.Endpoint{ AuthURL: "https://login.eveonline.com/oauth/authorize/", @@ -235,6 +237,31 @@ func printCharacterInformation(swaggerclient *ESI.App, m *Character) { fmt.Printf("Wallet: %s\n", ac.FormatMoney(wallet.Balance/100)) } } + + posCallParam := ESILocation.NewGetCharactersCharacterIDLocationParams() + posCallParam.WithCharacterID(m.CharacterID) + + posresponse, poserr := swaggerclient.Location.GetCharactersCharacterIDLocation(posCallParam, nil) + if poserr != nil { + fmt.Println("Error while getting the current character location.") + log.Fatalf("Got error on GetCharactersCharacterIDLocation: %s", poserr) + } + + position := posresponse.Payload + + itemIds := make([]int32, 0) + itemIds = append(itemIds, *position.SolarSystemID) + if position.StationID != nil { + itemIds = append(itemIds, *position.StationID) + } + + universeNames := getUniverseNames(swaggerclient, &itemIds) + + fmt.Printf("Currently in %s - %s\n", + universeNames[*position.SolarSystemID], + universeNames[*position.StationID], + ) + } func printCharacterPlanets(swaggerclient *ESI.App, m *Character) {