Esempio n. 1
0
 def GetAgentInfo(self, data):
     charID = data.charID
     missionState = data.missionState
     missionStateLabel = {
         const.agentMissionStateAllocated:
         '<color=0xFFFFFF00>' + localization.GetByLabel(
             'UI/Journal/JournalWindow/Agents/StateOffered'),
         const.agentMissionStateOffered:
         '<color=0xFFFFFF00>' + localization.GetByLabel(
             'UI/Journal/JournalWindow/Agents/StateOffered'),
         const.agentMissionStateAccepted:
         '<color=0xff00FF00>' + localization.GetByLabel(
             'UI/Journal/JournalWindow/Agents/StateAccepted'),
         const.agentMissionStateFailed:
         '<color=0xffeb3700>' + localization.GetByLabel(
             'UI/Journal/JournalWindow/Agents/StateFailed')
     }
     if missionState is not None:
         self.missionState = missionStateLabel[missionState]
     self.agentName = cfg.eveowners.Get(charID).name
     agentInfo = sm.GetService('agents').GetAgentByID(charID)
     if agentInfo:
         agentDivision = sm.GetService('agents').GetDivisions()[
             agentInfo.divisionID].divisionName.replace('&', '&amp;')
         if charID in sm.GetService('agents').GetTutorialAgentIDs():
             self.agentType = localization.GetByLabel(
                 'UI/AgentFinder/TutorialAgentDivision',
                 divisionName=agentDivision)
         elif agentInfo.agentTypeID == const.agentTypeEpicArcAgent:
             self.agentType = localization.GetByLabel(
                 'UI/AgentFinder/EpicArcAgentDivision',
                 divisionName=agentDivision)
         elif agentInfo.agentTypeID in (
                 const.agentTypeGenericStorylineMissionAgent,
                 const.agentTypeStorylineMissionAgent):
             self.agentType = localization.GetByLabel(
                 'UI/AgentFinder/StorylineAgentDivision',
                 divisionName=agentDivision)
         elif agentInfo.agentTypeID == const.agentTypeEventMissionAgent:
             self.agentType = localization.GetByLabel(
                 'UI/AgentFinder/EventAgentDivision',
                 divisionName=agentDivision)
         elif agentInfo.agentTypeID == const.agentTypeCareerAgent:
             self.agentType = localization.GetByLabel(
                 'UI/AgentFinder/CareerAgentDivision',
                 divisionName=agentDivision)
         elif agentInfo.agentTypeID == const.agentTypeAura:
             self.agentType = ''
         else:
             self.agentType = localization.GetByLabel(
                 'UI/AgentFinder/LevelAgentDivision',
                 agentLevel=uiutil.GetLevel(agentInfo.level),
                 divisionName=agentDivision)
         if agentInfo.stationID and session.stationid != agentInfo.stationID:
             self.agentLocation = localization.GetByLabel(
                 'UI/Agents/LocatedAt', station=agentInfo.stationID)
     else:
         self.agentChatBtn.display = False
Esempio n. 2
0
    def AddAgentInfo(self, agentCont, i):
        if i + self.posInList >= self.totalAgents:
            return
        agent = self.agentsList[i + self.posInList]
        agentID = agent.agentID
        divisionID = agent.divisionID
        agentTypeID = agent.agentTypeID
        factionID = agent.factionID
        corporationID = agent.corporationID
        stationID = agent.stationID
        solarSystemID = agent.solarsystemID
        agentLevel = agent.level
        jumps = agent.jumps
        if self.showOnlyAvail.checked:
            isAvailable = True
        elif agent.level == 1 and agent.agentTypeID != const.agentTypeResearchAgent:
            if not session.warfactionid and agent.agentTypeID == const.agentTypeFactionalWarfareAgent:
                isAvailable = False
            else:
                isAvailable = True
        else:
            isAvailable = self.standingSvc.CanUseAgent(factionID,
                                                       corporationID, agentID,
                                                       agentLevel, agentTypeID)
        nameLabel = cfg.eveowners.Get(agentID).name
        corpLabel = ''
        if corporationID:
            corpLabel = cfg.eveowners.Get(corporationID).name
        locationLabel = ''
        solarSystemName = cfg.evelocations.Get(solarSystemID).name
        if stationID:
            station = sm.StartService('ui').GetStation(stationID)
            stationName = cfg.evelocations.Get(stationID).name
            stationTypeID = station.stationTypeID
            infoLinkTypeID = stationTypeID
            infoLinkSystemID = stationID
            locationLink = '<url=showinfo:%d//%d>%s</url>' % (
                stationTypeID, stationID, solarSystemName)
        else:
            infoLinkTypeID = const.typeSolarSystem
            infoLinkSystemID = solarSystemID
            locationLink = '<url=showinfo:%d//%d>%s</url>' % (
                const.typeSolarSystem, solarSystemID, solarSystemName)
        sec = sm.GetService('map').GetSecurityStatus(solarSystemID)
        secStatus, color = util.FmtSystemSecStatus(sec, True)
        color = int(util.Color.RGBtoHex(color.r, color.g, color.b), 16)
        startSystemInfoTag = '<url=showinfo:%d//%d>' % (infoLinkTypeID,
                                                        infoLinkSystemID)
        endUrlTag = '</url>'
        startColorTag = '<color=%s>' % color
        endColorTag = '</color>'
        if jumps != 999:
            locationLabel = localization.GetByLabel(
                'UI/AgentFinder/LocationText',
                startSystemInfoTag=startSystemInfoTag,
                system=solarSystemID,
                endSystemInfoTag=endUrlTag,
                startColorTag=startColorTag,
                secStatus=sec,
                endColorTag=endColorTag,
                jumps=jumps)
        else:
            locationLabel = localization.GetByLabel(
                'UI/AgentFinder/LocationTextUnreachable',
                startSystemInfoTag=startSystemInfoTag,
                system=solarSystemID,
                endSystemInfoTag=endUrlTag,
                startColorTag=startColorTag,
                secStatus=sec,
                endColorTag=endColorTag)
        levelAndTypeLabel = ''
        agentDivision = sm.GetService(
            'agents').GetDivisions()[divisionID].divisionName.replace(
                '&', '&amp;')
        if agentID in sm.GetService('agents').GetTutorialAgentIDs():
            levelAndTypeLabel = localization.GetByLabel(
                'UI/AgentFinder/TutorialAgentDivision',
                divisionName=agentDivision)
        elif agentTypeID == const.agentTypeEpicArcAgent:
            levelAndTypeLabel = localization.GetByLabel(
                'UI/AgentFinder/EpicArcAgentDivision',
                divisionName=agentDivision)
        elif agentTypeID == const.agentTypeCareerAgent:
            levelAndTypeLabel = localization.GetByLabel(
                'UI/AgentFinder/CareerAgentDivision',
                divisionName=agentDivision)
        elif agentTypeID in (const.agentTypeGenericStorylineMissionAgent,
                             const.agentTypeStorylineMissionAgent):
            levelAndTypeLabel = localization.GetByLabel(
                'UI/AgentFinder/StorylineAgentDivision',
                divisionName=agentDivision)
        else:
            levelAndTypeLabel = localization.GetByLabel(
                'UI/AgentFinder/LevelAgentDivision',
                agentLevel=uiutil.GetLevel(agentLevel),
                divisionName=agentDivision)
        leftCont = uicls.Container(name='leftCont',
                                   parent=agentCont,
                                   align=uiconst.TOLEFT,
                                   width=64)
        infoCont = uicls.Container(name='infoCont',
                                   parent=agentCont,
                                   align=uiconst.TOALL,
                                   clipChildren=True,
                                   padLeft=const.defaultPadding)
        icon = uicls.Icon(parent=leftCont,
                          align=uiconst.TOPLEFT,
                          size=64,
                          ignoreSize=True)
        typeID = cfg.eveowners.Get(agentID).typeID
        icon.typeID = typeID
        icon.itemID = agentID
        icon.OnClick = (self.ShowInfo, icon)
        icon.GetMenu = (self.GetAgentMenu, icon)
        icon.LoadIconByTypeID(typeID, itemID=agentID, ignoreSize=True)
        if session.stationid:
            hint = localization.GetByLabel('UI/Chat/StartConversation')
        else:
            hint = localization.GetByLabel('UI/Common/ShowInfo')
        icon.hint = hint
        top = 0
        startAgentInfoTag = '<url=showinfo:%d//%d>' % (
            cfg.eveowners.Get(agentID).typeID, agentID)
        startInfoColorTag = '<color=-2039584>'
        nameText = localization.GetByLabel(
            'UI/AgentFinder/AgentNameWithInfoLink',
            startAgentInfoTag=startAgentInfoTag,
            startColorTag=startInfoColorTag,
            agentName=nameLabel,
            endColorTag=endColorTag,
            endAgentInfoTag=endUrlTag)
        name = uicls.EveLabelMedium(text=nameText,
                                    parent=infoCont,
                                    top=top,
                                    state=uiconst.UI_NORMAL)
        name.GetMenu = (self.GetAgentMenu, icon)
        name.hint = localization.GetByLabel('UI/Common/ShowInfo')
        top += 16
        startCorpInfoTag = '<url=showinfo:%d//%d>' % (const.typeCorporation,
                                                      corporationID)
        corpText = localization.GetByLabel(
            'UI/AgentFinder/CorpNameWithInfoLink',
            startCorporationInfoTag=startCorpInfoTag,
            startColorTag=startInfoColorTag,
            corpName=corpLabel,
            endColorTag=endColorTag,
            endCorporationInfoTag=endUrlTag)
        corp = uicls.EveLabelMedium(text=corpText,
                                    parent=infoCont,
                                    top=top,
                                    state=uiconst.UI_NORMAL,
                                    bold=True)
        corp.typeID = const.typeCorporation
        corp.itemID = corporationID
        corp.OnClick = (self.ShowInfo, corp, True)
        corp.hint = localization.GetByLabel('UI/Common/ShowInfo')
        top += 16
        levelAndType = uicls.EveLabelMedium(text=levelAndTypeLabel,
                                            parent=infoCont,
                                            top=top)
        top += 16
        location = uicls.EveLabelMedium(text=locationLabel,
                                        parent=infoCont,
                                        top=top,
                                        state=uiconst.UI_NORMAL)
        if not isAvailable:
            for item in infoCont.children:
                item.SetAlpha(0.4)

            icon.SetAlpha(0.4)