fleetfinder.py (24099B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\fleet\fleetfinder.py 2 from carbonui.control.checkbox import Checkbox 3 from carbonui.control.combo import Combo 4 from carbonui.control.scrollContainer import ScrollContainer 5 from eve.client.script.ui.control.entries.util import GetFromClass 6 from carbonui.control.tabGroup import TabGroup 7 from eve.client.script.ui.shared.fleet.fleetFinderEntry import FleetFinderEntry 8 from eve.common.lib.appConst import contactGoodStanding, contactHighStanding 9 from carbon.common.script.util.commonutils import GetAttrs 10 from eve.client.script.ui.control.themeColored import FrameThemeColored 11 import eve.client.script.ui.shared.pointerTool.pointerToolConst as pConst 12 from eveexceptions import ExceptionEater 13 from inventorycommon.const import groupSolarSystem, typeCorporation, typeAlliance, typeFaction 14 import uthread 15 import blue 16 import carbonui.const as uiconst 17 import evefleet.client 18 import evefleet 19 from carbonui.primitives.container import Container 20 from carbonui.button.group import ButtonGroup 21 from carbonui.control.button import Button 22 from eve.client.script.ui.control.eveEditPlainText import EditPlainText 23 from eve.client.script.ui.control.eveLabel import EveLabelMediumBold, EveLabelMedium, EveCaptionMedium 24 from eve.client.script.ui.control.eveScroll import Scroll 25 from localization import GetByLabel 26 PANEL_FLEETFINDER = 'findfleets' 27 PANEL_ADVERT = 'myadvert' 28 GETFLEETS_THROTTLETIME = 2000 29 SIZE_FULLUI = (420, 250) 30 31 def GetFleetDetailsEntry(fleet): 32 textList = [] 33 bossText = GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/Boss', boss=fleet.leader.charID, bossInfoData=('showinfo', 1376, fleet.leader.charID)) 34 textList.append(bossText) 35 if fleet.solarSystemID: 36 locationText = GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/Location', bossLocation=fleet.solarSystemID, locationData=('showinfo', groupSolarSystem, fleet.solarSystemID)) 37 textList.append(locationText) 38 ageText = GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/Age', fleetAge=blue.os.GetWallclockTime() - fleet.dateCreated) 39 textList.append(ageText) 40 if fleet.numMembers: 41 numMembersText = GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/MemberCount', memberCount=fleet.numMembers) 42 textList.append(numMembersText) 43 scopeLines = [] 44 if evefleet.IsOpenToCorp(fleet): 45 scopeLines.append(GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/CorporationAccessScope', corpName=cfg.eveowners.Get(fleet.leader.corpID).name, corpInfo=('showinfo', typeCorporation, fleet.leader.corpID))) 46 if evefleet.IsOpenToAlliance(fleet) and fleet.leader.allianceID: 47 scopeLines.append(GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/AllianceAccessScope', allianceName=cfg.eveowners.Get(fleet.leader.allianceID).name, allianceInfo=('showinfo', typeAlliance, fleet.leader.allianceID))) 48 if evefleet.IsOpenToMilitia(fleet) and fleet.leader.warFactionID: 49 scopeLines.append(GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/MilitiaAccessScope', militiaName=cfg.eveowners.Get(fleet.leader.warFactionID).name, militiaInfo=('showinfo', typeFaction, fleet.leader.warFactionID))) 50 if fleet.membergroups_minStanding is not None or fleet.membergroups_minSecurity is not None: 51 if fleet.membergroups_minStanding is not None: 52 if fleet.membergroups_minStanding == contactGoodStanding: 53 standing = GetByLabel('UI/Standings/Good') 54 elif fleet.membergroups_minStanding == contactHighStanding: 55 standing = GetByLabel('UI/Standings/Excellent') 56 else: 57 standing = fleet.public_minStanding 58 if fleet.membergroups_minSecurity is not None: 59 scopeLines.append(GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/MinimumStandingAndSecurity', standing=standing, security=fleet.membergroups_minSecurity)) 60 else: 61 scopeLines.append(GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/MinimumStanding', standing=standing)) 62 elif fleet.membergroups_minSecurity is not None: 63 scopeLines.append(GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/MinimumSecurity', security=fleet.membergroups_minSecurity)) 64 if evefleet.IsOpenToPublic(fleet) or evefleet.IsOpenToAllPublic(fleet): 65 if evefleet.IsOpenToPublic(fleet): 66 scopeLines.append(GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/PublicAccessScope')) 67 else: 68 scopeLines.append(GetByLabel('UI/Agency/Fleetup/Public Access')) 69 if fleet.public_minStanding is not None: 70 if fleet.public_minStanding == contactGoodStanding: 71 standing = GetByLabel('UI/Standings/Good') 72 elif fleet.public_minStanding == contactHighStanding: 73 standing = GetByLabel('UI/Standings/Excellent') 74 else: 75 standing = fleet.public_minStanding 76 if fleet.public_minSecurity is not None: 77 scopeLines.append(GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/MinimumStandingAndSecurity', standing=standing, security=fleet.public_minSecurity)) 78 else: 79 scopeLines.append(GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/MinimumStanding', standing=standing)) 80 elif fleet.public_minSecurity is not None: 81 scopeLines.append(GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/MinimumSecurity', security=fleet.public_minSecurity)) 82 if not scopeLines: 83 scopeLines.append('-') 84 scopeLinesText = GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/Scope', scope='<br><t>'.join(scopeLines)) 85 textList.append(scopeLinesText) 86 if fleet.joinNeedsApproval: 87 approvalText = GetByLabel('UI/Fleet/FleetRegistry/AdvertDetails/NeedsApproval') 88 textList.append(approvalText) 89 text = '<br>'.join(textList) 90 return text 91 92 93 class AdvertDraggableIcon(Container): 94 isDragObject = True 95 96 def Startup(self, fleet): 97 self.fleet = fleet 98 99 def GetDragData(self, *args): 100 data = evefleet.client.FleetDragData(fleet_id=self.fleet.fleetID, name=self.fleet.fleetName) 101 return [data] 102 103 104 class PanelFleetFinderAndAdvert(Container): 105 106 def ApplyAttributes(self, attributes): 107 super(PanelFleetFinderAndAdvert, self).ApplyAttributes(attributes) 108 self.tabs = TabGroup(name='fleetfindertabs', parent=self, idx=0) 109 self.tabs.AddTab(GetByLabel('UI/Fleet/FleetRegistry/FindFleets'), PanelFleetFinder(parent=self), self, 'findfleets') 110 self.tabs.AddTab(GetByLabel('UI/Fleet/FleetRegistry/MyAdvert'), PanelAdvert(parent=self), self, 'myadvert') 111 uthread.new(self.tabs.ShowPanelByName, GetByLabel('UI/Fleet/FleetRegistry/FindFleets')) 112 113 114 class PanelAdvert(Container): 115 __notifyevents__ = ['OnFleetFinderAdvertChanged'] 116 117 def ApplyAttributes(self, attributes): 118 super(PanelAdvert, self).ApplyAttributes(attributes) 119 sm.RegisterNotify(self) 120 self.isLoaded = False 121 self.myAdvertButtons = Container(name='myAdvertButtons', parent=self, align=uiconst.TOBOTTOM, height=35) 122 self.myAdvertCont = ScrollContainer(name='myAdvertCont', parent=self, align=uiconst.TOALL, alignMode=uiconst.TOTOP) 123 tabs = [130, 540] 124 self.myAdvertButtonWnd = ButtonGroup(parent=self.myAdvertButtons) 125 self.myAdvertButtonWnd.AddButton(GetByLabel('UI/Fleet/FleetWindow/EditAdvert'), sm.GetService('fleet').OpenRegisterFleetWindow, ()) 126 self.myAdvertButtonWnd.AddButton(GetByLabel('UI/Fleet/FleetWindow/RemoveAdvert'), sm.GetService('fleet').UnregisterFleet, ()) 127 self.myAdvertCaption = EveCaptionMedium(text='', parent=self.myAdvertCont, align=uiconst.TOTOP, state=uiconst.UI_DISABLED) 128 self.myAdvertText = EveLabelMedium(name='myAdvertText', parent=self.myAdvertCont, top=uiconst.defaultPadding, tabs=tabs, align=uiconst.TOTOP, state=uiconst.UI_NORMAL) 129 self.myAdvertDesc = EveLabelMedium(name='myAdvertDesc', parent=self.myAdvertCont, padTop=8, state=uiconst.UI_NORMAL, align=uiconst.TOTOP) 130 self.myAdvertButtonWnd_RegisterBtnGroup = ButtonGroup(parent=self.myAdvertButtons) 131 self.myAdvertButtonWnd_RegisterBtnGroup.AddButton(GetByLabel('UI/Fleet/FleetWindow/CreateAdvert'), sm.GetService('fleet').OpenRegisterFleetWindow, ()) 132 self.myAdvertButtonWnd_RegisterBtnGroup.display = False 133 self.dragIcon = None 134 135 def LoadPanel(self): 136 self.myAdvertText.text = '' 137 self.myAdvertButtonWnd.display = False 138 self.myAdvertButtonWnd_RegisterBtnGroup.display = False 139 if session.fleetid is None: 140 caption = GetByLabel('UI/Fleet/FleetRegistry/NotInAFleet') 141 self.myAdvertCaption.text = caption 142 self.myAdvertText.text = GetByLabel('UI/Fleet/FleetRegistry/NotInAFleetDetailed') 143 self.myAdvertDesc.display = False 144 return 145 fleetAdvert = sm.GetService('fleet').GetCurrentAdvertForMyFleet() 146 if fleetAdvert is None: 147 caption = GetByLabel('UI/Fleet/FleetRegistry/DoNotHaveAnAdvert') 148 self.myAdvertCaption.text = caption 149 self.myAdvertText.text = GetByLabel('UI/Fleet/FleetRegistry/DoNotHaveAnAdvertDetailed') 150 self.myAdvertDesc.display = False 151 self.myAdvertButtonWnd_RegisterBtnGroup.display = True 152 if self.dragIcon: 153 self.dragIcon.Close() 154 self.dragIcon = None 155 else: 156 self.myAdvertButtonWnd.display = True 157 caption = fleetAdvert.fleetName or GetByLabel('UI/Fleet/FleetRegistry/UnnamedFleet') 158 self.myAdvertCaption.text = caption 159 self.dragIcon = AdvertDraggableIcon(name='theicon', align=uiconst.TOPLEFT, parent=self.myAdvertCont, pos=(uiconst.defaultPadding, 160 uiconst.defaultPadding, 161 64, 162 64), state=uiconst.UI_NORMAL, idx=0) 163 self.dragIcon.Startup(fleetAdvert) 164 self.dragIcon.hint = GetByLabel('UI/Fleet/FleetRegistry/DragToShareAdvertHint') 165 self.myAdvertText.text = GetFleetDetailsEntry(fleetAdvert) 166 self.myAdvertDesc.SetText(fleetAdvert.description) 167 168 def OnFleetFinderAdvertChanged(self): 169 if self.display: 170 self.LoadPanel() 171 172 173 class PanelFleetFinder(Container): 174 default_clipChildren = True 175 176 def ApplyAttributes(self, attributes): 177 super(PanelFleetFinder, self).ApplyAttributes(attributes) 178 self.inited = False 179 self.gettingFleets = False 180 self.fleets = {} 181 self.infoCont = None 182 self.ConstructLayout() 183 self.inited = True 184 185 def LoadPanel(self): 186 if not self.inited: 187 return 188 if not self.gettingFleets: 189 self.GetFleetsClick() 190 191 def GetWndHeight(self): 192 return self.height or self.absoluteBottom - self.absoluteTop 193 194 def GetWndWidth(self): 195 return self.width or self.absoluteRight - self.absoluteLeft 196 197 def _OnResize(self, *args): 198 if self.infoCont: 199 if self.GetWndHeight() < SIZE_FULLUI[1]: 200 self.infoCont.height = 190 - (SIZE_FULLUI[1] - self.GetWndHeight()) 201 else: 202 self.infoCont.height = 190 203 204 def ConstructLayout(self): 205 self.filterCont = Container(name='filterCont', parent=self, align=uiconst.TOTOP, height=22, padTop=4, padBottom=2, uniqueUiName=pConst.UNIQUE_NAME_FLEET_FINDER_SETTINGS) 206 self.infoCont = Container(name='infoCont', parent=self, align=uiconst.TOBOTTOM, height=155, state=uiconst.UI_PICKCHILDREN, padTop=4) 207 self.infoCont.display = False 208 self.topInfoCont = Container(name='topInfoCont', parent=self.infoCont, align=uiconst.TOTOP, height=20) 209 self.descrCont = Container(name='descrCont', parent=self.infoCont, align=uiconst.TOALL, padRight=2, clipChildren=True) 210 self.scrollCont = Container(name='scrollCont', parent=self, align=uiconst.TOALL) 211 self._SetupFilterCont() 212 self.showGroupAndHighStandingsFleets = Checkbox(text=GetByLabel('UI/Fleet/FleetRegistry/ShowGroupAndHighStandingsFleets'), parent=self.scrollCont, settingsKey='fleetfinder_showGroupAndHighStandingsFleets', checked=settings.char.ui.Get('fleetfinder_showGroupAndHighStandingsFleets', False), callback=self.OnShowPublicFleetsChanged, align=uiconst.TOTOP, settingsPath=('char', 'ui'), padding=(2, 4, 2, 4)) 213 self.scroll = Scroll(parent=self.scrollCont) 214 self.scroll.sr.id = 'fleetfinderScroll' 215 self.scroll.multiSelect = 0 216 self.scroll.Load(contentList=[], headers=[], scrolltotop=0, noContentHint=GetByLabel('UI/Fleet/FleetRegistry/SearchHint')) 217 self.captionLabel = EveLabelMediumBold(text='', parent=self.topInfoCont, align=uiconst.RELATIVE, left=4, top=2, state=uiconst.UI_NORMAL) 218 self.detailsText = EditPlainText(name='detailsText', parent=self.descrCont, padTop=2, state=uiconst.UI_NORMAL, readonly=1) 219 self.detailsText.HideBackground() 220 self.detailsText.RemoveActiveFrame() 221 FrameThemeColored(parent=self.detailsText, colorType=uiconst.COLORTYPE_UIHILIGHT) 222 tabs = [110, 540] 223 self.infoText = EveLabelMedium(name='infoText', text='', parent=self.descrCont, top=uiconst.defaultPadding, idx=0, tabs=tabs, state=uiconst.UI_NORMAL) 224 self.joinBtn = Button(parent=self.topInfoCont, label=GetByLabel('UI/Fleet/FleetRegistry/JoinFleet'), pos=(0, 1, 0, 0), func=self.JoinFleet, align=uiconst.CENTERRIGHT) 225 self.joinRequestBtn = Button(parent=self.topInfoCont, label=GetByLabel('UI/Fleet/FleetRegistry/RequestJoinFleet'), pos=(0, 1, 0, 0), func=self.JoinFleet, align=uiconst.CENTERRIGHT) 226 227 def _SetupFilterCont(self): 228 self.getFleetsBtn = Button(parent=self.filterCont, label=GetByLabel('UI/Fleet/FleetRegistry/FindFleets'), func=self.GetFleetsClick, align=uiconst.TORIGHT) 229 comboCont = Container(name='comboCont', parent=self.filterCont) 230 options, selected = self._GetScopeComboOptionsAndIsSelected() 231 self.scopeCombo = Combo(parent=comboCont, options=options, name='fleetfinder_scopeFilter', select=selected, align=uiconst.TOLEFT_PROP, width=0.33, maxWidth=160, padLeft=2) 232 self.scopeCombo.OnChange = self.OnComboChange 233 options = [(GetByLabel('UI/Agency/ContentOfAnyDistance'), None), 234 (GetByLabel('UI/Common/WithinJumps', numJumps=5), 5), 235 (GetByLabel('UI/Common/WithinJumps', numJumps=10), 10), 236 (GetByLabel('UI/Common/LocationTypes/Region'), -1)] 237 self.rangeCombo = Combo(parent=comboCont, options=options, name='fleetfinder_rangeFilter', select=settings.user.ui.Get('fleetfinder_rangeFilter', None), align=uiconst.TOLEFT_PROP, width=0.33, maxWidth=130, padLeft=2) 238 self.rangeCombo.OnChange = self.OnComboChange 239 options = [(GetByLabel('UI/Standings/AnyStanding'), None), (GetByLabel('UI/Standings/GoodStanding'), contactGoodStanding), (GetByLabel('UI/Standings/ExcellentStanding'), contactHighStanding)] 240 self.standingCombo = Combo(parent=comboCont, options=options, name='fleetfinder_standingFilter', select=settings.user.ui.Get('fleetfinder_standingFilter', None), align=uiconst.TOLEFT_PROP, width=0.33, maxWidth=130, padLeft=2) 241 self.standingCombo.OnChange = self.OnComboChange 242 243 def _GetScopeComboOptionsAndIsSelected(self): 244 options = [(GetByLabel('UI/Fleet/FleetRegistry/MyAvailableFleets'), evefleet.INVITE_ALL), (GetByLabel('UI/Fleet/FleetRegistry/MyCorpFleets'), evefleet.INVITE_CORP)] 245 selected = settings.user.ui.Get('fleetfinder_scopeFilter', None) 246 if session.allianceid is not None: 247 options.append((GetByLabel('UI/Fleet/FleetRegistry/MyAllianceFleets'), evefleet.INVITE_ALLIANCE)) 248 elif selected == evefleet.INVITE_ALLIANCE: 249 selected = None 250 if session.warfactionid is not None: 251 options.append((GetByLabel('UI/Fleet/FleetRegistry/MyMilitiaFleets'), evefleet.INVITE_MILITIA)) 252 elif selected == evefleet.INVITE_MILITIA: 253 selected = None 254 options.append((GetByLabel('UI/Fleet/FleetRegistry/BasedOnStandings'), evefleet.INVITE_PUBLIC | evefleet.INVITE_PUBLIC_OPEN)) 255 return (options, selected) 256 257 def SetInfoCont(self, entry): 258 selected = GetAttrs(entry.sr.node, 'selected') 259 if not selected: 260 self.ClearInfoCont() 261 return 262 fleet = entry.sr.node.fleet 263 self.infoCont.isOpen = True 264 if self.GetWndHeight() >= SIZE_FULLUI[1]: 265 self.infoCont.display = True 266 caption = fleet.fleetName or GetByLabel('UI/Fleet/FleetRegistry/UnnamedFleet') 267 self.captionLabel.text = caption 268 text = GetFleetDetailsEntry(fleet) 269 self.infoText.text = text 270 self.detailsText.padTop = self.infoText.height + 2 271 desc = fleet.description 272 self.detailsText.display = bool(desc) 273 self.detailsText.SetValue(desc) 274 self.joinBtn.display = not bool(fleet.joinNeedsApproval) 275 self.joinRequestBtn.display = bool(fleet.joinNeedsApproval) 276 277 def ClearInfoCont(self): 278 self.infoCont.display = False 279 self.infoCont.isOpen = False 280 self.detailsText.SetValue('') 281 282 def OnComboChange(self, combo, header, value, *args): 283 settings.user.ui.Set(combo.name, value) 284 285 def GetFleetsClick(self, *args): 286 self.gettingFleets = True 287 try: 288 self.getFleetsBtn.Disable() 289 sm.GetService('fleet').GetFleetAdsForChar_Memoized.clear_memoized() 290 self.Refresh() 291 finally: 292 uthread.new(self.EnableButtonTimer) 293 self.gettingFleets = False 294 295 def EnableButtonTimer(self): 296 blue.pyos.synchro.SleepWallclock(GETFLEETS_THROTTLETIME) 297 with ExceptionEater('fleetFinder.EnableButtonTimer'): 298 self.getFleetsBtn.Enable() 299 300 def OnShowPublicFleetsChanged(self, *args): 301 self.Refresh() 302 303 def Refresh(self): 304 filterScope = self.scopeCombo.GetValue() 305 filterRange = self.rangeCombo.GetValue() 306 filterStanding = self.standingCombo.GetValue() 307 onlyShowGroupAndHighStanding = self.showGroupAndHighStandingsFleets.checked 308 self.GetFleets() 309 self.DrawScrollList(filterScope, filterRange, filterStanding, onlyShowGroupAndHighStanding) 310 self.ClearInfoCont() 311 312 def JoinFleet(self, *args): 313 fleetID = None 314 selected = self.scroll.GetSelected() 315 if len(selected) > 0: 316 selected = selected[0] 317 fleetID = getattr(selected, 'fleetID', None) 318 if fleetID is None: 319 return 320 if fleetID: 321 fleetSvc = sm.GetService('fleet') 322 fleetSvc.ApplyToJoinFleet(fleetID) 323 fleetSvc.LogFleetJoinAttempts(fleetID, evefleet.JOIN_SOURCE_FLEET_FINDER_BTN) 324 325 def DrawScrollList(self, filterScope = None, filterRange = None, filterStanding = None, onlyShowGroupAndHighStanding = False): 326 fleets = self.fleets 327 self.PrimeStuff(fleets) 328 scrolllist = [] 329 addressbookSvc = sm.GetService('addressbook') 330 for fleet in fleets.itervalues(): 331 if addressbookSvc.IsBlocked(fleet.leader.charID): 332 continue 333 entry = self.GetFleetEntry(fleet, filterScope, filterRange, filterStanding, onlyShowGroupAndHighStanding) 334 if entry: 335 scrolllist.append(entry) 336 337 headers = [GetByLabel('UI/Fleet/Ranks/Boss'), 338 GetByLabel('UI/Fleet/FleetRegistry/BossLocationHeader'), 339 GetByLabel('UI/Fleet/NameOfFleet'), 340 GetByLabel('UI/Fleet/FleetRegistry/MemberCount'), 341 GetByLabel('UI/Common/Description')] 342 self.scroll.Load(contentList=scrolllist, headers=headers, scrolltotop=0, noContentHint=GetByLabel('UI/Fleet/FleetRegistry/SearchNoResult')) 343 344 def IsOpenToMyGroups(self, fleetAd): 345 if fleetAd.inviteScope & evefleet.INVITE_CORP and fleetAd.leader.corpID == session.corpid: 346 return True 347 if fleetAd.inviteScope & evefleet.INVITE_ALLIANCE and fleetAd.leader.allianceID == session.allianceid: 348 return True 349 if fleetAd.inviteScope & evefleet.INVITE_MILITIA and fleetAd.leader.warFactionID == session.warfactionid: 350 return True 351 return False 352 353 def GetFleetEntry(self, fleet, filterScope, filterRange, filterStanding, onlyShowGroupAndHighStanding): 354 if filterScope is not None: 355 if fleet.inviteScope & filterScope == 0: 356 return 357 if filterScope == evefleet.INVITE_CORP and fleet.leader.corpID != session.corpid: 358 return 359 if filterScope == evefleet.INVITE_ALLIANCE and fleet.leader.allianceID != session.allianceid: 360 return 361 if filterScope == evefleet.INVITE_MILITIA and fleet.leader.warFactionID != session.warfactionid: 362 return 363 if filterRange is not None: 364 if not hasattr(fleet, 'numJumps'): 365 return 366 if 0 < filterRange < fleet.numJumps: 367 return 368 if filterRange == -1 and fleet.regionID != session.regionid: 369 return 370 if filterStanding is not None: 371 if filterStanding > fleet.standing: 372 return 373 if onlyShowGroupAndHighStanding and fleet.inviteScope & evefleet.INVITE_PUBLIC_OPEN: 374 if fleet.leader.charID != session.charid and not self.IsOpenToMyGroups(fleet): 375 if fleet.public_minStanding is None or fleet.public_minStanding <= 0: 376 return 377 bossName = GetByLabel('UI/Common/CharacterNameLabel', charID=fleet.leader.charID) 378 if fleet.hideInfo: 379 numMembers = '<color=0x7f888888>%s</color>' % GetByLabel('UI/Generic/Private') 380 systemString = '<color=0x7f888888>%s</color>' % GetByLabel('UI/Generic/Private') 381 else: 382 if fleet.advertJoinLimit and fleet.numMembers >= fleet.advertJoinLimit: 383 numMembers = '<color=0xffdd0000>%s</color>' % fleet.numMembers 384 else: 385 numMembers = fleet.numMembers 386 systemString = GetByLabel('UI/Common/LocationDynamic', location=fleet.solarSystemID) 387 return GetFromClass(FleetFinderEntry, {'label': '%s<t>%s<t>%s<t>%s<t>%s' % (bossName, 388 systemString, 389 fleet.fleetName, 390 numMembers, 391 fleet.description), 392 'fleetID': fleet.fleetID, 393 'charID': fleet.leader.charID, 394 'fleet': fleet, 395 'OnClick': self.SetInfoCont, 396 'corpID': fleet.leader.corpID, 397 'allianceID': fleet.leader.allianceID, 398 'warFactionID': fleet.leader.warFactionID, 399 'securityStatus': fleet.leader.securityStatus}) 400 401 def PrimeStuff(self, fleets): 402 pathfinderSvc = sm.GetService('clientPathfinderService') 403 mapSvc = sm.GetService('map') 404 standingSvc = sm.GetService('standing') 405 namesForPriming = set() 406 locationsForPriming = set() 407 for fleet in fleets.itervalues(): 408 for itemID in [fleet.leader.charID, fleet.leader.corpID, fleet.leader.allianceID]: 409 if itemID is not None: 410 namesForPriming.add(itemID) 411 412 fleet.regionID = None 413 fleet.standing = standingSvc.GetStanding(session.charid, fleet.leader.charID) 414 if fleet.Get('solarSystemID', 0): 415 locationsForPriming.add(fleet.solarSystemID) 416 numJumps = int(pathfinderSvc.GetJumpCountFromCurrent(fleet.solarSystemID)) 417 fleet.numJumps = numJumps 418 constellationID = mapSvc.GetParent(fleet.solarSystemID) 419 fleet.regionID = mapSvc.GetParent(constellationID) 420 fleet.standing = standingSvc.GetStanding(session.charid, fleet.leader.charID) 421 422 if len(namesForPriming) > 0: 423 cfg.eveowners.Prime(namesForPriming) 424 if len(locationsForPriming) > 0: 425 cfg.evelocations.Prime(locationsForPriming) 426 427 def GetFleets(self): 428 self.fleets = sm.GetService('fleet').GetFleetAdsForChar_Memoized() 429 return self.fleets