Display current character location
This commit is contained in:
parent
3ebfbd5edf
commit
c0dfd0563b
1 changed files with 27 additions and 0 deletions
27
main.go
27
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) {
|
||||
|
|
Reference in a new issue