Exemplo n.º 1
0
 def UpdateSOVLocationInfo(self):
     sovLabel = None
     infoSettings = sm.GetService('infoPanel').GetLocationInfoSettings()
     if 'sovereignty' in infoSettings and session.solarsystemid2:
         solSovOwner = None
         contestedState = ''
         if self.facwarSvc.IsFacWarSystem(session.solarsystemid2):
             solSovOwner = self.facwarSvc.GetSystemOccupier(session.solarsystemid2)
             contestedState = sm.GetService('infoPanel').GetSolarSystemStatusText()
         else:
             ss = sm.RemoteSvc('stationSvc').GetSolarSystem(session.solarsystemid2)
             if ss:
                 solSovOwner = ss.factionID
                 if solSovOwner is None:
                     sovInfo = self.sovSvc.GetSystemSovereigntyInfo(session.solarsystemid2)
                     if sovInfo:
                         solSovOwner = sovInfo.allianceID
                 if solSovOwner is not None:
                     contestedState = self.sovSvc.GetContestedState(session.solarsystemid2) or ''
         if solSovOwner is not None:
             sovText = cfg.eveowners.Get(solSovOwner).name
         elif util.IsWormholeRegion(session.regionid):
             sovText = localization.GetByLabel('UI/Neocom/Unclaimable')
         else:
             sovText = localization.GetByLabel('UI/Neocom/Unclaimed')
         sovLabel = "<color=white url=localsvc:service=sov&method=GetSovOverview alt='%s'>%s</url> %s" % (localization.GetByLabel('UI/Neocom/Sovereignty'), sovText, contestedState)
     if sovLabel is not None:
         self.sovLocationInfo.text = sovLabel
         self.sovLocationInfo.state = uiconst.UI_NORMAL
     else:
         self.sovLocationInfo.state = uiconst.UI_HIDDEN
Exemplo n.º 2
0
 def IterateKnownspaceRegions(self):
     """
     Returns a generator for all knownspace regionID and regions
     """
     for regionID, region in cfg.mapRegionCache.iteritems():
         if not util.IsWormholeRegion(regionID):
             yield (regionID, region)
Exemplo n.º 3
0
 def GetKnownspaceRegions(self):
     """
     get a generator for all knownspace regions
     """
     for regionID in cfg.mapRegionCache.iterkeys():
         if not util.IsWormholeRegion(regionID):
             yield regionID
Exemplo n.º 4
0
 def UpdateActiveKillInfo(self):
     if util.IsWormholeRegion(self.regionID):
         self.killsText.text = localization.GetByLabel('UI/Generic/Unknown')
         self.activeText.text = localization.GetByLabel(
             'UI/Generic/Unknown')
     else:
         kills, pods = sm.GetService('sov').GetKillLast24H(
             self.GetLocationFromScope())
         self.killsText.text = '%d / %d' % (kills, pods)
         cynoResult = sm.GetService('sov').GetActiveCynos(
             self.GetLocationFromScope())
         self.activeText.text = '%d / %d' % (cynoResult.cynoStructures,
                                             cynoResult.cynoModules)
Exemplo n.º 5
0
 def GetNeighbors(self, itemID):
     if util.IsWormholeSystem(itemID) or util.IsWormholeConstellation(itemID) or util.IsWormholeRegion(itemID):
         return []
     if util.IsSolarSystem(itemID):
         solarSystem = cfg.mapSystemCache.Get(itemID)
         return [ i.solarSystemID for i in solarSystem.neighbours ]
     if util.IsConstellation(itemID):
         constellation = cfg.mapConstellationCache.Get(itemID)
         return constellation.neighbours
     if util.IsRegion(itemID):
         region = cfg.mapRegionCache.Get(itemID)
         return region.neighbours
     return []
Exemplo n.º 6
0
 def GetNeighbors(self, itemID):
     if util.IsWormholeSystem(itemID) or util.IsWormholeConstellation(
             itemID) or util.IsWormholeRegion(itemID):
         return []
     cache = self.GetMapCache()
     if itemID in cache['neighbors']:
         return cache['neighbors'][itemID]
     item = self.GetItem(itemID, 1)
     ssitem = item.item
     if ssitem.groupID == const.typeSolarSystem:
         return [locID for jumpgroup in item.jumps for locID in jumpgroup]
     else:
         return []
Exemplo n.º 7
0
    def GetSolarSystemTrace(self, itemID, altText=None, traceFontSize=12):
        if util.IsStation(itemID):
            solarSystemID = cfg.stations.Get(itemID).solarSystemID
        elif util.IsSolarSystem(itemID):
            solarSystemID = itemID
        else:
            structure = sm.GetService('structureDirectory').GetStructureInfo(
                itemID)
            if structure is None:
                raise RuntimeError('Invalid destination')
            solarSystemID = structure.solarSystemID
        try:
            sec, col = util.FmtSystemSecStatus(
                sm.GetService('map').GetSecurityStatus(solarSystemID), 1)
            col.a = 1.0
            securityLabel = "</b> <color=%s><hint='%s'>%s</hint></color>" % (
                util.StrFromColor(col),
                localization.GetByLabel('UI/Map/StarMap/SecurityStatus'), sec)
        except KeyError:
            self.LogError('Neocom failed to get security status for item',
                          solarSystemID, 'displaying BROKEN')
            log.LogException()
            sys.exc_clear()
            securityLabel = ''

        si = cfg.mapSystemCache.Get(solarSystemID)
        constellationID = si.constellationID
        regionID = si.regionID
        if altText:
            solarSystemAlt = " alt='%s'" % uiutil.StripTags(
                altText, stripOnly=['localized'])
        else:
            solarSystemAlt = ''
        locationTrace = '<url=showinfo:%s//%s%s>%s</url>%s' % (
            const.typeSolarSystem, solarSystemID, solarSystemAlt,
            cfg.evelocations.Get(solarSystemID).locationName, securityLabel)
        if traceFontSize:
            locationTrace += '<fontsize=12>'
        if not util.IsWormholeRegion(regionID):
            seperator = '<fontsize=%(fontsize)s> </fontsize>&lt;<fontsize=%(fontsize)s> </fontsize>' % {
                'fontsize': 8
            }
            locationTrace += seperator
            locationTrace += '<url=showinfo:%s//%s>%s</url>' % (
                const.typeConstellation, constellationID,
                cfg.evelocations.Get(constellationID).locationName)
            locationTrace += seperator
            locationTrace += '<url=showinfo:%s//%s>%s</url>' % (
                const.typeRegion, regionID,
                cfg.evelocations.Get(regionID).locationName)
        return locationTrace
Exemplo n.º 8
0
 def UpdateSOVLocationInfo(self):
     self.FlushSovInfoContainer()
     infoSettings = sm.GetService('infoPanel').GetLocationInfoSettings()
     if 'sovereignty' in infoSettings and session.solarsystemid2:
         self.sovInfoContainer.display = True
         if util.IsWormholeRegion(session.regionid):
             self.DrawWormholeInfo()
             return
         isFacWar = self.facwarSvc.IsFacWarSystem(session.solarsystemid2)
         factionID = self._GetSolarsystemFactionID(session.solarsystemid2,
                                                   isFacWar)
         if factionID:
             self.DrawUnclaimableSystemInfo(factionID, isFacWar=isFacWar)
         else:
             solarsystemStructureInfo = self.sovSvc.GetSovStructuresInfoForSolarSystem(
                 session.solarsystemid2)
             self.DrawClaimableSystemInfo(solarsystemStructureInfo)
     else:
         self.sovInfoContainer.display = False
Exemplo n.º 9
0
 def IterateKnownspaceRegions(self):
     for regionID, region in cfg.mapRegionCache.iteritems():
         if not util.IsWormholeRegion(regionID):
             yield (regionID, region)
Exemplo n.º 10
0
 def GetKnownspaceRegions(self):
     for regionID in cfg.mapRegionCache.iterkeys():
         if not util.IsWormholeRegion(regionID):
             yield regionID
Exemplo n.º 11
0
 def CreateHeaderText(self):
     text = ''
     if self.locationScope == SovereigntyTab.World:
         text = localization.GetByLabel('UI/Sovereignty/WorldSovStatus')
         return text
     elif self.locationScope == SovereigntyTab.Changes:
         text = localization.GetByLabel('UI/Sovereignty/RecentSovChanges')
         return text
     else:
         mapSvc = sm.GetService('map')
         systemItem = mapSvc.GetItem(self.solarSystemID)
         constItem = mapSvc.GetItem(self.constellationID)
         regItem = mapSvc.GetItem(self.regionID)
         showInfoTag = '<url=showinfo:%d//%d>'
         endUrlTag = '</url>'
         text = ''
         if self.locationScope == SovereigntyTab.SolarSystem:
             if util.IsWormholeRegion(self.regionID):
                 text = '%s / %s / <url=showinfo:%s//%s>%s</url>' % (
                     regItem.itemName, constItem.itemName,
                     systemItem.typeID, self.solarSystemID,
                     systemItem.itemName)
             else:
                 text = localization.GetByLabel(
                     'UI/Sovereignty/SystemLocation',
                     regionName=regItem.itemName,
                     constName=constItem.itemName,
                     systemName=systemItem.itemName,
                     startRegionUrlTag=showInfoTag %
                     (regItem.typeID, self.regionID),
                     startConstUrlTag=showInfoTag %
                     (constItem.typeID, self.constellationID),
                     startSystemUrlTag=showInfoTag %
                     (systemItem.typeID, self.solarSystemID),
                     endUrlTag=endUrlTag)
         elif self.locationScope == SovereigntyTab.Constellation:
             if util.IsWormholeRegion(self.regionID):
                 text = localization.GetByLabel(
                     'UI/Sovereignty/ConstLocationWH',
                     regionName=regItem.itemName,
                     constName=constItem.itemName)
             else:
                 text = localization.GetByLabel(
                     'UI/Sovereignty/ConstLocation',
                     startRegionUrlTag=showInfoTag %
                     (regItem.typeID, self.regionID),
                     startConstUrlTag=showInfoTag %
                     (constItem.typeID, self.constellationID),
                     regionName=regItem.itemName,
                     constName=constItem.itemName,
                     endUrlTag=endUrlTag)
         elif self.locationScope == SovereigntyTab.Region:
             if util.IsWormholeRegion(self.regionID):
                 text = localization.GetByLabel(
                     'UI/Sovereignty/RegionLocationWH',
                     regionName=regItem.itemName)
             else:
                 text = localization.GetByLabel(
                     'UI/Sovereignty/RegionLocation',
                     startRegionUrlTag=showInfoTag %
                     (regItem.typeID, self.regionID),
                     regionName=regItem.itemName,
                     endUrlTag='</url>')
         return text