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
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()
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]
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 ]
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