Beispiel #1
0
 def BrokersFee(self, stationID, amount, commissionPercentage):
     if amount < 0.0:
         raise AttributeError('Amount must be positive')
     orderValue = float(amount)
     station = sm.GetService('ui').GetStation(stationID)
     stationOwnerID = None
     if station is not None:
         stationOwnerID = station.ownerID
     factionChar = 0
     corpChar = 0
     if stationOwnerID:
         if util.IsNPC(stationOwnerID):
             factionID = sm.GetService('faction').GetFaction(stationOwnerID)
             factionChar = sm.GetService('standing').GetStanding(
                 factionID, eve.session.charid) or 0.0
         corpChar = sm.GetService('standing').GetStanding(
             stationOwnerID, eve.session.charid) or 0.0
     commissionPercentage = commissionPercentage - factionChar * 0.0003 - corpChar * 0.0002
     tax = util.KeyVal()
     tax.amt = commissionPercentage * orderValue
     tax.percentage = commissionPercentage
     if tax.amt <= const.mktMinimumFee:
         tax.amt = const.mktMinimumFee
         tax.percentage = -1.0
     return tax
    def InviteClone(self, *args):
        if not sm.GetService('clonejump').HasCloneReceivingBay():
            eve.Message('InviteClone1')
            return
        godmaSM = sm.GetService('godma').GetStateManager()
        opDist = getattr(godmaSM.GetType(self.shipItem.typeID),
                         'maxOperationalDistance', 0)
        bp = sm.GetService('michelle').GetBallpark()
        if not bp:
            return
        charIDs = [
            slimItem.charID for slimItem in bp.slimItems.itervalues()
            if slimItem.charID and slimItem.charID != eve.session.charid and
            not util.IsNPC(slimItem.charID) and slimItem.surfaceDist <= opDist
        ]
        if not charIDs:
            eve.Message('InviteClone2')
            return
        lst = []
        for charID in charIDs:
            char = cfg.eveowners.Get(charID)
            lst.append((char.name, charID, char.typeID))

        chosen = uix.ListWnd(
            lst,
            'character',
            localization.GetByLabel('UI/Ship/ShipConfig/SelectAPilot'),
            None,
            1,
            minChoices=1,
            isModal=1)
        if chosen:
            sm.GetService('clonejump').OfferShipCloneInstallation(chosen[1])
Beispiel #3
0
 def GetForSaleText(self):
     amount = util.FmtISK(self.price, 0)
     saleText = localization.GetByLabel(
         'UI/CharacterSheet/CharacterSheetWindow/ForSale', amount=amount)
     if self.restrictedTo is None:
         availableText = localization.GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/AvailableToAll')
     else:
         entityName = cfg.eveowners.Get(self.restrictedTo).name
         entityType = cfg.eveowners.Get(self.restrictedTo).typeID
         entityText = localization.GetByLabel(
             'UI/Contracts/ContractsWindow/ShowInfoLink',
             showInfoName=entityName,
             info=('showinfo', entityType, self.restrictedTo))
         if util.IsCorporation(
                 self.restrictedTo) and not util.IsNPC(self.restrictedTo):
             corpInfo = sm.RemoteSvc('corpmgr').GetPublicInfo(
                 self.restrictedTo)
             allianceID = corpInfo.allianceID
             if allianceID:
                 allianceName = cfg.allianceshortnames.Get(
                     allianceID).shortName
                 allianceType = const.typeAlliance
                 allianceText = localization.GetByLabel(
                     'UI/Contracts/ContractsWindow/ShowInfoLink',
                     showInfoName=allianceName,
                     info=('showinfo', allianceType, allianceID))
                 entityText += ' [%s]' % allianceText
         availableText = localization.GetByLabel(
             'UI/CharacterSheet/CharacterSheetWindow/AvailableToSpecific',
             entityName=entityText)
     return (saleText, availableText)
 def Load(self, args):
     self.canEditCorp = not util.IsNPC(
         eve.session.corpid
     ) and const.corpRoleDirector & eve.session.corprole == const.corpRoleDirector
     sm.GetService('corpui').LoadTop(None, None)
     if not self.sr.Get('inited', 0):
         self.OnInitializePanel()
 def BrokersFee(self, stationID, amount, commissionPercentage):
     """
     Calculates the market tax due to station owner. Faction and corp standing affects
     the commission percentage. Returns a KeyVal with 'amt' and 'percentage'
     
     NOTE:  May only be called on the location node.
     """
     if amount < 0.0:
         raise AttributeError('Amount must be positive')
     orderValue = float(amount)
     station = sm.GetService('ui').GetStation(stationID)
     stationOwnerID = None
     if station is not None:
         stationOwnerID = station.ownerID
     factionChar = 0
     corpChar = 0
     if stationOwnerID:
         if util.IsNPC(stationOwnerID):
             factionID = sm.GetService('faction').GetFaction(stationOwnerID)
             factionChar = sm.GetService('standing').GetStanding(
                 factionID, eve.session.charid) or 0.0
         corpChar = sm.GetService('standing').GetStanding(
             stationOwnerID, eve.session.charid) or 0.0
     weightedStanding = (0.7 * factionChar + 0.3 * corpChar) / 10.0
     commissionPercentage = commissionPercentage * 2.0**(-2 *
                                                         weightedStanding)
     tax = util.KeyVal()
     tax.amt = commissionPercentage * orderValue
     tax.percentage = commissionPercentage
     if tax.amt <= const.mktMinimumFee:
         tax.amt = const.mktMinimumFee
         tax.percentage = -1.0
     return tax
Beispiel #6
0
    def CheckFiltered(self, slimItem, filtered, alwaysShow):
        stateSvc = sm.GetService('state')
        if len(filtered) + len(alwaysShow) > 3:
            ownerID = slimItem.ownerID
            if ownerID is None or ownerID == const.ownerSystem or util.IsNPC(
                    ownerID):
                checkArgs = (slimItem, None)
            else:
                checkArgs = (slimItem, stateSvc._GetRelationship(slimItem))
        else:
            checkArgs = (slimItem, )
        functionDict = self.GetFilterFuncs()
        for functionName in alwaysShow:
            f = functionDict.get(functionName, None)
            if f is None:
                self.LogError('CheckFiltered got bad functionName: %r' %
                              functionName)
                continue
            if f(*checkArgs):
                return False

        for functionName in filtered:
            f = functionDict.get(functionName, None)
            if f is None:
                self.LogError('CheckFiltered got bad functionName: %r' %
                              functionName)
                continue
            if f(*checkArgs):
                return True

        return False
Beispiel #7
0
 def PreLoad(node):
     data = node
     charinfo = data.Get('info', None) or cfg.eveowners.Get(data.charID)
     data.info = charinfo
     if data.GetLabel:
         data.label = data.GetLabel(data)
     elif not data.Get('label', None):
         label = charinfo.name
         if data.bounty:
             label += '<br>'
             label += localization.GetByLabel('UI/Common/BountyAmount',
                                              bountyAmount=util.FmtISK(
                                                  data.bounty.bounty, 0))
         elif data.killTime:
             label += '<br>' + localization.GetByLabel(
                 'UI/PeopleAndPlaces/ExpiresTime', expires=data.killTime)
         data.label = label
     groupID = evetypes.GetGroupID(data.info.typeID)
     data.invtype = data.info.typeID
     data.IsCharacter = groupID == const.groupCharacter
     data.IsCorporation = groupID == const.groupCorporation
     data.IsFaction = groupID == const.groupFaction
     data.IsAlliance = groupID == const.groupAlliance
     if data.IsCharacter and util.IsDustCharacter(data.charID):
         data.isDustCharacter = True
     if data.IsCorporation and not util.IsNPC(data.charID):
         logoData = cfg.corptickernames.Get(data.charID)
Beispiel #8
0
 def GetSubContentDetails(self, nodedata, *args):
     scrolllist = []
     corpinfo = sm.GetService('corp').GetCorporation()
     founderdone = 0
     if cfg.invtypes.Get(cfg.eveowners.Get(corpinfo.ceoID).typeID).groupID == const.groupCharacter:
         if corpinfo.creatorID == corpinfo.ceoID:
             ceoLabel = 'UI/Corporations/CorpUIHome/CeoAndFounder'
             founderdone = 1
         else:
             ceoLabel = 'UI/Corporations/Common/CEO'
         scrolllist.append(self.GetListEntry(ceoLabel, localization.GetByLabel('UI/Corporations/CorpUIHome/PlayerNamePlaceholder', player=corpinfo.ceoID), typeID=const.typeCharacterAmarr, itemID=corpinfo.ceoID))
     if not founderdone and cfg.invtypes.Get(cfg.eveowners.Get(corpinfo.creatorID).typeID).groupID == const.groupCharacter:
         scrolllist.append(self.GetListEntry('UI/Corporations/Common/Founder', localization.GetByLabel('UI/Corporations/CorpUIHome/PlayerNamePlaceholder', player=corpinfo.creatorID), typeID=const.typeCharacterAmarr, itemID=corpinfo.creatorID))
     if corpinfo.stationID:
         station = sm.GetService('map').GetStation(corpinfo.stationID)
         row = Row(['stationID', 'typeID'], [corpinfo.stationID, station.stationTypeID])
         jumps = sm.GetService('clientPathfinderService').GetJumpCountFromCurrent(station.solarSystemID)
         scrolllist.append(self.GetListEntry('UI/Corporations/CorpUIHome/Headquarters', localization.GetByLabel('UI/Corporations/CorpUIHome/StationAndJumps', station=station.stationID, jumpCount=jumps, jumps=jumps), typeID=station.stationTypeID, itemID=corpinfo.stationID, station=row))
     scrolllist.append(self.GetListEntry('UI/Corporations/CorpUIHome/TickerName', localization.GetByLabel('UI/Corporations/CorpUIHome/TickerNamePlaceholder', ticker=corpinfo.tickerName)))
     scrolllist.append(self.GetListEntry('UI/Corporations/CorpUIHome/Shares', localization.formatters.FormatNumeric(value=corpinfo.shares)))
     if not util.IsNPC(eve.session.corpid):
         scrolllist.append(self.GetListEntry('UI/Corporations/CorpUIHome/MemberCount', localization.formatters.FormatNumeric(value=corpinfo.memberCount)))
     scrolllist.append(self.GetListEntry('UI/Corporations/CorpUIHome/TaxRate', localization.GetByLabel('UI/Corporations/CorpUIHome/TaxRatePlaceholder', tax=corpinfo.taxRate * 100)))
     if corpinfo.url:
         linkTag = '<url=%s>' % corpinfo.url
         scrolllist.append(self.GetListEntry('UI/Corporations/CorpUIHome/URL', localization.GetByLabel('UI/Corporations/CorpUIHome/URLPlaceholder', linkTag=linkTag, url=corpinfo.url)))
     enabledDisabledText = localization.GetByLabel('UI/Corporations/CorpUIHome/Enabled')
     if not corpinfo.isRecruiting:
         enabledDisabledText = localization.GetByLabel('UI/Corporations/CorpUIHome/Disabled')
     scrolllist.append(self.GetListEntry('UI/Corporations/CorpUIHome/MembershipApplication', enabledDisabledText))
     myListEntry = listentry.Get('FriendlyFireEntry', {'line': 1,
      'label': localization.GetByLabel('UI/Corporations/CorpUIHome/FriendlyFire'),
      'text': 'text'})
     scrolllist.append(myListEntry)
     return scrolllist
Beispiel #9
0
 def OnChannelsJoined(self, channels):
     for channel in channels:
         if self.IsVoiceChannel(channel):
             speakingChannel = self.GetSpeakingChannel()
             if type(speakingChannel) is types.TupleType:
                 speakingChannel = (speakingChannel, )
             self.SetTabColor(self.GetVivoxChannelName(channel),
                              ['listen',
                               'speak'][speakingChannel == channel])
         else:
             joinCorporationChannel = settings.user.ui.Get(
                 'chatJoinCorporationChannelOnLogin', 0)
             joinCorporationChannel = joinCorporationChannel and self.GetVivoxChannelName(
                 channel).startswith(const.vcPrefixCorp)
             if type(channel) is types.TupleType:
                 joinCorporationChannel = joinCorporationChannel and not util.IsNPC(
                     channel[0][1])
             joinAllianceChannel = settings.user.ui.Get(
                 'chatJoinAllianceChannelOnLogin', 0)
             joinAllianceChannel = joinAllianceChannel and self.GetVivoxChannelName(
                 channel).startswith(const.vcPrefixAlliance)
             shouldAutoJoin = joinCorporationChannel or joinAllianceChannel
             if shouldAutoJoin:
                 if self.vivoxLoginState == vivoxConstants.VXCLOGINSTATE_LOGGEDIN:
                     self.JoinChannel(channel)
                 elif channel not in self.autoJoinQueue:
                     self.autoJoinQueue.append(channel)
 def CanAttackFreely(self, item):
     if util.IsSystem(item.ownerID) or item.ownerID == session.charid:
         return True
     securityClass = sm.GetService('map').GetSecurityClass(session.solarsystemid)
     if securityClass == const.securityClassZeroSec:
         return True
     if self.IsCriminallyFlagged(item.ownerID):
         return True
     if self.HasLimitedEngagmentWith(item.ownerID):
         return True
     if util.IsCharacter(item.ownerID) and util.IsOutlawStatus(item.securityStatus):
         return True
     if session.warfactionid:
         if hasattr(item, 'corpID') and self.facwar.IsEnemyCorporation(item.corpID, session.warfactionid):
             return True
     belongToPlayerCorp = not util.IsNPC(session.corpid)
     if belongToPlayerCorp:
         if item.ownerID == session.corpid:
             return True
         otherCorpID = getattr(item, 'corpID', None)
         if otherCorpID is not None:
             if otherCorpID == session.corpid:
                 return True
             if self.war.GetRelationship(otherCorpID) == const.warRelationshipAtWarCanFight:
                 return True
         otherAllianceID = getattr(item, 'allianceID', None)
         if otherAllianceID is not None:
             if self.war.GetRelationship(otherAllianceID) == const.warRelationshipAtWarCanFight:
                 return True
     if IsItemFreeForAggression(item.groupID):
         return True
     return False
 def OnChannelsJoined(self, channels):
     """ Listening for notification on when this user joined a LSC channel.
     
     This also queues any auto-join voice chat channel requests. The queue is required
     because when this notification arrives, the vivox service is not logged in yet, so 
     it cannot join these channels.
     """
     for channel in channels:
         if self.IsVoiceChannel(channel):
             speakingChannel = self.GetSpeakingChannel()
             if type(speakingChannel) is types.TupleType:
                 speakingChannel = (speakingChannel, )
             self.SetTabColor(self.GetVivoxChannelName(channel),
                              ['listen',
                               'speak'][speakingChannel == channel])
         else:
             joinCorporationChannel = settings.user.ui.Get(
                 'chatJoinCorporationChannelOnLogin', 0)
             joinCorporationChannel = joinCorporationChannel and self.GetVivoxChannelName(
                 channel).startswith(const.vcPrefixCorp)
             if type(channel) is types.TupleType:
                 joinCorporationChannel = joinCorporationChannel and not util.IsNPC(
                     channel[0][1])
             joinAllianceChannel = settings.user.ui.Get(
                 'chatJoinAllianceChannelOnLogin', 0)
             joinAllianceChannel = joinAllianceChannel and self.GetVivoxChannelName(
                 channel).startswith(const.vcPrefixAlliance)
             shouldAutoJoin = joinCorporationChannel or joinAllianceChannel
             if shouldAutoJoin:
                 if self.vivoxLoginState == vivoxConstants.VXCLOGINSTATE_LOGGEDIN:
                     self.JoinChannel(channel)
                 elif channel not in self.autoJoinQueue:
                     self.autoJoinQueue.append(channel)
Beispiel #12
0
def _IsInDockableCorpOffice(invItem, *args):
    if invItem.ownerID != session.corpid:
        return False
    if util.IsNPC(invItem.ownerID):
        return False
    return _GetLocationIDOfItemInCorpOffice(
        invItem, *args
    ) and invItem.flagID in invConst.flagStructureCorpOfficeFlags + invConst.flagCorpSAGs
 def CanSeeCorpBlueprints(self):
     """
      Can the current player view corporation blueprints
      NOTE: Players also need take access to individual divisions
     """
     if util.IsNPC(session.corpid):
         return False
     return session.corprole & (const.corpRoleCanRentResearchSlot
                                | const.corpRoleFactoryManager
                                | const.corpRoleCanRentFactorySlot) > 0
Beispiel #14
0
 def StartConversation(self, characterID):
     if eve.Message('StartConversationConfirmation',
                    {'charName': (const.UE_OWNERID, characterID)},
                    uiconst.YESNO) == uiconst.ID_YES:
         characterID = ValidCharacterID(characterID)
         if characterID:
             if util.IsNPC(characterID):
                 sm.GetService('agents').InteractWith(characterID)
             else:
                 sm.GetService('LSC').Invite(characterID)
Beispiel #15
0
 def wrapper(self,
             charid,
             corpid,
             unparsed=0,
             filterFunc=None,
             multi=0,
             **kwargs):
     ret = fn(self, charid, corpid, unparsed, filterFunc, multi, **kwargs)
     if not util.IsNPC(charid):
         ret += [["Open Killboard", OpenKillInfo, (charid, )]]
     return ret
Beispiel #16
0
    def GetCorporationWarFactionID(self, corpID):
        if util.IsNPC(corpID):
            for factionID, militiaCorpID in self.GetWarFactions().iteritems():
                if militiaCorpID == corpID:
                    return factionID

            return None
        ret = self.facWarMgr.GetCorporationWarFactionID(corpID)
        if not ret:
            return None
        return ret
    def LoadContacts(self, *args):
        allContacts = sm.GetService('addressbook').GetContacts()
        contacts = allContacts.contacts.values()
        scrolllist = []
        for contact in contacts:
            if util.IsNPC(contact.contactID) or not util.IsCharacter(contact.contactID):
                continue
            entryTuple = self.GetUserEntryTuple(contact.contactID, contact)
            scrolllist.append(entryTuple)

        scrolllist = uiutil.SortListOfTuples(scrolllist)
        self.sr.contactsScroll.Load(contentList=scrolllist, headers=[], noContentHint=localization.GetByLabel('UI/AddressBook/NoContacts'))
Beispiel #18
0
 def Register(self, *args):
     if util.IsNPC(session.corpid) and sm.GetService(
             'facwar').GetCorporationWarFactionID(session.corpid) is None:
         raise UserError('CantUseFleetfinder')
     if session.fleetid is None:
         return
     if sm.GetService('fleet').IsBoss():
         if sm.GetService('fleet').options.isRegistered:
             self.EditDetail()
         else:
             form.RegisterFleetWindow.CloseIfOpen()
             form.RegisterFleetWindow.Open()
Beispiel #19
0
 def Startup(self, *args):
     LabelTextTop.Startup(self, args)
     self.statusText = ''
     self.changeAtTime = None
     self.isEnabled = True
     self.SetCorpFFStatus()
     helpIcon = MoreInfoIcon(parent=self, align=uiconst.CENTERRIGHT, hint=localization.GetByLabel('UI/Corporations/FriendlyFire/Description'))
     self.ffButton = Button(name='ffButton', align=uiconst.CENTERRIGHT, parent=self, label='', func=self.OnFFClick, left=20)
     self.UpdateButton()
     canEditCorp = not util.IsNPC(session.corpid) and const.corpRoleDirector & session.corprole == const.corpRoleDirector
     if not canEditCorp:
         self.ffButton.display = False
Beispiel #20
0
 def PrimeBookmarks(self):
     self.bookmarkCache = {}
     self.folders = {}
     if not util.IsNPC(session.corpid):
         bookmarks, folders = self.corpBookmarkMgr.GetBookmarks()
         self.bookmarkCache.update(bookmarks)
         self.folders.update(folders)
     bookmarks, folders = self.bookmarkMgr.GetBookmarks()
     self.bookmarkCache.update({bookmark.bookmarkID:bookmark for bookmark in bookmarks})
     self.folders.update({folder.folderID:folder for folder in folders})
     self.lastUpdateTime = blue.os.GetWallclockTime()
     self.bookmarksPrimed = True
 def AddEntry(self, info):
     confirmOnDblClick = self.minChoices == self.maxChoices == 1
     if self.listtype in ('character', 'corporation', 'alliance', 'faction',
                          'owner'):
         typeinfo = None
         if info[2]:
             typeinfo = cfg.invtypes.Get(info[2])
         if typeinfo is None:
             owner = cfg.eveowners.GetIfExists(info[1])
             if owner:
                 typeinfo = cfg.invtypes.Get(owner.typeID)
         if typeinfo is not None:
             charID = info[1]
             if util.IsCharacter(charID) and util.IsNPC(charID):
                 entryType = 'AgentEntry'
             else:
                 entryType = 'User'
             return (40,
                     listentry.Get(
                         entryType, {
                             'charID': charID,
                             'OnDblClick': self.DblClickEntry,
                             'OnClick': self.ClickEntry,
                             'dblconfirm': confirmOnDblClick
                         }))
     else:
         if self.listtype in ('pickStation', ):
             data = info
             data.confirmOnDblClick = confirmOnDblClick
             data.OnDblClick = self.DblClickEntry
             data.OnClick = self.ClickEntry
             return (32, listentry.Get('Generic', data=data))
         if self.listtype == 'generic':
             name, listvalue = info
             data = util.KeyVal()
             data.confirmOnDblClick = confirmOnDblClick
             data.label = name
             data.listvalue = info
             data.OnDblClick = self.DblClickEntry
             data.OnClick = self.ClickEntry
             return (32, listentry.Get('Generic', data=data))
     name, itemID, typeID = info
     data = util.KeyVal()
     data.confirmOnDblClick = confirmOnDblClick
     data.label = name
     data.itemID = itemID
     data.typeID = typeID
     data.listvalue = [name, itemID, typeID]
     data.isStation = self.listtype == 'station'
     data.getIcon = self.listtype == 'item'
     data.OnDblClick = self.DblClickEntry
     data.OnClick = self.ClickEntry
     return (24, listentry.Get('Generic', data=data))
Beispiel #22
0
 def DoAttackConfirmations(self, targetID, effect = None):
     requiredSafetyLevel = self.crimewatchSvc.GetSafetyLevelRestrictionForAttackingTarget(targetID, effect=effect)
     if self.crimewatchSvc.CheckUnsafe(requiredSafetyLevel):
         self.crimewatchSvc.SafetyActivated(requiredSafetyLevel)
         return False
     item = self.michelle.GetItem(targetID)
     if item and util.IsNPC(item.ownerID):
         if not self.TypeHasAttribute(item.typeID, const.attributeEntitySecurityStatusKillBonus):
             if item.groupID not in [const.groupLargeCollidableObject, const.groupControlBunker, const.groupWormhole]:
                 if not self.ConfirmationRequest(targetID, 'AttackGoodNPCAbort1', targetID):
                     return False
     return True
Beispiel #23
0
 def GetOnlineStatus(self, charID, fetch = True):
     if util.IsNPC(charID):
         return False
     if fetch:
         self.Prime()
     if charID not in (self.onlineStatus or {}):
         if fetch:
             self.onlineStatus[charID] = blue.DBRow(self.onlineStatus.header, [charID, sm.RemoteSvc('onlineStatus').GetOnlineStatus(charID)])
         else:
             raise IndexError('GetOnlineStatus', charID)
     if charID in self.onlineStatus:
         return self.onlineStatus[charID].online
     else:
         return None
def CheckIfInHangarOrCorpHangarAndCanTake(invItem):
    canTake = False
    corpMember = False
    stationID = None
    bp = sm.StartService('michelle').GetBallpark()
    if invItem.ownerID == session.charid:
        if util.IsStation(
                invItem.locationID) and invItem.flagID == const.flagHangar:
            canTake = True
        elif bp is not None and invItem.flagID == const.flagHangar and invItem.locationID in bp.slimItems and bp.slimItems[
                invItem.locationID].groupID == const.groupPersonalHangar:
            canTake = True
    elif session.solarsystemid and bp is not None and invItem.locationID in bp.slimItems and invItem.ownerID == bp.slimItems[
            invItem.locationID].ownerID:
        corpMember = True
    elif invItem.ownerID == session.corpid and not util.IsNPC(invItem.ownerID):
        stationID = None
        rows = sm.StartService(
            'corp').GetMyCorporationsOffices().SelectByUniqueColumnValues(
                'officeID', [invItem.locationID])
        if rows and len(rows):
            for row in rows:
                if invItem.locationID == row.officeID:
                    stationID = row.stationID
                    break

    if stationID is not None or corpMember:
        flags = [const.flagHangar] + list(const.flagCorpSAGs)
        if invItem.flagID in flags:
            if stationID is not None and stationID == session.hqID:
                roles = session.rolesAtHQ
            elif stationID is not None and stationID == session.baseID:
                roles = session.rolesAtBase
            else:
                roles = session.rolesAtOther
            if invItem.ownerID == session.corpid or corpMember:
                rolesByFlag = {
                    const.flagHangar: const.corpRoleHangarCanTake1,
                    const.flagCorpSAG2: const.corpRoleHangarCanTake2,
                    const.flagCorpSAG3: const.corpRoleHangarCanTake3,
                    const.flagCorpSAG4: const.corpRoleHangarCanTake4,
                    const.flagCorpSAG5: const.corpRoleHangarCanTake5,
                    const.flagCorpSAG6: const.corpRoleHangarCanTake6,
                    const.flagCorpSAG7: const.corpRoleHangarCanTake7
                }
                roleRequired = rolesByFlag[invItem.flagID]
                if roleRequired & roles == roleRequired:
                    canTake = True
    return bool(canTake)
    def GetCorporationWarFactionID(self, corpID):
        """
            Get the war faction that the entity (char or corp) belongs to, or None if the entity is not (actively) in a faction
            May also be invoked with entity as a faction, in which case it simply returns the faction ID
        """
        if util.IsNPC(corpID):
            for factionID, militiaCorpID in self.GetWarFactions().iteritems():
                if militiaCorpID == corpID:
                    return factionID

            return None
        ret = self.facWarMgr.GetCorporationWarFactionID(corpID)
        if not ret:
            return None
        return ret
Beispiel #26
0
 def CanViewVotes(self, corpid, new = 0):
     bCan = 0
     if eve.session.corpid == corpid:
         if eve.session.corprole & const.corpRoleDirector == const.corpRoleDirector:
             return 1
         if util.IsNPC(eve.session.corpid):
             return 0
         if self.CanViewVotes_ is None or new:
             self.CanViewVotes_ = (corpid, self.GetCorpRegistry().CanViewVotes(corpid))
         elif self.CanViewVotes_[0] != corpid:
             self.CanViewVotes_ = (corpid, self.GetCorpRegistry().CanViewVotes(corpid))
         bCan = self.CanViewVotes_[1]
     else:
         bCan = self.GetCorpRegistry().CanViewVotes(corpid)
     return bCan
Beispiel #27
0
 def ShowNPCAtttackConfirmationWindowIfAppropriate(self,
                                                   requiredSafetyLevel,
                                                   targetID):
     item = self.michelle.GetItem(targetID)
     if item and util.IsNPC(
             item.ownerID
     ) and item.ownerID not in const.legalOffensiveTargetOwnerIDs:
         if not self.TypeHasAttribute(
                 item.typeID, const.attributeEntitySecurityStatusKillBonus):
             if item.groupID not in [
                     const.groupLargeCollidableObject,
                     const.groupControlBunker, const.groupWormhole
             ]:
                 if not self.ConfirmationRequest(
                         targetID, 'AttackGoodNPCAbort1', targetID):
                     return False
     return True
Beispiel #28
0
 def Ishostile(self, charid):  # 判断声望 True:报警 False:不报警
     pubinfo = sm.RemoteSvc('charMgr').GetPublicInfo(charid)
     corpID = pubinfo.corporationID
     allianceID = None
     if not util.IsNPC(pubinfo.corporationID):
         allianceID = sm.GetService('corp').GetCorporation(
             pubinfo.corporationID).allianceID
     ret = sm.GetService('addressbook').GetRelationship(
         charid, corpID, allianceID)
     relationships = [
         ret.persToCorp, ret.persToPers, ret.persToAlliance, ret.corpToPers,
         ret.corpToCorp, ret.corpToAlliance, ret.allianceToPers,
         ret.allianceToCorp, ret.allianceToAlliance
     ]
     relationship = 0.0
     for r in relationships:
         if r != 0.0 and r > relationship or relationship == 0.0:
             relationship = r
     return relationship <= 0
Beispiel #29
0
    def PrimeOwnersFromMembers(self, members):
        if not sm.GetService('machoNet').GetGlobalConfig().get(
                'EnableBountyFetchingForChat', False):
            self.LogInfo('PrimeOwnersForMember - disabled')
            return
        ownerIDsToPrime = set()
        charIDs = set()
        self.LogInfo('PrimeOwnersFromMembers - got', len(members))
        for member in members.itervalues():
            ownerIDsToPrime.add(member.charID)
            charIDs.add(member.charID)
            if util.IsNPC(member.corpID):
                continue
            ownerIDsToPrime.add(member.corpID)
            if member.allianceID is None:
                continue
            ownerIDsToPrime.add(member.allianceID)

        self.LogInfo('PrimeOwnersFromMembers - Need to Fetch',
                     len(ownerIDsToPrime))
        if ownerIDsToPrime or charIDs:
            self.FetchBountiesAndKillRightsFromServer(ownerIDsToPrime, charIDs)
Beispiel #30
0
    def GetCorpPilots(self, factionInfo):
        pilots = {}
        if util.IsNPC(session.corpid):
            yourFactionInfo = factionInfo.get(session.warfactionid, None)
            pilots['your'] = getattr(yourFactionInfo, 'militiaMembersCount', 0)
        else:
            reg = moniker.GetCorpRegistry()
            pilots['your'] = reg.GetCorporation().memberCount
        topFWCorp = 0
        topCorps = self.ChangeFormat(factionInfo, 'topMemberCount')
        for each in topCorps.itervalues():
            if topFWCorp < each:
                topFWCorp = each

        pilots['top'] = topFWCorp
        allMembers = 0
        members = self.ChangeFormat(factionInfo, 'totalMembersCount')
        for each in members.itervalues():
            allMembers += each

        pilots['all'] = allMembers
        return pilots