Beispiel #1
0
 def GetColumnSortValues(jobData, jumps):
     if jobData.facilityID == session.stationid2 or jobData.solarSystemID == session.solarsystemid:
         jumps = -1
     if IsPersonalJob(jobData.ownerID):
         return (jobData.status,
          (-jobData.status, jobData.endDate),
          jobData.runs,
          jobData.activityID,
          evetypes.GetName(jobData.blueprint.blueprintTypeID),
          jumps,
          sm.GetService('map').GetSecurityStatus(jobData.solarSystemID),
          jobData.GetFacilityName(),
          jobData.startDate,
          jobData.endDate)
     else:
         return (jobData.status,
          (-jobData.status, jobData.endDate),
          jobData.runs,
          jobData.activityID,
          evetypes.GetName(jobData.blueprint.blueprintTypeID),
          jumps,
          sm.GetService('map').GetSecurityStatus(jobData.solarSystemID),
          jobData.GetFacilityName(),
          jobData.GetInstallerName(),
          jobData.startDate,
          jobData.endDate)
    def GoForTransfer(self, *args):
        if len(self.transferContents) < 1:
            raise UserError('PleaseSelectCommoditiesToTransfer')
        for typeID, quantity in self.transferContents.iteritems():
            if typeID not in self.sourcePin.contents:
                raise UserError(
                    'RouteFailedValidationExpeditedSourceLacksCommodity',
                    {'typeName': evetypes.GetName(typeID)})
            if quantity > self.sourcePin.contents[typeID]:
                raise UserError(
                    'RouteFailedValidationExpeditedSourceLacksCommodityQty', {
                        'typeName': evetypes.GetName(typeID),
                        'qty': quantity
                    })

        if not self.sourcePin.CanTransfer(self.transferContents):
            raise UserError('RouteFailedValidationExpeditedSourceNotReady')
        if len(self.transferContents) > 0:
            self.ShowLoad()
            try:
                self.planet.TransferCommodities(self.path,
                                                self.transferContents)
            finally:
                self.ResetPinContents()
                self.HideLoad()

            self.CloseByUser()
Beispiel #3
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)
Beispiel #4
0
    def RepairItems(self, items):
        totalcost = 0
        hasModule = False
        for item in items:
            damage = math.ceil(item.damage)
            totalcost = totalcost + math.ceil(
                item.damage) * item.costToRepairOneUnitOfDamage
            categoryID = evetypes.GetCategoryIDByGroup(item.groupID)
            if IsFittingModule(categoryID):
                hasModule = True

        btnSetup = {
            self.sr.selBtn: uiconst.UI_HIDDEN,
            self.sr.pickBtn: uiconst.UI_NORMAL
        }
        if hasModule:
            if eve.Message('RepairNonPartialConfirmation',
                           {'isk': util.FmtISK(totalcost)},
                           uiconst.YESNO) != uiconst.ID_YES:
                amount = None
            else:
                amount = {'qty': totalcost}
        else:
            amount = uix.QtyPopup(totalcost,
                                  0,
                                  totalcost,
                                  hint=localization.GetByLabel(
                                      'UI/Station/Repair/FullRepair',
                                      isk=totalcost),
                                  label=localization.GetByLabel(
                                      'UI/Station/Repair/RepairCostLabel'),
                                  digits=2)
        if amount is not None:
            itemIDs = []
            try:
                for item in items:
                    if self.invCache.IsItemLocked(item.itemID):
                        raise UserError(
                            'ItemLocked',
                            {'item': evetypes.GetName(item.typeID)})
                    if not self.invCache.TryLockItem(
                            item.itemID, 'lockUnassemblingItem', {}, 1):
                        raise UserError(
                            'ItemLocked',
                            {'item': evetypes.GetName(item.typeID)})
                    itemIDs.append(item.itemID)

                if len(itemIDs):
                    self.repairSvc.RepairItems(itemIDs, amount['qty'])
            finally:
                for itemID in itemIDs:
                    self.invCache.UnlockItem(itemID)

                sm.ScatterEvent('OnRepairDone', itemIDs)
                uthread.new(self.DisplayRepairQuote, self.GetAll())

        else:
            btnSetup[self.sr.repairAllBtn] = uiconst.UI_NORMAL
        self.DisplayButtons(btnSetup)
Beispiel #5
0
def GetGenericPinName(typeID, itemID):
    if isinstance(itemID, tuple):
        return localization.GetByLabel('UI/PI/Common/PinNameNew',
                                       pinName=evetypes.GetName(typeID))
    else:
        return localization.GetByLabel('UI/PI/Common/PinNameAndID',
                                       pinName=evetypes.GetName(typeID),
                                       pinID=ItemIDToPinDesignator(itemID))
Beispiel #6
0
 def Compare(x, y):
     typeID1, level1 = x
     typeID2, level2 = y
     if level1 != level2:
         return level2 - level1
     typeName1 = evetypes.GetName(typeID1)
     typeName2 = evetypes.GetName(typeID2)
     if typeName1 > typeName2:
         return 1
     else:
         return -1
Beispiel #7
0
    def ValidateExpeditedTransfer(self, charID, path, commodities, runTime):
        if self.colonyData is None:
            raise RuntimeError(
                'Unable to validate expedited transfer - no colony data')
        self.PreValidateExpeditedTransfer(path, commodities, runTime)
        if len(path) < 2:
            raise UserError('CreateRouteTooShort')
        if len(commodities) < 1:
            raise UserError('CreateRouteWithoutCommodities')
        sourcePin = self.GetPin(path[0])
        destinationPin = self.GetPin(path[-1])
        if not sourcePin.IsStorage():
            raise UserError('RouteFailedValidationExpeditedSourceNotStorage')
        for typeID, quantity in commodities.iteritems():
            if typeID not in sourcePin.contents:
                raise UserError(
                    'RouteFailedValidationExpeditedSourceLacksCommodity',
                    {'typeName': evetypes.GetName(typeID)})
            if quantity > sourcePin.contents[typeID]:
                raise UserError(
                    'RouteFailedValidationExpeditedSourceLacksCommodityQty', {
                        'typeName': evetypes.GetName(typeID),
                        'qty': quantity
                    })
            if destinationPin.CanAccept(typeID, quantity) < 1:
                raise UserError(
                    'RouteFailedValidationExpeditedDestinationCannotAccept',
                    {'typeName': evetypes.GetName(typeID)})

        minBandwidth = None
        prevID = None
        for pinID in path:
            pin = self.GetPin(pinID)
            if not pin:
                raise UserError('RouteFailedValidationPinDoesNotExist')
            if pin.ownerID != charID:
                raise UserError('RouteFailedValidationPinNotYours')
            if prevID is None:
                prevID = pinID
                continue
            link = self.GetLink(prevID, pinID)
            if link is None:
                raise UserError('RouteFailedValidationLinkDoesNotExist')
            if minBandwidth is None or link.GetTotalBandwidth() < minBandwidth:
                minBandwidth = link.GetTotalBandwidth()
            prevID = pinID

        if minBandwidth is None or minBandwidth < 0.0:
            log.LogTraceback('Path traversed link with no bandwidth')
            raise UserError('RouteFailedValidationNoBandwidthAvailable')
        if not sourcePin.CanTransfer(commodities, runTime):
            raise UserError('RouteFailedValidationExpeditedSourceNotReady')
        self.PostValidateExpeditedTransfer(path, commodities, runTime)
        return minBandwidth
Beispiel #8
0
    def LoadProductScroll(self):
        scrolllist = []
        colony = self.planetUISvc.planet.GetColony(session.charid)
        if colony is None or colony.colonyData is None:
            raise RuntimeError(
                'Cannot load product scroll for pin on a planet that has no colony'
            )
        sourcedRoutes = colony.colonyData.GetSourceRoutesForPin(self.pin.id)
        routesByTypeID = {}
        for route in sourcedRoutes:
            typeID = route.GetType()
            if typeID not in routesByTypeID:
                routesByTypeID[typeID] = []
            routesByTypeID[typeID].append(route)

        for typeID, amount in self.pin.GetProductMaxOutput().iteritems():
            typeName = evetypes.GetName(typeID)
            for route in routesByTypeID.get(typeID, []):
                qty = route.GetQuantity()
                amount -= qty
                data = util.KeyVal(
                    label='%s<t>%s<t>%s' %
                    (qty, typeName,
                     localization.GetByLabel('UI/PI/Common/Routed')),
                    typeID=typeID,
                    itemID=None,
                    getIcon=True,
                    routeID=route.routeID,
                    OnMouseEnter=self.OnRouteEntryHover,
                    OnMouseExit=self.OnRouteEntryExit,
                    OnClick=self.OnProductEntryClicked,
                    OnDblClick=self.OnProductEntryDblClicked)
                scrolllist.append(listentry.Get('Item', data=data))

            if amount > 0:
                data = util.KeyVal()
                data.label = '%s<t>%s<t>%s' % (amount, evetypes.GetName(
                    typeID), localization.GetByLabel('UI/PI/Common/NotRouted'))
                data.typeID = typeID
                data.amount = amount
                data.itemID = None
                data.getIcon = True
                data.OnClick = self.OnProductEntryClicked
                data.OnDblClick = self.OnProductEntryDblClicked
                scrolllist.append(listentry.Get('Item', data=data))

        self.productScroll.Load(
            contentList=scrolllist,
            noContentHint=localization.GetByLabel(
                'UI/PI/Common/NoProductsPresent'),
            headers=[
                localization.GetByLabel('UI/Common/Amount'),
                localization.GetByLabel('UI/PI/Common/Type'), ''
            ])
Beispiel #9
0
 def ValidateCreateLink(self,
                        charID,
                        endpoint1ID,
                        endpoint2ID,
                        linkTypeID,
                        level=0):
     if self.colonyData is None:
         raise RuntimeError(
             'Unable to validate link creation - no colony data')
     if endpoint1ID > endpoint2ID:
         endpoint1ID, endpoint2ID = endpoint2ID, endpoint1ID
     self.PreValidateCreateLink(charID, endpoint1ID, endpoint2ID,
                                linkTypeID, level)
     if self.colonyData.commandPin is None:
         raise UserError('CannotManagePlanetWithoutCommandCenter')
     link = self.GetLink(endpoint1ID, endpoint2ID)
     if link is not None:
         raise UserError('LinkAlreadyExists')
     pin1 = self.GetPin(endpoint1ID)
     pin2 = self.GetPin(endpoint2ID)
     if not pin1 or not pin2:
         raise UserError('PinDoesNotExist')
     if pin1.ownerID != charID or pin2.ownerID != charID:
         raise UserError('CanOnlyManageOwnPins')
     if pin1 == pin2 or endpoint1ID == endpoint2ID:
         raise UserError('CannotLinkPinsToThemselves')
     if not pin1.CanLinkTo(pin2) or not pin2.CanLinkTo(pin1):
         raise UserError(
             'CannotLinkPins', {
                 'parent': (const.UE_TYPEID, pin1.typeID),
                 'child': (const.UE_TYPEID, pin2.typeID)
             })
     linkLength = GetDistanceBetweenPins(pin1, pin2, self.GetPlanetRadius())
     params = GetUsageParametersForLinkType(linkTypeID)
     addlCpuUsage = GetCpuUsageForLink(linkTypeID, linkLength, level,
                                       params)
     addlPowerUsage = GetPowerUsageForLink(linkTypeID, linkLength, level,
                                           params)
     if addlCpuUsage + self.colonyData.GetColonyCpuUsage(
     ) > self.colonyData.GetColonyCpuSupply():
         raise UserError('CannotAddToColonyCPUUsageExceeded',
                         {'typeName': evetypes.GetName(linkTypeID)})
     if addlPowerUsage + self.colonyData.GetColonyPowerUsage(
     ) > self.colonyData.GetColonyPowerSupply():
         raise UserError('CannotAddToColonyPowerUsageExceeded',
                         {'typeName': evetypes.GetName(linkTypeID)})
     self.PostValidateCreateLink(charID, endpoint1ID, endpoint2ID,
                                 linkTypeID, level)
    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
Beispiel #11
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     typeID = attributes.typeID
     qty = attributes.qty
     iconPadding = 1 * const.defaultPadding
     typeIcon = Icon(name='typeIcon',
                     parent=self,
                     state=uiconst.UI_NORMAL,
                     size=32,
                     left=iconPadding,
                     ignoreSize=True,
                     typeID=typeID)
     techIcon = uix.GetTechLevelIcon(typeID=typeID)
     if techIcon:
         techIcon.left = iconPadding
         techIcon.SetParent(self, idx=0)
     typeName = evetypes.GetName(typeID)
     link = '<url="showinfo:%s">%s</url>' % (typeID, typeName)
     text = '%sx %s' % (qty, link)
     left = iconPadding * 2 + typeIcon.width + 10
     label = EveLabelMedium(parent=self,
                            left=left,
                            text=text,
                            state=uiconst.UI_NORMAL,
                            align=uiconst.CENTERLEFT)
     self.width = label.left + label.textwidth + 10
Beispiel #12
0
    def LoadCounterTooltip(self,
                           tooltipPanel,
                           missingDict,
                           text,
                           singleGroupShowing=True):
        tooltipPanel.LoadGeneric1ColumnTemplate()
        tooltipPanel.state = uiconst.UI_NORMAL
        if singleGroupShowing:
            tooltipPanel.AddLabelLarge(text=text, padBottom=8)
        typeList = []
        for eachTypeID, eachQty in missingDict.iteritems():
            typeName = evetypes.GetName(eachTypeID)
            typeList.append((typeName.lower(), (eachTypeID, eachQty)))

        typeList = SortListOfTuples(typeList)
        for eachTypeID, eachQty in typeList[:MAX_TOOLTIP_ENTRIES]:
            typeCont = TooltipEntry(parent=tooltipPanel,
                                    typeID=eachTypeID,
                                    qty=eachQty)

        if len(typeList) > MAX_TOOLTIP_ENTRIES:
            numItemsNotDisplayed = len(typeList) - MAX_TOOLTIP_ENTRIES
            text = GetByLabel(
                'UI/Fitting/FittingWindow/FittingManagement/MoreItemTypesMissing',
                numMoreItems=numItemsNotDisplayed)
            tooltipPanel.AddLabelMedium(text=text, align=uiconst.CENTERLEFT)
        if singleGroupShowing:
            self.AddBuyAllBtn(tooltipPanel, missingDict)
Beispiel #13
0
 def GetPrerequisite(self, typeID):
     reqTypeID = sm.GetService('godma').GetTypeAttribute(
         typeID, const.attributeSovUpgradeRequiredUpgradeID)
     reqTypeName = None
     if reqTypeID != 0 and reqTypeID is not None:
         reqTypeName = evetypes.GetName(reqTypeID)
     return reqTypeName
Beispiel #14
0
def ExportTXT():
    txt = ''
    skills = sm.GetService('skills').GetSkills()
    for skillID in skills:
        txt += '%s=%d\n' % (evetypes.GetName(skillID),
                            skills[skillID].skillLevel)
    return txt
Beispiel #15
0
    def GetTypeSubContent(self, nodedata, newitems=0):
        scrolllist = []
        bp = sm.GetService('michelle').GetBallpark()
        for ballID, qty in nodedata.groupItems:
            try:
                dist = bp.DistanceBetween(eve.session.shipid, ballID)
            except:
                dist = 0
                import traceback
                traceback.print_exc()
                sys.exc_clear()

            data = util.KeyVal()
            data.label = evetypes.GetName(
                nodedata.typeID) + '<t>' + util.FmtAmt(
                    qty) + '<t>' + util.FmtDist(dist)
            data.itemID = ballID
            data.typeID = nodedata.typeID
            data.GetMenu = self.OnGetEntryMenu
            data.OnClick = self.OnEntryClick
            data.showinfo = 1
            data.isTarget = ballID in nodedata.currentTargetIDs
            data.sublevel = 1
            data.Set('sort_' + localization.GetByLabel('UI/Common/Distance'),
                     dist)
            data.Set('sort_' + localization.GetByLabel('UI/Common/Quantity'),
                     qty)
            entry = listentry.Get(None, data=data, decoClass=SurveyScanEntry)
            scrolllist.append(entry)

        return scrolllist
Beispiel #16
0
    def _GetScrollListFromTypeList(self,
                                   moduleTypeID,
                                   chargeTypeIDs,
                                   sublevel=0,
                                   isFavorite=False):
        scrolllist = []
        godma = sm.GetService('godma')
        for eachTypeID in chargeTypeIDs:
            label = evetypes.GetName(eachTypeID)
            data = KeyVal(label=label,
                          typeID=eachTypeID,
                          itemID=None,
                          getIcon=1,
                          OnDropData=self.onDropDataFunc,
                          OnDblClick=(self.dblClickFunc, moduleTypeID,
                                      eachTypeID),
                          sublevel=sublevel,
                          GetMenu=self._GetChargeMenu,
                          isFavorite=isFavorite,
                          ignoreRightClick=isFavorite)
            techLevel = godma.GetTypeAttribute(eachTypeID,
                                               const.attributeTechLevel)
            scrolllist.append(
                ((techLevel, label), listentry.Get('Item', data=data)))

        scrolllist = SortListOfTuples(scrolllist)
        return scrolllist
Beispiel #17
0
    def GetShipGroupSubContent(self, nodedata, *args):
        scrolllist = []
        fittingsByType = defaultdict(list)
        fittingNumByTypeID = nodedata.fittingNumByTypeID
        for fitting in nodedata.fittings:
            shipTypeID = fitting.shipTypeID
            if not evetypes.Exists(shipTypeID):
                log.LogError(
                    'Ship in stored fittings does not exist, shipID=%s, fittingID=%s'
                    % (shipTypeID, fitting.fittingID))
                continue
            fittingsByType[shipTypeID].append(fitting)

        allShips = nodedata.allShips
        for typeID in allShips:
            typeName = evetypes.GetName(typeID)
            numPersonal = fittingNumByTypeID[typeID][False]
            numCorp = fittingNumByTypeID[typeID][True]
            fittingsForType = fittingsByType.get(typeID, [])
            entry = self.GetShipTypeGroup(typeID, typeName, fittingsForType,
                                          numPersonal, numCorp)
            scrolllist.append((typeName, entry))

        scrolllist = SortListOfTuples(scrolllist)
        return scrolllist
Beispiel #18
0
 def UpdateFitting(self):
     if not self.controller.SlotExists() and not self.controller.GetModule(
     ):
         self.DisableSlot()
         return
     self.EnableSlot()
     self.SetDragState()
     self.PrepareUtilButtons()
     iconSize = int(self.SLOT_SIZE * GetScaleFactor())
     self.flagIcon.SetSize(iconSize, iconSize)
     if self.controller.GetModule():
         self.flagIcon.LoadIconByTypeID(self.controller.GetModule().typeID,
                                        ignoreSize=True)
     else:
         slotIcon = 'res:/UI/Texture/classes/Fitting/stationServiceSlot.png'
         self.flagIcon.LoadIcon(slotIcon, ignoreSize=True)
     if self.controller.GetModule():
         self.tooltipPanelClassInfo = TooltipModuleWrapper()
         modulehint = evetypes.GetName(self.controller.GetModuleTypeID())
         if not self.controller.SlotExists():
             modulehint = GetByLabel('UI/Fitting/SlotDoesNotExist')
         self.hint = modulehint
     else:
         self.tooltipPanelClassInfo = None
         self.hint = self._emptyHint
     self.Hilite(0)
     self.UpdateOnlineDisplay()
Beispiel #19
0
 def LoadScene(self, sceneContainer):
     sceneContainer.PrepareSpaceScene(maxPitch=0.0,
                                      scenePath=self.scenePath)
     model = trinity.Load(
         'res:/dx9/model/ship/IconPreview/PreviewAmmoShip.red')
     sceneContainer.AddToScene(model)
     ammoRedFile = inventorycommon.typeHelpers.GetGraphicFile(self.typeID)
     ammoRedFile = ammoRedFile[:-4] + '_hi' + ammoRedFile[-4:]
     ammo = trinity.Load(ammoRedFile)
     if ammo.__bluetype__ != 'trinity.EveMissile':
         raise InvalidPreviewType(
             '{%s (%s) is not a trinity.EveMissile' %
             (evetypes.GetName(self.typeID), self.typeID))
     warhead = ammo.warheads[0]
     floatHeight = ammo.boundingSphereRadius - ammo.boundingSphereCenter[2]
     floatHeight += 0.2 * ammo.boundingSphereRadius
     warhead.translation = (0.0, floatHeight, 0.0)
     warhead.rotation = geo2.QuaternionRotationAxis((1.0, 0.0, 0.0),
                                                    -0.5 * math.pi)
     warhead.startDataValid = True
     model.children.append(warhead)
     del warhead.children[:]
     reflection = warhead.CopyTo()
     reflection.translation = (0.0, -floatHeight, 0.0)
     reflection.rotation = geo2.QuaternionRotationAxis((1.0, 0.0, 0.0),
                                                       0.5 * math.pi)
     reflection.startDataValid = True
     model.children.append(reflection)
     boundingCenterY = ammo.boundingSphereRadius + 0.5 * floatHeight
     model.boundingSphereCenter = (0.0, boundingCenterY, 0.0)
     model.boundingSphereRadius = ammo.boundingSphereRadius + floatHeight
     SetupSpaceCamera(sceneContainer, model)
Beispiel #20
0
    def LoadScene(self, sceneContainer):
        sceneContainer.PrepareSpaceScene(maxPitch=0.0,
                                         scenePath=self.scenePath)
        model = trinity.Load(
            'res:/dx9/model/ship/IconPreview/PreviewTurretShip.red')
        turretSet = TurretSet.FitTurret(model,
                                        self.typeID,
                                        1,
                                        evetypes.GetSofFactionNameOrNone(
                                            self.typeID),
                                        checkSettings=False)
        if turretSet is None:
            raise RuntimeError('Failed to load preview for %s (%s)' %
                               (evetypes.GetName(self.typeID), self.typeID))
        boundingSphere = turretSet.turretSets[0].boundingSphere
        model.boundingSphereRadius = boundingSphere[3]
        model.boundingSphereCenter = boundingSphere[:3]
        if model.boundingSphereCenter[1] < 2.0:
            model.boundingSphereCenter = (boundingSphere[0], 2.0,
                                          boundingSphere[2])
        for turret in turretSet.turretSets:
            turret.bottomClipHeight = 0.0
            turret.FreezeHighDetailLOD()
            turret.ForceStateDeactive()
            turret.EnterStateIdle()

        sceneContainer.AddToScene(model)
        SetupSpaceCamera(sceneContainer, model)
Beispiel #21
0
def ApplyAurumToken(item, qty):
    if item.typeID == const.typePilotLicence and boot.region == 'optic':
        conversionRate = const.chinaPlex2AurExchangeRatio
    else:
        conversionRate = sm.GetService(
            'clientDogmaStaticSvc').GetTypeAttribute2(
                item.typeID, const.attributeAurumConversionRate)
    totalAurum = conversionRate * qty
    headerLabel = localization.GetByLabel(
        'UI/Menusvc/ConvertAurumQuestionHeader')
    bodyLabel = localization.GetByLabel('UI/Menusvc/ConvertAurumQuestionBody',
                                        typeName=evetypes.GetName(item.typeID),
                                        quantity=qty,
                                        totalAurum=totalAurum)
    if eve.Message('CustomQuestion', {
            'header': headerLabel,
            'question': bodyLabel
    },
                   uiconst.YESNO,
                   suppress=uiconst.ID_YES) != uiconst.ID_YES:
        return
    accountUrl = sm.GetService(
        'vgsService').GetStore().GetAccount().GetTransactionHref()
    if item.typeID == const.typePilotLicence:
        sm.GetService('invCache').GetInventoryMgr().ConvertPlexToCurrency(
            item.itemID, qty, accountUrl)
    else:
        sm.GetService('invCache').GetInventoryMgr().ConvertAurTokenToCurrency(
            item.itemID, qty, accountUrl)
    def RemoveCommodity(self, selected):
        toMove = {}
        if len(selected) == 1 and uicore.uilib.Key(uiconst.VK_SHIFT):
            typeID = selected[0].typeID
            typeName = evetypes.GetName(typeID)
            ret = uix.QtyPopup(
                self.transferContents[typeID], 1, 1, None,
                localization.GetByLabel('UI/PI/Common/QuantityToRemove',
                                        typeName=typeName))
            if ret and 'qty' in ret:
                toMove[typeID] = min(self.transferContents[typeID],
                                     max(1, ret['qty']))
        else:
            for entry in selected:
                toMove[entry.typeID] = self.transferContents[entry.typeID]

        for typeID, qty in toMove.iteritems():
            self.transferContents[typeID] -= qty
            if self.transferContents[typeID] <= 0:
                del self.transferContents[typeID]
            if typeID not in self.pinContents:
                self.pinContents[typeID] = 0
            self.pinContents[typeID] += qty

        self.RefreshLists()
    def AddCommodity(self, selected):
        toMove = {}
        if len(selected) == 1 and uicore.uilib.Key(uiconst.VK_SHIFT):
            typeID = selected[0].typeID
            typeName = evetypes.GetName(typeID)
            ret = uix.QtyPopup(
                self.pinContents[typeID], 1, 1, None,
                localization.GetByLabel('UI/PI/Common/QuantityToTransfer',
                                        typeName=typeName))
            if ret and 'qty' in ret:
                toMove[typeID] = min(self.pinContents[typeID],
                                     max(1, ret['qty']))
        else:
            for entry in selected:
                toMove[entry.typeID] = self.pinContents[entry.typeID]

        if self.destPin.IsConsumer():
            toMove = self._ApplyConsumerFilter(toMove)
            if not toMove:
                raise UserError('ConsumerCantAcceptCommodities')
        elif self.destPin.IsStorage():
            toMove = self._ApplyMaxAmountFilter(toMove)
        for typeID, qty in toMove.iteritems():
            self.pinContents[typeID] -= qty
            if self.pinContents[typeID] <= 0:
                del self.pinContents[typeID]
            if typeID not in self.transferContents:
                self.transferContents[typeID] = 0
            self.transferContents[typeID] += qty

        self.RefreshLists()
Beispiel #24
0
    def SetEntries(self, entries):
        scrolllist = []
        asteroidTypes = {}
        headers = [
            localization.GetByLabel('UI/Common/Ore'),
            localization.GetByLabel('UI/Common/Quantity'),
            localization.GetByLabel('UI/Common/Distance')
        ]
        for ballID, (typeID, qty) in entries.iteritems():
            if not asteroidTypes.has_key(typeID):
                asteroidTypes[typeID] = [(ballID, qty)]
            else:
                asteroidTypes[typeID].append((ballID, qty))

        currentTargets = self.targetSvc.GetTargets()
        scrolllist = []
        for asteroidType in asteroidTypes:
            data = {
                'GetSubContent': self.GetTypeSubContent,
                'label': evetypes.GetName(asteroidType),
                'id': ('TypeSel', asteroidType),
                'groupItems': asteroidTypes[asteroidType],
                'typeID': asteroidType,
                'showlen': 1,
                'sublevel': 0,
                'state': 'locked',
                'currentTargetIDs': currentTargets.keys()
            }
            scrolllist.append(listentry.Get('Group', data))

        scrolllist = localization.util.Sort(scrolllist, key=lambda x: x.label)
        self.sr.scroll.Load(contentList=scrolllist, headers=headers)
Beispiel #25
0
 def GetHint(self):
     hint = TreeDataInv.GetHint(self)
     typeName = evetypes.GetName(self.typeID)
     if hint:
         return typeName + hint
     else:
         return typeName
Beispiel #26
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)
Beispiel #27
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'))
Beispiel #28
0
 def ApplyAttributes(self, attributes):
     InfoBubble.ApplyAttributes(self, attributes)
     self.typeID = attributes.typeID
     self.caption.text = evetypes.GetName(self.typeID)
     self.icon = Icon(name='icon',
                      parent=self.iconCont,
                      pos=(0, 0, 80, 80),
                      typeID=self.typeID,
                      ignoreSize=True,
                      cursor=uiconst.UICURSOR_MAGNIFIER)
     self.icon.OnClick = self.OnIconClicked
     if self.typeID in cfg.infoBubbleTypeElements:
         self.ConstructElements(cfg.infoBubbleTypeElements[self.typeID])
     isTrialRestricted = sm.GetService('skills').IsTrialRestricted(
         self.typeID)
     if isTrialRestricted:
         TrialRestrictionButton(parent=self.mainContent,
                                align=uiconst.TOTOP,
                                padding=(0, 8, 0, 8),
                                callback=self.OpenSubscriptionPage,
                                message='UI/ShipTree/ShipTrialRestricted')
     TraitsContainer(parent=self.mainContent, typeID=self.typeID)
     price = inventorycommon.typeHelpers.GetAveragePrice(self.typeID) or 0
     text = GetByLabel('UI/Inventory/EstIskPrice',
                       iskString=FmtISKAndRound(price, False))
     Label(parent=self.topRightCont,
           text=text,
           align=uiconst.TOTOP,
           padTop=7)
     uicore.animations.FadeTo(self.icon, 1.5, 1.0, duration=0.6)
     self.AnimShow()
     sm.GetService('shipTree').LogIGS('HoverType')
Beispiel #29
0
 def LoadScene(self, sceneContainer):
     sceneContainer.PrepareSpaceScene(scenePath=self.scenePath)
     resFile = inventorycommon.typeHelpers.GetGraphicFile(self.typeID)
     modelDNA = None
     if evetypes.GetCategoryID(
             self.typeID) == invconst.categoryStation and self.itemID:
         stations = cfg.mapSolarSystemContentCache.npcStations
         npcStation = stations.get(self.itemID, None)
         if npcStation:
             graphicID = npcStation.graphicID
             modelDNA = gfxutils.BuildSOFDNAFromGraphicID(graphicID)
     if modelDNA is None:
         modelDNA = gfxutils.BuildSOFDNAFromTypeID(
             self.typeID, materialSetID=self.materialSetID)
     if modelDNA is not None:
         spaceObjectFactory = sm.GetService('sofService').spaceObjectFactory
         model = spaceObjectFactory.BuildFromDNA(modelDNA)
     else:
         model = trinity.Load(resFile)
     if model is None:
         raise InvalidPreviewType(
             '%s (%s) failed to load associated model' %
             (evetypes.GetName(self.typeID), self.typeID))
     if getattr(model, 'boosters', None) is not None:
         model.boosters = None
     if getattr(model, 'modelRotationCurve', None) is not None:
         model.modelRotationCurve = None
     if getattr(model, 'modelTranslationCurve', None) is not None:
         model.modelTranslationCurve = None
     SetupAnimations(model, self.typeID)
     model.FreezeHighDetailMesh()
     trinity.WaitForResourceLoads()
     sceneContainer.AddToScene(model)
     SetupSpaceCamera(sceneContainer, model)
Beispiel #30
0
 def CreateCurrentShipCont(self):
     self.shipCont.Flush()
     Frame(parent=self.shipCont, color=(1, 1, 1, 0.1))
     activeShip = GetActiveShip()
     clientDogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation()
     shipDogmaItem = clientDogmaLocation.GetShip()
     shipTypeID = shipDogmaItem.typeID
     icon = Icon(parent=self.shipCont,
                 pos=(0, 0, 40, 40),
                 ignoreSize=True,
                 state=uiconst.UI_DISABLED)
     if self.fittingSvc.IsShipSimulated():
         self.shipCont.OnClick = self.ExitSimulation
         icon.LoadIconByTypeID(shipTypeID)
     else:
         self.shipCont.OnClick = self.LoadCurrentShip
         hologramTexture = inventorycommon.typeHelpers.GetHoloIconPath(
             shipTypeID)
         icon.LoadTexture(hologramTexture)
     shipName = cfg.evelocations.Get(activeShip).name
     text = '%s<br>%s' % (evetypes.GetName(shipTypeID), shipName)
     self.shipnametext = EveLabelMedium(text=text,
                                        parent=self.shipCont,
                                        align=uiconst.TOTOP,
                                        top=2,
                                        padLeft=48)