Example #1
0
    def GetSelected(self):
        ids = []
        sel = self.sr.node.scroll.GetSelectedNodes(self.sr.node)
        for node in sel:
            if node.Get('typeID', None) is None:
                continue
            if evetypes.GetGroupID(node.typeID) == evetypes.GetGroupID(self.sr.node.typeID):
                ids.append(node.itemID)

        return ids
Example #2
0
 def GetDemand(self, typeID):
     if evetypes.GetGroupID(
             typeID) == inventorycommon.const.groupMoonMaterials:
         return self.harvesterSiphonQuantity
     elif evetypes.GetGroupID(
             typeID) == inventorycommon.const.groupHybridPolymers:
         return self.polySiphonQuantity
     else:
         return self.reactionSiphonQuantity
     return (0, False)
Example #3
0
    def GetSelected(self, fromNode):
        nodes = []
        sel = self.sr.scroll.GetSelectedNodes(fromNode)
        for node in sel:
            if node.Get('typeID', None) is None:
                continue
            if evetypes.GetGroupID(node.typeID) == evetypes.GetGroupID(fromNode.typeID):
                if node.droneState == fromNode.droneState:
                    nodes.append(node)

        return nodes
Example #4
0
def CheckMaxPerSolarSystem(maxPerSolarSystem, typeID, componentRegistry):
    numComponents = 0
    groupID = evetypes.GetGroupID(typeID)
    for component in componentRegistry.GetInstancesWithComponentClass(
            DEPLOY_CLASS):
        if evetypes.GetGroupID(component.typeID) == groupID:
            numComponents += 1
        if numComponents >= maxPerSolarSystem:
            raise UserError('CantDeployMaxPerSolarSystemExceeded', {
                'typeID': typeID,
                'maxPerSolarSystem': maxPerSolarSystem
            })
Example #5
0
def ItemOutputFlag(location, itemFlagID=None):
    if location.typeID == const.typeOffice:
        return location.flagID
    if evetypes.GetCategoryID(location.typeID) == const.categoryStarbase:
        return location.flagID
    if evetypes.GetGroupID(location.typeID) == const.groupStation:
        return location.flagID
    if evetypes.GetGroupID(
            location.typeID) == const.groupAuditLogSecureContainer:
        if itemFlagID == const.flagLocked:
            return const.flagLocked
        else:
            return const.flagUnlocked
    return const.flagNone
Example #6
0
    def GetFittingInfoScrollList(self, fitting):
        scrolllist = []
        typesByRack = self.GetTypesByRack(fitting)
        for key, effectID in [('hiSlots', const.effectHiPower),
         ('medSlots', const.effectMedPower),
         ('lowSlots', const.effectLoPower),
         ('rigSlots', const.effectRigSlot),
         ('subSystems', const.effectSubSystem),
         ('serviceSlots', const.effectServiceSlot)]:
            slots = typesByRack[key]
            if len(slots) < 1:
                continue
            label = cfg.dgmeffects.Get(effectID).displayName
            scrolllist.append(listentry.Get('Header', {'label': label}))
            slotScrollList = []
            for typeID, qty in slots.iteritems():
                data = self._GetDataForFittingEntry(typeID, qty)
                data.singleton = 1
                data.effectID = effectID
                entry = listentry.Get('FittingModuleEntry', data=data)
                slotScrollList.append((evetypes.GetGroupID(typeID), entry))

            slotScrollList = SortListOfTuples(slotScrollList)
            scrolllist.extend(slotScrollList)

        for qtyByTypeIdDict, headerLabelPath, isValidGroup in ((typesByRack['charges'], 'UI/Generic/Charges', True),
         (typesByRack['ice'], 'UI/Inflight/MoonMining/Processes/Fuel', True),
         (typesByRack['drones'], 'UI/Drones/Drones', True),
         (typesByRack['fighters'], 'UI/Common/Fighters', True),
         (typesByRack['other'], 'UI/Fitting/FittingWindow/FittingManagement/OtherItems', False)):
            if len(qtyByTypeIdDict) > 0:
                scrolllist.append(listentry.Get('Header', {'label': localization.GetByLabel(headerLabelPath)}))
                scrolllist += self._GetFittingEntriesForGroup(qtyByTypeIdDict, isValidGroup)

        return scrolllist
Example #7
0
    def GetStringForFitting(self, fitting):
        typesDict = defaultdict(int)
        drones = {}
        fighters = {}
        charges = {}
        ice = {}
        for typeID, flag, qty in fitting.fitData:
            categoryID = evetypes.GetCategoryID(typeID)
            groupID = evetypes.GetGroupID(typeID)
            if IsShipFittable(categoryID):
                typesDict[typeID] += 1
            elif categoryID == const.categoryDrone:
                drones[typeID] = qty
            elif categoryID == const.categoryFighter:
                fighters[typeID] = qty
            elif categoryID == const.categoryCharge:
                charges[typeID] = qty
            elif groupID == const.groupIceProduct:
                ice[typeID] = qty

        retList = []
        subString = str(fitting.shipTypeID)
        retList.append(subString)
        for eachDict in [typesDict,
         drones,
         fighters,
         charges,
         ice]:
            for typeID, qty in eachDict.iteritems():
                subString = '%s;%s' % (typeID, qty)
                retList.append(subString)

        ret = ':'.join(retList)
        ret += '::'
        return ret
Example #8
0
 def LoadTooltip(self):
     if not self.owner:
         return
     self.ownerGuid = self.owner.__guid__
     if self.ownerGuid == 'xtriui.ModuleButton':
         self.moduleItemID = self.owner.moduleinfo.itemID
     else:
         self.moduleItemID = self.controller.GetModuleID()
     if not self.moduleItemID:
         return
     if self.ownerGuid == 'xtriui.FittingSlotGhost':
         self.dogmaLocation = sm.GetService(
             'fittingSvc').GetCurrentDogmaLocation()
     else:
         self.dogmaLocation = sm.GetService(
             'clientDogmaIM').GetDogmaLocation()
     self.moduleInfoItem = self.dogmaLocation.GetDogmaItem(
         self.moduleItemID)
     self.moduleGroupID = evetypes.GetGroupID(self.moduleInfoItem.typeID)
     self.numSlaves = self.GetNumberOfSlaves(self.moduleInfoItem,
                                             self.ownerGuid)
     if self.stateManager.GetDefaultEffect(self.moduleInfoItem.typeID):
         self.moduleShortcut = self.GetModuleShortcut(self.moduleInfoItem)
     else:
         self.moduleShortcut = None
     self.typeName = evetypes.GetName(self.moduleInfoItem.typeID)
     self.onHUDModuleButton = self.ownerGuid == 'xtriui.ModuleButton'
     self.UpdateToolTips()
     self._toolTooltipUpdateTimer = AutoTimer(1000, self.UpdateToolTips)
Example #9
0
 def GetOptimalRangeText(self, typeID, optimalRange, falloff):
     if optimalRange <= 0:
         return ('', '')
     formattedOptimalRAnge = FmtDist(optimalRange)
     if sm.GetService('clientDogmaStaticSvc').TypeHasEffect(
             typeID, const.effectLauncherFitted):
         rangeText = localization.GetByLabel(
             'UI/Inflight/ModuleRacks/MaxRange',
             maxRange=formattedOptimalRAnge)
     elif sm.GetService('clientDogmaStaticSvc').TypeHasEffect(
             typeID, const.effectTurretFitted):
         if falloff > 1:
             rangeText = localization.GetByLabel(
                 'UI/Inflight/ModuleRacks/OptimalRangeAndFalloff',
                 optimalRange=formattedOptimalRAnge,
                 falloffPlusOptimal=FmtDist(falloff + optimalRange))
         else:
             rangeText = localization.GetByLabel(
                 'UI/Inflight/ModuleRacks/OptimalRange',
                 optimalRange=formattedOptimalRAnge)
     elif evetypes.GetGroupID(typeID) == const.groupSmartBomb:
         rangeText = localization.GetByLabel(
             'UI/Inflight/ModuleRacks/AreaOfEffect',
             range=formattedOptimalRAnge)
     elif falloff > 1:
         rangeText = localization.GetByLabel(
             'UI/Inflight/ModuleRacks/RangeWithFalloff',
             optimalRange=formattedOptimalRAnge,
             falloffPlusOptimal=FmtDist(falloff + optimalRange))
     else:
         rangeText = localization.GetByLabel(
             'UI/Inflight/ModuleRacks/Range',
             optimalRange=formattedOptimalRAnge)
     return (rangeText, formattedOptimalRAnge)
Example #10
0
    def GetSubContentDivision(self, nodedata, *args):
        items = sm.RemoteSvc('corpmgr').GetAssetInventoryForLocation(eve.session.corpid, nodedata.locationID, FLAGNAME_OFFICES)
        scrolllist = []
        if len(items) == 0:
            label = localization.GetByLabel('UI/Corporations/Assets/UnusedCorpOffice')
            data = util.KeyVal()
            data.label = label
            data.sublevel = nodedata.Get('sublevel', 1) + 1
            data.id = nodedata.flag
            return [listentry.Get('Generic', data=data)]
        if not set(['groupID', 'categoryID']) & {i[0] for i in items.header.virtual}:
            items.header.virtual = items.header.virtual + [('groupID', lambda row: evetypes.GetGroupID(row.typeID)), ('categoryID', lambda row: evetypes.GetCategoryID(row.typeID))]
        sm.GetService('corp').GetLockedItemsByLocation(nodedata.locationID)
        for each in items:
            if each.flagID != nodedata.flag:
                continue
            data = uix.GetItemData(each, nodedata.viewMode, viewOnly=1, scrollID=nodedata.scrollID)
            data.id = each.itemID
            data.remote = True
            data.sublevel = nodedata.Get('sublevel', 1) + 1
            if each.categoryID == const.categoryBlueprint:
                data.locked = sm.GetService('corp').IsItemLocked(each)
            scrolllist.append(listentry.Get('InvItemWithVolume', data=data))

        return scrolllist
Example #11
0
 def OnOtherCharactersCommandPinClicked(self, pinID):
     pin = self.otherPinManager.otherPlayerPinsByPinID.get(pinID)
     if not pin:
         return
     if evetypes.GetGroupID(pin.typeID) != const.groupCommandPins:
         return
     self.otherPinManager.RenderOtherCharactersNetwork(pin.ownerID)
Example #12
0
    def Profile_Refresh(self):
        content = []
        for gid in self.skillGroups:
            items = [
                typeID for typeID in self.currentProfile.iterkeys()
                if evetypes.GetGroupID(typeID) == gid
            ]
            if items:
                node = {
                    'label': evetypes.GetGroupNameByGroup(gid),
                    'iconMargin': 18,
                    'showlen': True,
                    'groupItems': items,
                    'state': 0,
                    'allowCopy': 0,
                    'GetSubContent': self.Profile_GetSubContent,
                    'selected': 0,
                    'id': ('p' + str(gid), gid),
                    'sublevel': 0
                }
                content.append(listentry.Get('Group', node))

        self.wnd.sr.scroll2.Load(contentList=content,
                                 fixedEntryHeight=None,
                                 headers=['Name'])
        self.wnd.sr.profile.text = self.currentProfileName or '&lt;New Profile&gt;'
Example #13
0
    def DrawFittings(self, *args):
        scrolllist = []
        fittings = self.fittingSvc.GetFittings(self.ownerID).items()
        self.EnableExportButton(len(fittings) > 0)
        maxFittings = None
        if self.ownerID == session.charid:
            maxFittings = const.maxCharFittings
        elif self.ownerID == session.corpid:
            maxFittings = const.maxCorpFittings
        fittingsByGroupID = {}
        shipGroups = []
        if self.wordFilter is not None:
            for fittingID, fitting in fittings[:]:
                if self.wordFilter.lower() not in fitting.name.lower():
                    fittings.remove((fittingID, fitting))

        hideRight = True
        for fittingID, fitting in fittings:
            if self.fitting is not None and self.fitting.fittingID == fittingID:
                hideRight = False
            shipTypeID = fitting.shipTypeID
            if not evetypes.Exists(shipTypeID):
                log.LogError(
                    'Ship in stored fittings does not exist, shipID=%s, fittingID=%s'
                    % (shipTypeID, fittingID))
                continue
            groupID = evetypes.GetGroupID(shipTypeID)
            if groupID not in fittingsByGroupID:
                fittingsByGroupID[groupID] = []
            fittingsByGroupID[groupID].append(fitting)
            groupName = evetypes.GetGroupNameByGroup(groupID)
            if (groupName, groupID) not in shipGroups:
                shipGroups.append((groupName, groupID))

        if len(fittings) == 0 and self.wordFilter is not None:
            data = {'label': localization.GetByLabel('UI/Common/NothingFound')}
            scrolllist.append(listentry.Get('Generic', data))
        if hideRight is None:
            self.HideRightPanel()
        shipGroups.sort()
        if maxFittings is not None:
            label = localization.GetByLabel(
                'UI/Fitting/FittingWindow/FittingManagement/FittingsListHeader',
                numFittings=len(fittings),
                maxFittings=maxFittings)
            scrolllist.append(listentry.Get('Header', {'label': label}))
        for groupName, groupID in shipGroups:
            data = {
                'GetSubContent': self.GetShipGroupSubContent,
                'label': groupName,
                'fittings': fittingsByGroupID[groupID],
                'groupItems': fittingsByGroupID[groupID],
                'id': ('fittingMgmtScrollWndGroup', groupName),
                'showicon': 'hide',
                'state': 'locked',
                'BlockOpenWindow': 1
            }
            scrolllist.append(listentry.Get('Group', data))

        self.sr.scroll.Load(contentList=scrolllist, scrolltotop=0)
Example #14
0
    def RenderOtherCharactersNetwork(self, charid):
        linkColor = (0.0, 1.0, 1.0, 1.0)
        linkBgColor = (0.0, 0.0, 0.0, 0.3)
        pins, links = self.GetOtherCharactersNetwork(charid)
        self.HideOtherCharactersNetwork()
        for pinData in pins:
            if evetypes.GetGroupID(pinData.typeID) == const.groupCommandPins:
                self.currentOtherExpandedCommandPin = self.otherPlayerPinsByPinID[pinData.pinID]
                self.currentOtherExpandedCommandPin.RenderAsActive()
                continue
            sp = SurfacePoint(theta=pinData.longitude, phi=pinData.latitude)
            pin = OtherPlayersPin(sp, pinData.pinID, pinData.typeID, pinData.ownerID, self.planetUISvc.pinOthersTransform, isActive=True)
            self.otherPlayerVisiblePins.append(pin)
            self.otherPlayerPinsByPinID[pinData.pinID] = pin

        for link in links:
            sp1 = self.otherPlayerPinsByPinID[link[0]].surfacePoint
            sp2 = self.otherPlayerPinsByPinID[link[1]].surfacePoint
            length = sp1.GetDistanceToOther(sp2)
            texWidth = 600.0 * length
            lineID = self.planetUISvc.curveLineDrawer.DrawArc('otherLinks', sp1, sp2, 5.0, linkBgColor, linkBgColor)
            numSegments = max(1, int(length * 25.0))
            self.planetUISvc.curveLineDrawer.SetLineSetNumSegments('otherLinks', lineID, numSegments)
            self.planetUISvc.curveLineDrawer.ChangeLineAnimation('otherLinks', lineID, linkColor, 0.0, texWidth)

        self.planetUISvc.curveLineDrawer.SubmitLineset('otherLinks')
Example #15
0
def DeployItem(charID, corpID, shipItem, deployableItem, ownerID, radius,
               ballpark, allianceRegistry, spaceComponentStaticData,
               deployAction):
    CheckOwnerRestrictions(spaceComponentStaticData, deployableItem.typeID,
                           corpID, allianceRegistry)
    errors = []
    pos = None
    groupID = evetypes.GetGroupID(deployableItem.typeID)
    forbidOverlap = groupID in [
        groupInfrastructureHub, groupSovereigntyClaimMarkers
    ]
    for pos in IterViablePositions(shipItem.itemID, deployableItem.typeID,
                                   radius, spaceComponentStaticData, ballpark):
        try:
            CheckLaunchRestrictions(shipItem.itemID, spaceComponentStaticData,
                                    pos, radius, deployableItem.typeID,
                                    ballpark, forbidOverlap)
            break
        except UserError as e:
            errors.append(e)

    else:
        if errors:
            raise errors[0]

    if pos is None:
        raise RuntimeError('IterViablePositions yielded no results')
    return deployAction(charID, shipItem.itemID, deployableItem,
                        deployableItem.itemID, ownerID, shipItem, pos)
Example #16
0
    def LoadT3Ship(self):
        modules = self.typeData.get('slimItem').modules
        subsystems = {}
        self._LockT3Loading()
        self.loadingModel = True
        oldModel = self.model
        try:
            for _, typeID, _ in modules:
                if evetypes.GetCategoryID(typeID) == const.categorySubSystem:
                    subsystems[evetypes.GetGroupID(typeID)] = typeID

            t3ShipSvc = self.sm.GetService('t3ShipSvc')
            model = t3ShipSvc.GetTech3ShipFromDict(self.typeID, subsystems, self.typeData.get('sofRaceName', None))
            if self.released:
                return
            if model is not None:
                SpaceObject.LoadModel(self, None, loadedModel=model)
                self.Assemble()
            self.Display(1)
        finally:
            self.loadingModel = False
            self._UnlockT3Loading()

        if oldModel is not None:
            self.RemoveAndClearModel(oldModel)
    def GetContentsList(self, itemID, hasFlag, stationID, invCacheSvc):
        contents = invCacheSvc.GetInventoryMgr().GetContainerContents(
            itemID, stationID)
        lst = []
        for c in contents:
            flag = c.flagID
            if flag == const.flagPilot:
                continue
            locationName = GetShipFlagLocationName(flag)
            typeName = evetypes.GetName(c.typeID)
            groupID = evetypes.GetGroupID(c.typeID)
            if hasFlag:
                txt = '%s<t>%s<t>%s<t><right>%s' % (
                    typeName, evetypes.GetGroupNameByGroup(groupID),
                    locationName, c.stacksize)
            else:
                txt = '%s<t>%s<t><right>%s' % (
                    typeName, evetypes.GetGroupNameByGroup(groupID),
                    c.stacksize)
            data = {
                'label': txt,
                'typeID': c.typeID,
                'itemID': c.itemID,
                'getIcon': True
            }
            entry = listentry.Get(entryType='Item', data=data)
            lst.append(entry)

        return lst
Example #18
0
    def GetShipsAndGroups(self, filterTextLower, fittings):
        fittingsByGroupID = defaultdict(list)
        fittingsByGroupAndRaceIDs = defaultdict(lambda: defaultdict(set))
        if not fittings:
            shipGroups, shipsByGroupID, shipsByGroupAndRaceIDs = self.GetAllShipGroupsAndShipsByGroupID(
                filterTextLower)
        else:
            shipGroups = set()
            shipsByGroupID = defaultdict(set)
            shipsByGroupAndRaceIDs = defaultdict(lambda: defaultdict(set))
        for fittingID, fitting in fittings.iteritems():
            shipTypeID = fitting.shipTypeID
            if not evetypes.Exists(shipTypeID):
                log.LogError(
                    'Ship in stored fittings does not exist, shipID=%s, fittingID=%s'
                    % (shipTypeID, fittingID))
                continue
            groupID = evetypes.GetGroupID(shipTypeID)
            fittingsByGroupID[groupID].append(fitting)
            groupName = evetypes.GetGroupName(shipTypeID)
            shipGroups.add((groupName, groupID))
            raceID = evetypes.GetRaceID(shipTypeID)
            shipsByGroupAndRaceIDs[groupID][raceID].add(shipTypeID)
            fittingsByGroupAndRaceIDs[groupID][raceID].add(fitting)

        return (fittingsByGroupID, shipsByGroupID, shipGroups,
                shipsByGroupAndRaceIDs, fittingsByGroupAndRaceIDs)
Example #19
0
 def __init__(self,
              eventHandler,
              typeID,
              endpointPin1,
              endpointPin2,
              level=0):
     if not isinstance(eventHandler,
                       weakref.ProxyType) and eventHandler is not None:
         self.eventHandler = weakref.proxy(eventHandler)
     else:
         self.eventHandler = eventHandler
     self.typeID = typeID
     if evetypes.GetGroupID(typeID) != const.groupPlanetaryLinks:
         raise RuntimeError('Link created with invalid type ID', typeID)
     if endpointPin1 is None or endpointPin2 is None:
         raise RuntimeError('Link created with invalid endpoints',
                            endpointPin1, endpointPin2)
     if endpointPin1.id > endpointPin2.id:
         raise RuntimeError(
             'Data Integrity Error: Endpoint 1 must have pin ID lower than Endpoint 2',
             endpointPin1.id, endpointPin2.id)
     self.endpoint1 = weakref.proxy(endpointPin1)
     self.endpoint2 = weakref.proxy(endpointPin2)
     self.routesTransiting = []
     self.SetLinkLevel(level)
     self.bandwidthUsage = 0.0
     self.editModeLink = False
Example #20
0
 def PreviewType(self, typeID, **kwargs):
     if not IsPreviewable(typeID):
         raise InvalidPreviewType('%s (%s) is not previewable' %
                                  (evetypes.GetName(typeID), typeID))
     groupID = evetypes.GetGroupID(typeID)
     categoryID = evetypes.GetCategoryIDByGroup(groupID)
     if IsModularShip(typeID):
         return self.PreviewTech3Ship(typeID,
                                      subsystems=kwargs.get('subsystems'),
                                      scenePath=kwargs.get('scenePath'))
     if categoryID == invconst.categoryApparel:
         return self.PreviewApparel(typeID,
                                    gender=kwargs.get('gender'),
                                    background=kwargs.get('background'))
     if groupID in invconst.turretModuleGroups:
         return self.PreviewTurret(typeID,
                                   scenePath=kwargs.get('scenePath'))
     if groupID in invconst.turretAmmoGroups:
         return self.PreviewAmmo(typeID, scenePath=kwargs.get('scenePath'))
     if groupID == invconst.groupShipSkins or categoryID == invconst.categoryShip:
         controller = kwargs.get('controller')
         if controller is None:
             return self.PreviewSkin(typeID,
                                     scenePath=kwargs.get('scenePath'))
         else:
             return self.PreviewSkinnedEntity(
                 typeID,
                 controller=kwargs.get('controller'),
                 scenePath=kwargs.get('scenePath'))
     else:
         return self.PreviewSpaceEntity(typeID,
                                        itemID=kwargs.get('itemID'),
                                        scenePath=kwargs.get('scenePath'))
Example #21
0
 def OpenSubscriptionPage(self, *args):
     shipTree = sm.GetService('shipTree')
     shipTypeID = first(
         shipTree.GetShipTypeIDs(self.node.factionID,
                                 self.node.shipGroupID))
     shipGroupID = evetypes.GetGroupID(shipTypeID)
     shipTree.OpenSubscriptionPage(['ship', shipGroupID])
Example #22
0
def CheckCanFitType(dogmaLocation, typeID, locationID):
    maxGroupFitted = dogmaLocation.dogmaStaticMgr.GetTypeAttribute(
        typeID, const.attributeMaxGroupFitted)
    if maxGroupFitted:
        groupID = evetypes.GetGroupID(typeID)
        modulesByGroup = dogmaLocation.GetModuleListByShipGroup(
            locationID, groupID)
        if len(modulesByGroup) >= maxGroupFitted:
            shipItem = dogmaLocation.dogmaItems[locationID]
            raise UserError(
                'CantFitTooManyByGroup', {
                    'ship': shipItem.typeID,
                    'module': typeID,
                    'groupName': evetypes.GetGroupName(typeID),
                    'noOfModules': int(maxGroupFitted),
                    'noOfModulesFitted': len(modulesByGroup)
                })
    maxTypeFitted = dogmaLocation.dogmaStaticMgr.GetTypeAttribute(
        typeID, const.attributeMaxTypeFitted)
    if maxTypeFitted:
        modulesByType = dogmaLocation.GetModuleListByShipType(
            locationID, typeID)
        if len(modulesByType) >= maxTypeFitted:
            shipItem = dogmaLocation.dogmaItems[locationID]
            raise UserError(
                'CantFitTooManyByType', {
                    'ship': shipItem.typeID,
                    'module': typeID,
                    'noOfModules': int(maxTypeFitted),
                    'noOfModulesFitted': len(modulesByType)
                })
Example #23
0
def GetReprocessingOptions(types):
    options = []
    optionTypes = {}
    noneTypes = [const.typeCredits, const.typeBookmark, const.typeBiomass]
    noneGroups = [const.groupRookieship, const.groupMineral]
    noneCategories = [const.categoryBlueprint, const.categoryReaction]
    for key in types.iterkeys():
        typeID = key
        isRecyclable = 0
        isRefinable = 0
        groupID = evetypes.GetGroupID(typeID)
        categoryID = evetypes.GetCategoryID(typeID)
        if typeID not in noneTypes and groupID not in noneGroups and categoryID not in noneCategories:
            if typeID in cfg.invtypematerials:
                materials = cfg.invtypematerials[typeID]
                if len(materials) > 0:
                    if categoryID == const.categoryAsteroid or groupID == const.groupHarvestableCloud:
                        isRefinable = 1
                    else:
                        isRecyclable = 1
        options.append(
            utillib.KeyVal(typeID=typeID,
                           isRecyclable=isRecyclable,
                           isRefinable=isRefinable))

    for option in options:
        optionTypes[option.typeID] = option

    return optionTypes
Example #24
0
def ItemLocationFlag(location):
    if location.typeID == const.typeOffice:
        return location.flagID
    if evetypes.GetCategoryID(location.typeID) == const.categoryStarbase:
        return location.flagID
    if evetypes.GetGroupID(location.typeID) == const.groupStation:
        return location.flagID
Example #25
0
 def ValidateCreatePin(self, charID, typeID, latitude, longitude):
     if self.colonyData is None:
         raise RuntimeError(
             'Unable to validate pin creation - no colony data')
     self.PreValidateCreatePin(charID, typeID, latitude, longitude)
     if evetypes.GetGroupID(typeID) == const.groupCommandPins:
         if self.colonyData.commandPin is not None:
             raise UserError('CannotBuildMultipleCommandPins')
     elif self.colonyData.commandPin is None:
         raise UserError('CannotManagePlanetWithoutCommandCenter')
     t = GetPinEntityType(typeID)
     if t is None:
         raise UserError('InvalidPinType')
     planetTypeRestriction = self.GetTypeAttribute(
         typeID, const.attributePlanetRestriction)
     if planetTypeRestriction is not None and planetTypeRestriction != self.planet.GetPlanetTypeID(
     ):
         raise UserError('CannotCreatePinWrongPlanetType')
     cpuUsage = self.GetTypeAttribute(typeID, const.attributeCpuLoad)
     cpuOutput = self.GetTypeAttribute(typeID, const.attributeCpuOutput)
     powerUsage = self.GetTypeAttribute(typeID, const.attributePowerLoad)
     powerOutput = self.GetTypeAttribute(typeID, const.attributePowerOutput)
     if cpuOutput <= 0 and cpuUsage + self.colonyData.GetColonyCpuUsage(
     ) > self.colonyData.GetColonyCpuSupply():
         raise UserError('CannotAddToColonyCPUUsageExceeded',
                         {'typeName': evetypes.GetName(typeID)})
     if powerOutput <= 0 and powerUsage + self.colonyData.GetColonyPowerUsage(
     ) > self.colonyData.GetColonyPowerSupply():
         raise UserError('CannotAddToColonyPowerUsageExceeded',
                         {'typeName': evetypes.GetName(typeID)})
     self.PostValidateCreatePin(charID, typeID, latitude, longitude)
Example #26
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)
Example #27
0
    def InitializeData(self):
        for typeID in evetypes.Iterate():
            self.typeData[typeID] = (evetypes.GetGroupID(typeID),
                                     evetypes.GetCategoryID(typeID),
                                     evetypes.GetRaceID(typeID))

        self.blueprints = industry.BlueprintStorage()
Example #28
0
 def IsShipTooBigToAnimate(self, typeID):
     if self.GetCurrHangarType() == CITADEL_CAPITAL_HANGAR_SIZE:
         return False
     groupID = evetypes.GetGroupID(typeID)
     return groupID in (invconst.groupSupercarrier,
      invconst.groupTitan,
      invconst.groupDreadnought,
      invconst.groupForceAux)
 def OnItemChange(self, item=None, change=None):
     locationIdx = const.ixLocationID
     if session.shipid not in (item[locationIdx],
                               change.get(locationIdx,
                                          'No location change')):
         return
     if evetypes.GetGroupID(item.typeID) == const.groupCommandPins:
         self.ResetBuildbuttons()
Example #30
0
 def GetMenu(self, *args):
     if isinstance(self.sr.node.invtype, tuple):
         typeID = self.sr.node.invtype[0]
     else:
         typeID = self.sr.node.invtype
     groupID = evetypes.GetGroupID(typeID)
     catID = evetypes.GetCategoryIDByGroup(groupID)
     graphicID = evetypes.GetGraphicID(typeID)
     graphicFileMenu = []
     if evetypes.Exists(typeID) and evetypes.GetGraphicID(
             typeID) is not None:
         graphic = GetGraphic(evetypes.GetGraphicID(typeID))
         if graphic is not None:
             graphicFile = GetGraphicFile(graphic)
             graphicFileMenu = [
                 [
                     'Copy graphicID (%s)' % graphicID,
                     lambda *x: blue.pyos.SetClipboardData(str(graphicID)),
                     ()
                 ],
                 [
                     'Copy graphicFile (%s)' % graphicFile,
                     lambda *x: blue.pyos.SetClipboardData(graphicFile), ()
                 ]
             ]
     averagePrice = inventorycommon.typeHelpers.GetAveragePrice(typeID)
     if averagePrice is None:
         averagePrice = 'n/a'
     else:
         averagePrice = util.FmtISK(averagePrice)
     menu = [[
         'Preview', lambda *x: uthread.new(
             sm.StartService('preview').PreviewType, typeID), ()
     ]]
     menu += graphicFileMenu
     menu += [[
         'Copy typeID (%s)' % typeID,
         lambda *x: blue.pyos.SetClipboardData(str(typeID)), ()
     ],
              [
                  'Copy groupID (%s)' % groupID,
                  lambda *x: blue.pyos.SetClipboardData(str(groupID)), ()
              ],
              [
                  'Copy categoryID (%s)' % catID,
                  lambda *x: blue.pyos.SetClipboardData(str(catID)), ()
              ],
              [
                  'Average price: %s' % averagePrice,
                  lambda *x: blue.pyos.SetClipboardData(averagePrice), ()
              ],
              [
                  'View market details', lambda *x: uthread.new(
                      sm.StartService('marketutils').ShowMarketDetails,
                      typeID, None), ()
              ], None]
     menu += sm.GetService('menu').GetGMTypeMenu(typeID)
     return menu