Example #1
0
    def GetBoosterEffectsInfo(self, effects, isNegative=False):
        dogmaLM = sm.GetService('clientDogmaIM').GetDogmaLocation()
        effectsTextList = []
        for eff in effects:
            if eff.modifierInfo:
                modifyingAttributeID = yaml.safe_load(
                    eff.modifierInfo)[0]['modifyingAttributeID']
                effectAmount = dogmaLM.dogmaStaticMgr.GetTypeAttribute(
                    self.booster.typeID, modifyingAttributeID)
                if isNegative and effectAmount:
                    neurotoxinControlTypeID = 25538
                    boosterAttributeModifier = 1126
                    neurotoxinControlSkill = sm.GetService('skills').GetSkill(
                        neurotoxinControlTypeID)
                    effectModifier = dogmaLM.dogmaStaticMgr.GetSkillModifiedAttributePercentageValue(
                        modifyingAttributeID, boosterAttributeModifier,
                        neurotoxinControlTypeID, neurotoxinControlSkill)
                    effectAmount *= effectModifier
                attributes = cfg.dgmattribs.Get(modifyingAttributeID)
                effectText = localization.GetByLabel(
                    'UI/Crimewatch/Timers/BoosterPenaltyWithValue',
                    value=GetFormatAndValue(attributes, abs(effectAmount)),
                    penaltyName=attributes.displayName)
            else:
                effectText = eff.displayName
            effectsTextList.append(effectText)

        return effectsTextList
Example #2
0
 def SetRechargeText(self, shipID, maxcap, multiplyCapacitor,
                     rechargeMultiply, xtraCapacitor):
     rechargeRate = GetShipAttribute(
         shipID, dogmaConst.attributeRechargeRate) * rechargeMultiply
     capText = GetByLabel(
         'UI/Fitting/FittingWindow/CapacitorCapAndRechargeTime',
         capacitorCapacity=GetFormatAndValue(self.capCapacityAttribute,
                                             int(maxcap)),
         capacitorRechargeTime=GetFormatAndValue(self.rechargeRateAttribute,
                                                 rechargeRate),
         startColorTag1='<color=%s>' %
         hex(GetColor2(xtraCapacitor, multiplyCapacitor)),
         startColorTag2='<color=%s>' %
         hex(GetMultiplyColor2(rechargeMultiply)),
         endColorTag='</color>')
     self.capAndRechargeLabel.text = capText
Example #3
0
 def SetRechargeText(self):
     maxCapInfo = self.controller.GetCapacitorCapacity()
     maxCapFormattedValue = GetFormatAndValue(self.capCapacityAttribute,
                                              int(maxCapInfo.value))
     maxCapText = GetColoredText(isBetter=maxCapInfo.isBetterThanBefore,
                                 text=maxCapFormattedValue)
     rechargeRate = self.controller.GetCapRechargeRate()
     rechargeFormattedValue = GetFormatAndValue(self.rechargeRateAttribute,
                                                int(rechargeRate.value))
     rechargeRateText = GetColoredText(
         isBetter=rechargeRate.isBetterThanBefore,
         text=rechargeFormattedValue)
     capText = GetByLabel(
         'UI/Fitting/FittingWindow/CapacitorCapAndRechargeTime',
         capacitorCapacity=maxCapText,
         capacitorRechargeTime=rechargeRateText,
         startColorTag1='',
         startColorTag2='',
         endColorTag='')
     self.capAndRechargeLabel.text = capText
Example #4
0
 def _UpdateInfoCont(self):
     if self.pin.depositType is not None and self.pin.depositQtyPerCycle > 0:
         timeToDepletion = self.pin.GetTimeToDepletion()
         totalTimeLeft = timeToDepletion
         self.timeToDeplTxt.SetCaption(
             localization.GetByLabel('UI/PI/Common/TimeToDepletion'))
         if totalTimeLeft < const.DAY:
             totalTimeLeft = util.FmtTime(float(totalTimeLeft))
         else:
             totalTimeLeft = util.FmtTimeInterval(long(totalTimeLeft),
                                                  breakAt='hour')
         deposName = evetypes.GetName(self.pin.depositType)
         if self.pin.activityState < basePin.STATE_IDLE:
             currCycle = 0
             currCycleProportion = 0.0
             cycleTime = 0
         else:
             currCycle = blue.os.GetWallclockTime() - self.pin.lastRunTime
             currCycleProportion = currCycle / float(
                 self.pin.GetCycleTime())
             cycleTime = self.pin.GetCycleTime()
     else:
         currCycle = 0
         totalTimeLeft = util.FmtTime(0)
         currCycleProportion = 0.0
         cycleTime = 0
         deposName = localization.GetByLabel(
             'UI/PI/Common/NothingExtracted')
     self.currDepositTxt.SetIcon(self.pin.depositType)
     self.currDepositTxt.SetSubtext(deposName)
     self.depositsLeftTxt.SetSubtext(
         localization.GetByLabel('UI/PI/Common/UnitsAmount',
                                 amount=self.pin.depositQtyRemaining))
     if self.pin.IsInEditMode():
         self.currCycleGauge.SetSubText(
             localization.GetByLabel('UI/PI/Common/InactiveEditMode'))
         self.timeToDeplTxt.SetSubtext(
             localization.GetByLabel('UI/PI/Common/InactiveEditMode'))
     else:
         self.currCycleGauge.SetValueInstantly(currCycleProportion)
         self.timeToDeplTxt.SetSubtext(totalTimeLeft)
         self.currCycleGauge.SetSubText(
             localization.GetByLabel('UI/PI/Common/CycleTimeElapsed',
                                     currTime=long(currCycle),
                                     totalTime=long(cycleTime)))
     self.amountPerCycleTxt.SetSubtext(
         localization.GetByLabel('UI/PI/Common/UnitsAmount',
                                 amount=self.pin.depositQtyPerCycle))
     attr = cfg.dgmattribs.GetIfExists(const.attributeLogisticalCapacity)
     self.amountPerHourTxt.SetSubtext(
         GetFormatAndValue(attr, self.pin.GetOutputVolumePerHour()))
Example #5
0
    def GetCompareTypeInfoContentList(self):
        scrolllist = []
        headers, uniqueHeaders, treatedHeaders, initialHeaders = ([], [], [],
                                                                  [])
        if self.typeIDs:
            headers = [
                localization.GetByLabel('/Carbon/UI/Common/TypeName'),
                localization.GetByLabel('UI/Compare/MetaGroup')
            ]
            for typeRow in self.typeIDs:
                data = typeRow.copy()
                typeName = evetypes.GetName(typeRow.invtype)
                metaGroup = sm.GetService('info').GetMetaTypesFromTypeID(
                    typeRow.invtype, groupOnly=1)
                text = '%s<t>%s' % (typeName, metaGroup.metaGroupName)
                data.Set('sort_%s' % headers[0], typeName)
                data.Set('sort_%s' % headers[1], metaGroup.metaGroupID)
                attributeLoop = {}
                for each in self.attrDict:
                    if each.attributeID in self.attrDictChecked:
                        attributeLoop[each.attributeID] = each

                for each in self.attrDictIDs:
                    attribute = attributeLoop.get(each, None)
                    if not attribute:
                        continue
                    displayName = uiutil.ReplaceStringWithTags(
                        attribute.displayName)
                    value = None
                    if (displayName,
                            attribute.attributeID) not in uniqueHeaders:
                        uniqueHeaders.append(
                            (displayName, attribute.attributeID))
                    if attribute.attributeID == const.attributeBaseWarpSpeed:
                        GTA = sm.GetService('godma').GetTypeAttribute
                        typeID = typeRow.invtype
                        cmp = max(
                            GTA(typeID,
                                const.attributeBaseWarpSpeed,
                                defaultValue=1), 1.0)
                        cmp *= GTA(typeID,
                                   const.attributeWarpSpeedMultiplier,
                                   defaultValue=1)
                        cmp *= const.AU
                        value = cmp
                        taa = sm.GetService('info').GetBaseWarpSpeed(
                            typeRow.invtype)
                    else:
                        taa, value = self.GetAttributeValue(
                            attribute, typeRow.invtype)
                    if evetypes.GetCategoryID(
                            typeRow.invtype) == const.categoryCharge:
                        bsd, bad = sm.GetService('info').GetBaseDamageValue(
                            typeRow.invtype)
                        if attribute.displayName == localization.GetByLabel(
                                'UI/Compare/BaseShieldDamage'):
                            value = bsd[0]
                        elif attribute.displayName == localization.GetByLabel(
                                'UI/Compare/BaseArmorDamage'):
                            value = bad[0]
                    if value is not None:
                        data.Set('sort_%s' % displayName, value)
                    else:
                        data.Set('sort_%s' % displayName, taa)
                    if taa is None:
                        taa = localization.GetByLabel(
                            'UI/Generic/NotAvailableShort')
                    else:
                        taa = GetFormatAndValue(attribute, taa)
                    text += '<t>%s' % taa

                data.label = text
                data.getIcon = 1
                data.GetMenu = self.GetEntryMenu
                data.viewMode = 'details'
                data.ignoreRightClick = 1
                scrolllist.append(listentry.Get('Item', data=data))

            for header, attributeID in uniqueHeaders:
                if header in headers:
                    header = header + ' '
                headers.append(header)

            initialHeaders = headers
            treatedHeaders = []
            for each in initialHeaders:
                treatedHeaders.append(each.replace(' ', '<br>'))

        return (scrolllist, initialHeaders)
Example #6
0
    def OnRouteEntryClick(self, *args):
        selectedRoutes = self.routeScroll.GetSelected()
        if len(selectedRoutes) < 1:
            self.routeInfo.state = uiconst.UI_HIDDEN
            return
        selectedRouteData = selectedRoutes[0]
        selectedRoute = None
        colony = self.planetUISvc.GetCurrentPlanet().GetColony(session.charid)
        links = colony.colonyData.GetLinksForPin(self.pin.id)
        for linkedPinID in links:
            link = colony.GetLink(self.pin.id, linkedPinID)
            for routeID in link.routesTransiting:
                if routeID == selectedRouteData.routeID:
                    selectedRoute = route = colony.GetRoute(routeID)
                    break

        if selectedRoute is None or not evetypes.Exists(
                selectedRoute.GetType()):
            return
        if selectedRoute.GetSourcePinID() == self.pin.id:
            self.routeInfoSource.SetSubtext(
                localization.GetByLabel('UI/PI/Common/ThisStructure'))
        else:
            sourcePin = sm.GetService('planetUI').planet.GetPin(
                selectedRoute.GetSourcePinID())
            self.routeInfoSource.SetSubtext(
                planetCommon.GetGenericPinName(sourcePin.typeID, sourcePin.id))
        if selectedRoute.GetDestinationPinID() == self.pin.id:
            self.routeInfoDest.SetSubtext(
                localization.GetByLabel('UI/PI/Common/ThisStructure'))
        else:
            destPin = sm.GetService('planetUI').planet.GetPin(
                selectedRoute.GetDestinationPinID())
            self.routeInfoDest.SetSubtext(
                planetCommon.GetGenericPinName(destPin.typeID, destPin.id))
        routeTypeID = route.GetType()
        routeQty = route.GetQuantity()
        self.routeInfoType.SetSubtext(
            localization.GetByLabel('UI/PI/Common/ItemAmount',
                                    itemName=evetypes.GetName(routeTypeID),
                                    amount=int(routeQty)))
        bandwidthAttr = cfg.dgmattribs.Get(const.attributeLogisticalCapacity)
        self.routeInfoBandwidth.SetSubtext(
            GetFormatAndValue(bandwidthAttr,
                              selectedRoute.GetBandwidthUsage()))
        createRouteBtn = self.routeInfoBtns.GetBtnByLabel(
            localization.GetByLabel('UI/PI/Common/CreateRoute'))
        if createRouteBtn:
            if selectedRoute.GetDestinationPinID() == self.pin.id:
                createRouteBtn.state = uiconst.UI_NORMAL
            else:
                createRouteBtn.state = uiconst.UI_HIDDEN
        self.routeInfo.opacity = 0.0
        self.routeInfo.state = uiconst.UI_PICKCHILDREN
        self.uiEffects.MorphUI(self.routeInfo,
                               'opacity',
                               1.0,
                               time=125.0,
                               float=1,
                               newthread=0,
                               maxSteps=1000)