def GetParentLocationID(self, locationID): if util.IsSolarSystem(locationID): solarSystem = cfg.mapSystemCache.Get(locationID) return (const.locationUniverse, solarSystem.regionID, solarSystem.constellationID, locationID, None) if util.IsConstellation(locationID): constellation = cfg.mapConstellationCache.Get(locationID) return (const.locationUniverse, constellation.regionID, locationID, None, None) if util.IsRegion(locationID): return (const.locationUniverse, locationID, None, None, None) if util.IsCelestial(locationID): solarSystemID = cfg.mapCelestialLocationCache[locationID] solarSystem = cfg.mapSystemCache.Get(solarSystemID) return (const.locationUniverse, solarSystem.regionID, solarSystem.constellationID, solarSystemID, locationID) if util.IsStation(locationID): station = cfg.stations.Get(locationID) ssID = station.solarSystemID solarSystem = cfg.mapSystemCache.Get(ssID) return (const.locationUniverse, solarSystem.regionID, solarSystem.constellationID, ssID, locationID) ssID = cfg.evelocations.Get(locationID).solarSystemID if ssID is None: structureInfo = sm.GetService( 'structureDirectory').GetStructureInfo(locationID) if structureInfo is not None: ssID = structureInfo.solarSystemID if ssID is not None: mapData = cfg.mapSystemCache.Get(ssID) return (const.locationUniverse, mapData.regionID, mapData.constellationID, ssID, locationID) return (const.locationUniverse, None, None, None, locationID)
def Linkify(self, locationID, linkText): if util.IsRegion(locationID): locationTypeID = const.typeRegion elif util.IsConstellation(locationID): locationTypeID = const.typeConstellation elif util.IsSolarSystem(locationID): locationTypeID = const.typeSolarSystem else: if util.IsCelestial(locationID): warnText = "LOCALIZATION ERROR: 'linkify' argument used for a location of type celestial." warnText += " This is not supported. Please use the 'linkinfo' tag with arguments instead. locID:" localization.LogWarn(warnText, locationID) return linkText if util.IsStation(locationID): try: locationTypeID = cfg.stations.Get(locationID).stationTypeID except KeyError: return '[no station: %d]' % locationID else: localization.LogInfo( "LOCALIZATION LINK: The 'linkify' argument was used for a location whose type can not be identified.", locationID) return linkText return '<a href=showinfo:%d//%d>%s</a>' % (locationTypeID, locationID, linkText)
def GetItem(self, itemID, retall=False): if util.IsStation(itemID): station = cfg.stations.Get(itemID) return util.KeyVal(itemID=itemID, locationID=station.solarSystemID, itemName=cfg.evelocations.Get(itemID).name, typeID=station.stationTypeID, groupID=const.groupStation, x=station.x, y=station.y, z=station.z) if util.IsSolarSystem(itemID): solarSystem = cfg.mapSystemCache.Get(itemID) return util.KeyVal( itemID=itemID, locationID=solarSystem.constellationID, itemName=cfg.evelocations.Get(itemID).name, typeID=const.typeSolarSystem, groupID=const.groupSolarSystem, factionID=getattr(solarSystem, 'factionID', None), neighbours=[i.solarSystemID for i in solarSystem.neighbours], x=solarSystem.center.x, y=solarSystem.center.y, z=solarSystem.center.z, security=solarSystem.securityStatus) if util.IsConstellation(itemID): constellation = cfg.mapConstellationCache.Get(itemID) return util.KeyVal(itemID=itemID, locationID=constellation.regionID, itemName=cfg.evelocations.Get(itemID).name, typeID=const.typeConstellation, neighbours=list(constellation.neighbours), groupID=const.groupConstellation, x=constellation.center.x, y=constellation.center.y, z=constellation.center.z) if util.IsRegion(itemID): region = cfg.mapRegionCache.Get(itemID) return util.KeyVal(itemID=itemID, locationID=const.locationUniverse, itemName=cfg.evelocations.Get(itemID).name, neighbours=list(region.neighbours), typeID=const.typeRegion, groupID=const.groupRegion, x=region.center.x, y=region.center.y, z=region.center.z) if util.IsCelestial(itemID): solarSystemID = cfg.mapCelestialLocationCache[itemID] typeID, pos = self._GetCelestialsTypeIdAndPosition( itemID, solarSystemID) return util.KeyVal(itemID=itemID, locationID=solarSystemID, itemName=cfg.evelocations.Get(itemID).name, typeID=typeID, x=pos[0], y=pos[1], z=pos[2])
def GetParent(self, itemID): if util.IsSolarSystem(itemID): solarSystem = cfg.mapSystemCache.Get(itemID) return solarSystem.constellationID elif util.IsConstellation(itemID): constellation = cfg.mapConstellationCache.Get(itemID) return constellation.regionID elif util.IsRegion(itemID): return const.locationUniverse elif util.IsCelestial(itemID): return cfg.mapCelestialLocationCache[itemID] elif util.IsStation(itemID): station = cfg.stations.Get(itemID) return station.solarSystemID else: return None
def GetParentLocationID(self, locationID): if util.IsSolarSystem(locationID): solarSystem = cfg.mapSystemCache.Get(locationID) return (const.locationUniverse, solarSystem.regionID, solarSystem.constellationID, locationID, None) if util.IsConstellation(locationID): constellation = cfg.mapConstellationCache.Get(locationID) return (const.locationUniverse, constellation.regionID, locationID, None, None) if util.IsRegion(locationID): return (const.locationUniverse, locationID, None, None, None) if util.IsCelestial(locationID): solarSystemID = cfg.mapCelestialLocationCache[locationID] solarSystem = cfg.mapSystemCache.Get(solarSystemID) return (const.locationUniverse, solarSystem.regionID, solarSystem.constellationID, solarSystemID, locationID) if util.IsStation(locationID): station = cfg.stations.Get(locationID) ssID = station.solarSystemID solarSystem = cfg.mapSystemCache.Get(ssID) return (const.locationUniverse, solarSystem.regionID, solarSystem.constellationID, ssID, locationID) return (const.locationUniverse, None, None, None, locationID)