示例#1
0
    def LoadCorporation(self, corporation):
        if self.corporationByCorporationID is None:
            if type(corporation) == blue.DBRow:
                self.corporationByCorporationID = util.IndexRowset(corporation.__columns__, [list(corporation)], 'corporationID')
            else:
                self.corporationByCorporationID = util.IndexRowset(corporation.header, [corporation.line], 'corporationID')
        else:
            line = []
            for columnName in self.corporationByCorporationID.header:
                line.append(getattr(corporation, columnName))

            self.corporationByCorporationID[corporation.corporationID] = line
示例#2
0
    def PrimeStationOffices(self):
        if not session.stationid2:
            return
        if self.offices is not None:
            return
        try:
            self.Lock()
            if self.offices is not None:
                return
            corpStationMgr = self.GetCorpStationManager()
            corpStationMgr.Bind()
            self.offices = corpStationMgr.GetStationOffices()
            self.itemIDOfficeFolderIDByCorporationID = util.IndexRowset(
                ['corporationID', 'itemID', 'officeFolderID'], [],
                'corporationID')
            owners = []
            for office in self.offices:
                owners.append(office.corporationID)
                self.itemIDOfficeFolderIDByCorporationID[
                    office.corporationID] = [
                        office.corporationID, office.itemID,
                        office.officeFolderID
                    ]

            cfg.eveowners.Prime(owners)
        finally:
            self.Unlock()
示例#3
0
    def GetOffice(self, corpID=None):
        if not session.stationid2:
            return
        uthread.Lock(self, 'populatingItemIDOfficeFolderIDByCorporationID')
        try:
            if self.itemIDOfficeFolderIDByCorporationID is None:
                corpStationMgr = self.GetCorpStationManager()
                corpStationMgr.Bind()
                offices = corpStationMgr.GetCorporateStationOffice()
                self.itemIDOfficeFolderIDByCorporationID = util.IndexRowset(
                    ['corporationID', 'itemID', 'officeFolderID', 'stationID'],
                    [], 'corporationID')
                for office in offices:
                    self.itemIDOfficeFolderIDByCorporationID[
                        office.corporationID] = [
                            office.corporationID, office.itemID,
                            office.officeFolderID
                        ]

        finally:
            uthread.UnLock(self,
                           'populatingItemIDOfficeFolderIDByCorporationID')

        if corpID is None:
            corpID = eve.session.corpid
        if self.itemIDOfficeFolderIDByCorporationID.has_key(corpID):
            return self.itemIDOfficeFolderIDByCorporationID[corpID]
示例#4
0
 def AddOffice(self, corporationID, officeID, folderID):
     if self.itemIDOfficeFolderIDByCorporationID is None:
         self.itemIDOfficeFolderIDByCorporationID = util.IndexRowset(
             ['corporationID', 'itemID', 'officeFolderID'], [],
             'corporationID')
     self.itemIDOfficeFolderIDByCorporationID[corporationID] = [
         corporationID, officeID, folderID
     ]
示例#5
0
    def GetFactionWars(self, ownerID):
        factionWars = {}
        warFactionID = self.GetCorporationWarFactionID(ownerID)
        if warFactionID:
            factions = [each for each in self.GetWarFactions()]
            factionWars = util.IndexRowset([
                'warID', 'declaredByID', 'againstID', 'timeDeclared',
                'timeFinished', 'retracted', 'retractedBy', 'billID', 'mutual'
            ], [], 'warID')
            for i, faction in enumerate(factions):
                if facwarCommon.IsEnemyFaction(faction, warFactionID):
                    factionWars[i * -1] = [
                        None, faction, warFactionID, None, None, None, None,
                        None, True
                    ]

        return factionWars