diff --git a/main.go b/main.go index 9bb9847..a3a5212 100644 --- a/main.go +++ b/main.go @@ -65,6 +65,7 @@ var ( "esi-wallet.read_character_wallet.v1", "esi-location.read_location.v1", "esi-clones.read_clones.v1", + "esi-universe.read_structures.v1", }, Endpoint: oauth2.Endpoint{ AuthURL: "https://login.eveonline.com/oauth/authorize/", @@ -369,6 +370,13 @@ func printCharacterInformation(outChan chan string, swaggerclient *ESI.App, m *C stationName = universeNames[*position.StationID] } + if position.StructureID != nil { + retName, retErr := getStructureStationInfo(swaggerclient, "structure", *position.StructureID) + if retErr == nil { + stationName = retName.Name + } + } + outChan <- fmt.Sprintf("Currently in %s - %s\n", universeNames[*position.SolarSystemID], stationName, @@ -437,7 +445,7 @@ func getStructureStationInfo(swaggerclient *ESI.App, typeID string, ID int64) (* staresponse, staerr := swaggerclient.Universe.GetUniverseStationsStationID(stacallParams) if staerr != nil { - log.Printf("Got error on GetCharactersCharacterIDClones: %s", staerr) + log.Printf("Got error on GetUniverseStationsStationID: %s", staerr) return nil, staerr } @@ -456,6 +464,31 @@ func getStructureStationInfo(swaggerclient *ESI.App, typeID string, ID int64) (* return &sInfo, nil } + if typeID == "structure" { + strcallParams := ESIUniverse.NewGetUniverseStructuresStructureIDParams() + strcallParams.WithStructureID(ID) + + strresponse, strerr := swaggerclient.Universe.GetUniverseStructuresStructureID(strcallParams, nil) + if strerr != nil { + log.Printf("Got error on GetUniverseStructuresStructureID: %s", strerr) + return nil, strerr + } + + strInfo := strresponse.Payload + + var sInfo structureInfo + + sInfo.ID = ID + sInfo.Name = *strInfo.Name + sInfo.SystemID = *strInfo.SolarSystemID + sInfo.System = getSolarSystemInformation(swaggerclient, sInfo.SystemID) + + putCacheDataSub64(sInfo.ID, "name", sInfo.Name) + putCacheDataIntSub64(sInfo.ID, "system", sInfo.SystemID) + + return &sInfo, nil + } + return nil, nil } @@ -754,7 +787,6 @@ func getSchematicsInformation(swaggerclient *ESI.App, schematicID int32) (*Schem schematicInfo.SchematicName = schematicName return &schematicInfo, nil - } func getNewAuthorizationToken() *oauth2.Token {