コード例 #1
0
 def get_ore_cargo(self):
     if bool(
             get_attr(util.GetActiveShip(),
                      const.attributeSpecialOreHoldCapacity)):
         return invCtrl.ShipOreHold(util.GetActiveShip())
     else:
         return invCtrl.ShipCargo()
コード例 #2
0
ファイル: dna.py プロジェクト: connoryang/1v1dec
def CreateShip_GML(typeID, name = None):
    shipID = None
    itemID = Load(typeID)
    invCache = sm.GetService('invCache')
    if not itemID:
        if util.IsDocked():
            hangar = invCache.GetInventory(const.containerHangar)
            cargo = invCache.GetInventoryFromId(util.GetActiveShip()).GetCapacity(const.flagCargo)
            if cargo.capacity - cargo.used >= 100:
                shipID = Load(11019)
                if shipID:
                    hangar.Add(shipID, util.GetActiveShip(), qty=1)
                    sm.GetService('gameui').GetShipAccess().AssembleShip(shipID, 'Copycat Temporary')
                    itemID = Load(typeID, where=shipID)
                    if not itemID:
                        Message('what the?!', 'Something is hosed alright.')
                        return
    if itemID:
        if util.IsDocked():
            invCache.GetInventory(const.containerHangar).Add(itemID, util.GetActiveShip(), qty=1)
            sm.GetService('gameui').GetShipAccess().AssembleShip(itemID, name)
        else:
            sm.GetService('gameui').GetShipAccess().Jettison([itemID])
            if name:
                WaitAndSetLabel(itemID, name)
    if shipID and util.IsDocked():
        invCache.GetInventoryMgr().TrashItems([shipID], session.stationid or session.structureid)
    if not itemID:
        Message('Planck field overload', "Sorry, you can't squeeze a <color=0xffffff00>%s<color=0xffffffff> into your current ship's cargohold.<br><br>Please make sure you have enough free cargo capacity to load this ship before trying again.<br>" % evetypes.GetName(typeID))
    return itemID
コード例 #3
0
ファイル: dna.py プロジェクト: connoryang/1v1dec
 def NoPodCheck(self, wantNewShip = False):
     dogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation()
     inPod = not (util.GetActiveShip() is not None and dogmaLocation.GetDogmaItem(util.GetActiveShip()).groupID != 29)
     if not inPod:
         return
     if inPod and wantNewShip and eve.session.role & (ROLE_WORLDMOD | ROLE_SPAWN):
         return
     self.Oops('Allergic to eggs', 'This feature cannot be used when you are in a pod.<br>Get yourself in a ship and try again!')
コード例 #4
0
 def ShowView(self, **kwargs):
     viewstate.StationView.ShowView(self, **kwargs)
     self.sceneManager.SetRegisteredScenes(self.name)
     if util.GetActiveShip():
         self.ShowShip(util.GetActiveShip())
     elif self.staticEnv:
         self.RenderStaticEnvironment()
     else:
         self.RenderDynamicEnvironment()
コード例 #5
0
    def LoadFitting(self, fitting, getFailedDict = False):
        self.CheckBusyFittingAndRaiseIfNeeded()
        self._CheckValidFittingLocation(fitting)
        shipInv = self.invCache.GetInventoryFromId(util.GetActiveShip())
        if shipInv.item.typeID != fitting.shipTypeID:
            raise UserError('ShipTypeInFittingNotSameAsShip')
        chargesByType, dronesByType, fightersByTypeID, iceByType, itemTypes, modulesByFlag, rigsToFit, subsystems = self.GetTypesToFit(fitting, shipInv)
        fitRigs = False
        cargoItemsByType = defaultdict(int)
        if rigsToFit:
            if self.HasRigFitted():
                eve.Message('CustomNotify', {'notify': localization.GetByLabel('UI/Fitting/ShipHasRigsAlready')})
            elif eve.Message('FitRigs', {}, uiconst.YESNO) == uiconst.ID_YES:
                fitRigs = True
            else:
                for flagID, typeID in modulesByFlag.iteritems():
                    if flagID in const.rigSlotFlags:
                        cargoItemsByType[typeID] += 1

        cargoItemsByType = dict(cargoItemsByType)
        itemsToFit = defaultdict(set)
        for item in self.invCache.GetInventory(const.containerHangar).List(const.flagHangar):
            if item.typeID in itemTypes:
                qtyNeeded = itemTypes[item.typeID]
                if qtyNeeded == 0:
                    continue
                quantityToTake = min(item.stacksize, qtyNeeded)
                itemsToFit[item.typeID].add(item.itemID)
                itemTypes[item.typeID] -= quantityToTake

        if subsystems:
            shipType = shipInv.GetItem().typeID
            for flag, module in modulesByFlag.iteritems():
                if const.flagSubSystemSlot0 <= flag <= const.flagSubSystemSlot7:
                    moduleFitsShipType = int(sm.GetService('clientDogmaStaticSvc').GetTypeAttribute(module, const.attributeFitsToShipType))
                    if shipType != moduleFitsShipType:
                        raise UserError('CannotFitSubSystemNotShip', {'subSystemName': (const.UE_TYPEID, module),
                         'validShipName': (const.UE_TYPEID, moduleFitsShipType),
                         'shipName': (const.UE_TYPEID, shipType)})
                    if module in itemTypes and itemTypes[module] > 0:
                        raise UserError('CantUnfitSubSystems')

        self.CheckBusyFittingAndRaiseIfNeeded()
        self.busyFitting = True
        try:
            failedToLoad = shipInv.FitFitting(util.GetActiveShip(), itemsToFit, session.stationid2 or session.structureid, modulesByFlag, dronesByType, fightersByTypeID, chargesByType, iceByType, cargoItemsByType, fitRigs)
        finally:
            self.busyFitting = False

        if settings.user.ui.Get('useFittingNameForShips', 0):
            fittingName = StripTags(fitting.get('name'))
            fittingName = fittingName[:20]
            self.invCache.GetInventoryMgr().SetLabel(util.GetActiveShip(), fittingName)
        if getFailedDict:
            return failedToLoad
        self.ShowFailedToLoadMsg(failedToLoad)
コード例 #6
0
    def GetShipMenu(self):
        if util.GetActiveShip():
            hangarInv = sm.GetService('invCache').GetInventory(
                const.containerHangar)
            hangarItems = hangarInv.List()
            for each in hangarItems:
                if each.itemID == util.GetActiveShip():
                    return sm.GetService('menu').InvItemMenu(each)

        return []
コード例 #7
0
ファイル: stationView.py プロジェクト: R4M80MrX/eve-1
    def WaitForShip(self, shipID):
        maximumWait = 10000
        sleepUnit = 100
        iterations = maximumWait / sleepUnit
        while util.GetActiveShip() != shipID and iterations:
            iterations -= 1
            blue.pyos.synchro.SleepWallclock(sleepUnit)

        if util.GetActiveShip() != shipID:
            raise RuntimeError('Ship never came :(')
        self.LogInfo('Waited for ship for %d iterations.' %
                     (maximumWait / sleepUnit - iterations))
コード例 #8
0
 def AddTrustedHeaderData(self):
     self.AddToAllTrustedSites('EVE_TRUSTED', 'Yes')
     self.AddToAllOtherSites('EVE_TRUSTED', 'No')
     self.AddToCCPTrustedSites('EVE_USERID', '%s' % eve.session.userid)
     self.AddToCCPTrustedSites('EVE_VERSION', '%s' % boot.build)
     if sm.GetService('machoNet').GetTransport('ip:packet:server') is not None and sm.GetService('machoNet').GetTransport('ip:packet:server').transport.address is not None:
         self.AddToAllTrustedSites('EVE_SERVERIP', sm.GetService('machoNet').GetTransport('ip:packet:server') and sm.GetService('machoNet').GetTransport('ip:packet:server').transport.address)
     if eve.session.charid:
         self.AddToAllTrustedSites('EVE_CHARNAME', eve.session.charid and cfg.eveowners.Get(eve.session.charid).name.encode('ascii', 'replace'))
         self.AddToAllTrustedSites('EVE_CHARID', '%s' % eve.session.charid)
     if eve.session.corpid:
         self.AddToAllTrustedSites('EVE_CORPNAME', eve.session.corpid and cfg.eveowners.Get(eve.session.corpid).name)
         self.AddToAllTrustedSites('EVE_CORPID', '%s' % eve.session.corpid)
     if eve.session.allianceid:
         self.AddToAllTrustedSites('EVE_ALLIANCENAME', eve.session.allianceid and cfg.eveowners.Get(eve.session.allianceid).name)
         self.AddToAllTrustedSites('EVE_ALLIANCEID', '%s' % eve.session.allianceid)
     if eve.session.regionid:
         self.AddToAllTrustedSites('EVE_REGIONNAME', eve.session.regionid and cfg.evelocations.Get(eve.session.regionid).name)
         self.AddToAllTrustedSites('EVE_REGIONID', eve.session.regionid)
     if eve.session.solarsystemid or eve.session.solarsystemid2:
         self.AddToAllTrustedSites('EVE_SOLARSYSTEMNAME', (eve.session.solarsystemid or eve.session.solarsystemid2) and cfg.evelocations.Get(eve.session.solarsystemid or eve.session.solarsystemid2).name)
         self.AddToAllTrustedSites('EVE_SOLARSYSTEMID', '%s' % (eve.session.solarsystemid or eve.session.solarsystemid2))
     if eve.session.constellationid:
         self.AddToAllTrustedSites('EVE_CONSTELLATIONNAME', eve.session.constellationid and cfg.evelocations.Get(eve.session.constellationid).name)
         self.AddToAllTrustedSites('EVE_CONSTELLATIONID', eve.session.constellationid)
     if eve.session.stationid:
         self.AddToAllTrustedSites('EVE_STATIONNAME', eve.session.stationid and cfg.evelocations.Get(eve.session.stationid).name)
         self.AddToAllTrustedSites('EVE_STATIONID', '%s' % eve.session.stationid)
     if eve.session.corprole:
         self.AddToAllTrustedSites('EVE_CORPROLE', '%s' % eve.session.corprole)
     if eve.session.warfactionid:
         self.AddToAllTrustedSites('EVE_WARFACTIONID', '%s' % eve.session.warfactionid)
     activeShipID = util.GetActiveShip()
     if activeShipID is not None:
         self.AddShipToAllTrustedSites(activeShipID)
コード例 #9
0
ファイル: treeData.py プロジェクト: connoryang/1v1dec
def GetSharedBayHint(invController):
    if invController.itemID != util.GetActiveShip():
        hint = cfg.evelocations.Get(invController.itemID).name
        ownerID = invController.GetOwnerID()
        if ownerID:
            hint += '<br>%s' % cfg.eveowners.Get(ownerID).name
        return hint
コード例 #10
0
ファイル: base.py プロジェクト: connoryang/1v1dec
 def Exit(self, *args):
     if self.exitingstation:
         self.AbortUndock()
         return False
     viewSvc = sm.GetService('viewState')
     currentView = viewSvc.GetCurrentView()
     if currentView.name == 'hangar':
         currentView.StartExitAnimation()
         currentView.StartExitAudio()
     if sm.GetService('actionObjectClientSvc').IsEntityUsingActionObject(
             session.charid):
         sm.GetService('actionObjectClientSvc').ExitActionObject(
             session.charid)
     if not IsOkToUndock(eve.stationItem.stationTypeID):
         return False
     shipID = util.GetActiveShip()
     if shipID is None:
         shipID = self.ShipPicker()
         if shipID is None:
             eve.Message('NeedShipToUndock')
             return False
         sm.GetService('clientDogmaIM').GetDogmaLocation().MakeShipActive(
             shipID)
     if not IsOkToUndockWithMissingCargo():
         return False
     self.exitingstation = 1
     uthread.new(self.LoadSvc, None)
     uthread.new(self.Undock_Thread, shipID)
     return True
コード例 #11
0
        def MissileSubMenu(charges):
            m = []
            charges.sort()
            missiles = {}
            for damage, a in charges:
                if a.launcherGroup in missiles:
                    missiles[a.launcherGroup].append(a)
                else:
                    missiles[a.launcherGroup] = [a]

            for launcherGroup, items in missiles.iteritems():
                fitted = []
                label = '<color=0xff708090>%s' % cfg.invgroups.Get(launcherGroup).name
                if launcherGroup == const.groupMissileLauncherStandard:
                    for row in self.invCache.GetInventoryFromId(util.GetActiveShip()).ListHardwareModules():
                        if row.groupID in (const.groupMissileLauncherStandard, const.groupMissileLauncherAssault):
                            fitted.append(row.groupID)

                    if len(fitted) > 1:
                        label = '<color=0xff708090>%s / %s' % (cfg.invgroups.Get(const.groupMissileLauncherStandard).name, cfg.invgroups.Get(const.groupMissileLauncherAssault).name)
                    else:
                        label = '<color=0xff708090>%s' % cfg.invgroups.Get(fitted[0]).name
                m.append((label, None))
                m.append(None)
                for a in items:
                    m.append(self.Entry(a))

                m.append(None)

            return m
コード例 #12
0
ファイル: slot.py プロジェクト: nanxijw/Clara-Pretty-One-Dick
    def SetGroup(self):
        shipID = util.GetActiveShip()
        try:
            if self.module is not None and not self.shell.SlotExists(
                    shipID, self.module.flagID):
                masterID = self.shell.IsInWeaponBank(self.module.locationID,
                                                     self.id)
                if masterID:
                    self.shell.DestroyWeaponBank(self.module.locationID,
                                                 masterID)
        except ReferenceError:
            pass

        allGroupsDict = settings.user.ui.Get('linkedWeapons_groupsDict', {})
        groupDict = allGroupsDict.get(shipID, {})
        ret = self.GetBankGroup(groupDict)
        if ret is None:
            self.sr.groupMark.parent.state = uiconst.UI_HIDDEN
            return
        groupNumber = ret.groupNumber
        self.sr.groupMark.parent.state = uiconst.UI_PICKCHILDREN
        self.sr.groupMark.parent.SetRotation(-self.GetRotation())
        if groupNumber < 0:
            availGroups = [1, 2, 3, 4, 5, 6, 7, 8]
            for masterID, groupNum in groupDict.iteritems():
                if groupNum in availGroups:
                    availGroups.remove(groupNum)

            groupNumber = availGroups[0] if availGroups else ''
        self.sr.groupMark.LoadIcon('ui_73_16_%s' % (176 + groupNumber))
        self.sr.groupMark.hint = localization.GetByLabel(
            'UI/Fitting/GroupNumber', groupNumber=groupNumber)
        groupDict[ret.masterID] = groupNumber
        allGroupsDict[shipID] = groupDict
        settings.user.ui.Set('linkedWeapons_groupsDict', allGroupsDict)
コード例 #13
0
 def UpdateShipModels(self, shipModel, activeShipID=None):
     if activeShipID is None:
         activeShipID = util.GetActiveShip()
     self.activeShipModel = shipModel
     self.activeShipID = activeShipID
     for each in self.entities:
         self.SetShipModel(each)
コード例 #14
0
    def AddItems(self, items):
        activeShipID = util.GetActiveShip()
        for item in items:
            if item.itemID == activeShipID:
                raise UserError('PeopleAboardShip')

        BaseInvContainer.AddItems(self, items)
コード例 #15
0
    def HasRigFitted(self):
        shipInv = self.invCache.GetInventoryFromId(util.GetActiveShip(), locationID=session.stationid2)
        for item in shipInv.List():
            if const.flagRigSlot0 <= item.flagID <= const.flagRigSlot7:
                return True

        return False
コード例 #16
0
    def buble_out(self):
        buble = self.in_bubble()

        if buble:
            bp = sm.GetService('michelle').GetBallpark(True)

            if bp.GetBallById(util.GetActiveShip()).followId != buble.id:

                slim = bp.GetInvItem(buble.id)

                if slim:
                    radius = get_type_attr(
                        slim.typeID, const.attributeWarpScrambleRange) + 1000

                    self.info('Вытапливаем из бубля {}'.format(slim.itemID),
                              self.role)

                    do_action(3 + rnd_keys())

                    movementFunctions.Orbit(buble.id, radius)
        else:
            if self.check_in_flags('buble'):
                self.info('Вытопили из бубля', self.role)

                self.del_flag('buble')

                self.run_action()
コード例 #17
0
ファイル: shipconfig.py プロジェクト: connoryang/1v1dec
    def ApplyAttributes(self, attributes):
        uicontrols.Window.ApplyAttributes(self, attributes)
        self.shipid = util.GetActiveShip()
        self.shipItem = self.GetShipItem()
        self.SetTopparentHeight(72)
        self.SetWndIcon()
        self.SetMinSize([300, 200])
        self.sr.top = uiprimitives.Container(name='top', align=uiconst.TOTOP, parent=self.sr.topParent, pos=(const.defaultPadding,
         const.defaultPadding,
         const.defaultPadding,
         64))
        icon = uicontrols.Icon(parent=self.sr.top, align=uiconst.TOLEFT, left=const.defaultPadding, size=64, state=uiconst.UI_NORMAL, typeID=self.shipItem.typeID)
        icon.GetMenu = self.ShipMenu
        uiprimitives.Container(name='push', align=uiconst.TOLEFT, pos=(5, 0, 5, 0), parent=self.sr.top)
        uicontrols.EveHeaderMedium(name='label', text=cfg.evelocations.Get(self.shipItem.itemID).name, parent=self.sr.top, align=uiconst.TOTOP, bold=True, state=uiconst.UI_NORMAL)
        uicontrols.EveLabelMedium(name='label', text=evetypes.GetName(self.shipItem.typeID), parent=self.sr.top, align=uiconst.TOTOP, state=uiconst.UI_NORMAL)
        self.ship = moniker.GetShipAccess()
        self.conf = self.ship.GetShipConfiguration(self.shipid)
        modules = self.GetShipModules()
        for module in modules:
            self.sr.Set('%sPanel' % module.lower(), uiprimitives.Container(name=module, align=uiconst.TOALL, state=uiconst.UI_HIDDEN, parent=self.sr.main, pos=(0, 0, 0, 0)))

        tabs = [ [name,
         self.sr.Get('%sPanel' % module.lower(), None),
         self,
         module] for module, name in modules.iteritems() if self.sr.Get('%sPanel' % module.lower()) ]
        if tabs:
            self.sr.maintabs = uicontrols.TabGroup(name='tabparent', align=uiconst.TOTOP, height=18, parent=self.sr.main, idx=0, tabs=tabs, groupID='pospanel')
        else:
            uicontrols.CaptionLabel(text=localization.GetByLabel('UI/Ship/ShipConfig/ShipConfig'), parent=self.sr.main, size=18, uppercase=0, left=const.defaultPadding, width=const.defaultPadding, top=const.defaultPadding)
コード例 #18
0
ファイル: dna.py プロジェクト: nanxijw/Clara-Pretty-One-Dick
    def FitUsingSlash(self, shipID):
        title = 'Fitting %s' % GetTypeName(self.typeID)
        state = [0, 0]

        def _fitgroup(slot):
            w = sm.RemoteSvc('slash')
            for flag, typeID in self.itermodules(banks=(slot, ), smart=True):
                if typeID:
                    state[0] += 1
                    modname = GetTypeName(typeID)
                else:
                    continue
                state[1] += 1
                sm.GetService('loading').ProgressWnd(
                    title, 'Fitting module %s/%s: %s' %
                    (state[0], self.realmodulecount, modname), state[1] * 1000,
                    (self.realmodulecount + self.fakemodulecount) * 1000 + 1)
                w.SlashCmd('/fit %s %s flag=%d' % (shipID, typeID, flag))

        if shipID == util.GetActiveShip():
            sm.RemoteSvc('slash').SlashCmd('/unload me all')
        parallelCalls = []
        for slot in SLOTGROUPS:
            parallelCalls.append((_fitgroup, (slot, )))

        uthread.parallel(parallelCalls)
        sm.GetService('loading').ProgressWnd(title, 'Done', 1, 1)
コード例 #19
0
 def DestroyInstalledClone(self, cloneID):
     message = None
     myClones = self.GetClones()
     if myClones:
         myClones = myClones.Index('jumpCloneID')
         if cloneID in myClones:
             if myClones[cloneID].locationID == session.stationid2:
                 message = localization.GetByLabel(
                     'UI/CloneJump/ReallyDestroyCloneAtCurrentStation')
             else:
                 cfg.evelocations.Prime([myClones[cloneID].locationID])
                 message = localization.GetByLabel(
                     'UI/CloneJump/ReallyDestroyCloneAtSomewhereElse',
                     location=myClones[cloneID].locationID)
     if not message:
         if util.GetActiveShip():
             shipClones = self.GetShipClones()
             if shipClones:
                 shipClones = shipClones.Index('jumpCloneID')
                 if cloneID in shipClones:
                     cfg.eveowners.Prime([shipClones[cloneID].ownerID])
                     cfg.evelocations.Prime(
                         [shipClones[cloneID].locationID])
                     message = localization.GetByLabel(
                         'UI/CloneJump/ReallyDestroyCloneInShip',
                         owner=shipClones[cloneID].ownerID,
                         ship=shipClones[cloneID].locationID)
     if not message:
         return
     ret = eve.Message('AskAreYouSure', {'cons': message}, uiconst.YESNO)
     if ret == uiconst.ID_YES:
         lm = self.GetLM()
         lm.DestroyInstalledClone(cloneID)
コード例 #20
0
ファイル: dna.py プロジェクト: nanxijw/Clara-Pretty-One-Dick
    def Fit(self, shipID=None, fromAssemble=False):
        if not self.Valid(report=True):
            return None
        self.NoPodCheck(wantNewShip=fromAssemble)
        if not shipID:
            shipID = util.GetActiveShip()
        if not fromAssemble:
            try:
                shipTypeID = sm.GetService('clientDogmaIM').GetDogmaLocation(
                ).GetDogmaItem(shipID).typeID
            except:
                shipTypeID = sm.GetService('invCache').GetInventoryFromId(
                    shipID).GetTypeID()

            if shipTypeID != self.typeID:
                Message(
                    'Unable to refit',
                    'Sorry, this setup is designed for a %s. You are currently piloting a %s.'
                    % (GetTypeName(self.typeID), GetTypeName(shipTypeID)))
                raise UserError('IgnoreToTop')
        if eve.session.role & ROLE_GML:
            return self.FitUsingSlash(shipID)
        if eve.session.stationid:
            self.SkillCheck()
            return self.FitUsingHangar(shipID)
        self.Oops(
            'Oops',
            'Fitting operations cannot be done in space. Please dock at a station and try again.'
        )
コード例 #21
0
 def GetShipClones(self):
     activeShipID = util.GetActiveShip()
     if not self.shipJumpClones or activeShipID != self.shipJustClonesShipID:
         lm = self.GetLM()
         self.shipJustClonesShipID = activeShipID
         self.shipJumpClones = lm.GetShipCloneState(activeShipID)
     return self.shipJumpClones
コード例 #22
0
ファイル: base.py プロジェクト: nanxijw/Clara-Pretty-One-Dick
 def FitHardpoints(self):
     if not self.activeshipmodel or self.refreshingfitting:
         return
     self.refreshingfitting = True
     activeShip = util.GetActiveShip()
     turretSet.TurretSet.FitTurrets(activeShip, self.activeshipmodel)
     self.refreshingfitting = False
コード例 #23
0
ファイル: base.py プロジェクト: nanxijw/Clara-Pretty-One-Dick
    def SelectShipDlg(self):
        hangarInv = sm.GetService('invCache').GetInventory(
            const.containerHangar)
        items = hangarInv.List()
        tmplst = []
        activeShipID = util.GetActiveShip()
        for item in items:
            if item[const.ixCategoryID] == const.categoryShip and item[
                    const.ixSingleton]:
                tmplst.append((cfg.invtypes.Get(item[const.ixTypeID]).name,
                               item, item[const.ixTypeID]))

        if not tmplst:
            self.exitingstation = 0
            eve.Message('NeedShipToUndock')
            return
        ret = uix.ListWnd(tmplst, 'item',
                          localization.GetByLabel('UI/Station/SelectShip'),
                          None, 1)
        if ret is None or ret[1].itemID == activeShipID:
            self.exitingstation = 0
            return
        newActiveShip = ret[1]
        try:
            self.TryActivateShip(newActiveShip)
        except:
            self.exitingstation = 0
            raise
コード例 #24
0
 def UpdateItem(self, item, change):
     self.LogInfo('UpdateItem item:', item)
     activeShipID = util.GetActiveShip()
     if item.itemID in (activeShipID, eve.session.charid):
         return
     if item.flagID == const.flagReward:
         return
     if item.groupID == const.groupMineral:
         return
     if not self.items.has_key(item.itemID):
         return
     if self is None or self.destroyed:
         return
     self.items[item.itemID] = item
     quote = uthread.parallel([
         (sm.GetService('reprocessing').GetReprocessingSvc().GetQuotes,
          ([item.itemID], activeShipID))
     ])[0]
     if self is None or self.destroyed:
         return
     if quote.has_key(item.itemID):
         self.quotes[item.itemID] = quote[item.itemID]
     elif self.quotes.has_key(item.itemID):
         del self.quotes[item.itemID]
     calls = []
     calls.append((self.__LoadItems, ()))
     calls.append((self.__LoadQuotes, ()))
     uthread.parallel(calls)
コード例 #25
0
 def GetFittingSlotEntry(self, slotInfo, moduleCount):
     slotCount = self.GetTotalSlotCount(slotInfo)
     if slotCount <= 0 and moduleCount <= 0:
         return
     else:
         isMyActiveShip = self.itemID is not None and util.GetActiveShip(
         ) == self.itemID
         isOwnedByMe = self.item is not None and self.item.ownerID == session.charid
         if isMyActiveShip or isOwnedByMe:
             data = {
                 'label':
                 self.GetFittingSlotEntryLabel(slotInfo),
                 'text':
                 GetByLabel('UI/InfoWindow/FittingSlotsUsedAndTotal',
                            usedSlots=moduleCount,
                            slotCount=slotCount),
                 'iconID':
                 cfg.dgmattribs.Get(slotInfo['attributeID']).iconID,
                 'line':
                 1
             }
             entry = listentry.Get(decoClass=FittingSlotEntry, data=data)
             return entry
         data = {
             'label': self.GetFittingSlotEntryLabel(slotInfo),
             'text': util.FmtAmt(slotCount),
             'iconID': cfg.dgmattribs.Get(slotInfo['attributeID']).iconID,
             'line': 1
         }
         entry = listentry.Get('LabelTextSides', data)
         return entry
コード例 #26
0
ファイル: dna.py プロジェクト: nanxijw/Clara-Pretty-One-Dick
    def ImportFromShip(self, shipID=None, ownerID=None, deferred=False):
        if deferred:
            self.deferred = (shipID, ownerID)
            return self
        self.__init__()
        if shipID is None:
            shipID = util.GetActiveShip()
        if ownerID is None:
            ownerID = eve.session.charid
        loc = cfg.evelocations.GetIfExists(shipID)
        if loc:
            self.name = loc.name
        else:
            self.name = None
        if ownerID != eve.session.charid:
            dna = sm.RemoteSvc('slash').SlashCmd('/getshipsetup %d' % shipID)
            return self.ImportFromDNA(dna)
        if shipID == util.GetActiveShip():
            ship = sm.GetService(
                'clientDogmaIM').GetDogmaLocation().GetDogmaItem(shipID)
            if ship is None:
                self.errorMessage = 'Could not get shipID: %s' % shipID
                return self
            self.typeID = ship.typeID
            for module in ship.GetFittedItems().itervalues():
                if cfg.IsFittableCategory(module.categoryID):
                    self.moduleByFlag[module.flagID] = module.typeID

        else:
            try:
                shipinv = sm.GetService('invCache').GetInventoryFromId(shipID)
                self.typeID = shipinv.GetTypeID()
                if not self.name:
                    self.name = cfg.invtypes.Get(self.typeID).name
                mods = shipinv.ListHardwareModules()
            except:
                self.errorMessage = 'Could not get inv of shipID: %s' % shipID
                return self

            for rec in mods:
                if cfg.IsFittableCategory(
                        cfg.invtypes.Get(rec.typeID).categoryID):
                    self.moduleByFlag[rec.flagID] = rec.typeID

        self.valid = True
        self.Update()
        return self
コード例 #27
0
 def ApplyAttributes(self, attributes):
     uicls.Window.ApplyAttributes(self, attributes)
     self.scope = 'station_inflight'
     self.soldict = {}
     self.sr.main = uiutil.GetChild(self, 'main')
     self.SetWndIcon('ui_53_64_11', mainTop=-8)
     self.SetMinSize([350, 200])
     self.SetCaption(
         localization.GetByLabel(
             'UI/CapitalNavigation/CapitalNavigationWindow/CapitalNavigationLabel'
         ))
     uicls.WndCaptionLabel(
         text=localization.GetByLabel(
             'UI/CapitalNavigation/CapitalNavigationWindow/CapitalNavigationLabel'
         ),
         subcaption=localization.GetByLabel(
             'UI/CapitalNavigation/CapitalNavigationWindow/OnlinedStarbaseMessage'
         ),
         parent=self.sr.topParent,
         align=uiconst.RELATIVE)
     self.sr.scroll = uicls.Scroll(
         name='scroll',
         parent=self.sr.main,
         padding=(const.defaultPadding, const.defaultPadding,
                  const.defaultPadding, const.defaultPadding))
     self.sr.settingsParent = uicls.Container(
         name='settingsParent',
         parent=self.sr.main,
         align=uiconst.TOALL,
         state=uiconst.UI_HIDDEN,
         idx=1,
         pos=(const.defaultPadding, const.defaultPadding,
              const.defaultPadding, const.defaultPadding),
         clipChildren=1)
     maintabs = [
         [
             localization.GetByLabel(
                 'UI/CapitalNavigation/CapitalNavigationWindow/JumpTo'),
             self.sr.scroll, self, 'jumpto', self.sr.scroll
         ],
         [
             localization.GetByLabel(
                 'UI/CapitalNavigation/CapitalNavigationWindow/WithinRange'
             ), self.sr.scroll, self, 'inrange', self.sr.scroll
         ]
     ]
     shipID = util.GetActiveShip()
     if shipID and sm.GetService('clientDogmaIM').GetDogmaLocation(
     ).GetItem(shipID).groupID == const.groupTitan:
         maintabs.insert(1, [
             localization.GetByLabel(
                 'UI/CapitalNavigation/CapitalNavigationWindow/BridgeTo'),
             self.sr.scroll, self, 'bridgeto', self.sr.scroll
         ])
     self.sr.maintabs = uicls.TabGroup(name='tabparent',
                                       parent=self.sr.main,
                                       idx=0,
                                       tabs=maintabs,
                                       groupID='capitaljumprangepanel')
コード例 #28
0
    def GetSolarSystemsInRange_thread(self, solarSystemID):
        shipID = util.GetActiveShip()
        if not shipID:
            return
        self.sr.scroll.Load(
            contentList=[],
            noContentHint=localization.GetByLabel('UI/Common/GettingData'))
        jumpDriveRange, consumptionType, consumptionAmount = self.GetJumpDriveInfo(
            shipID)
        inRange = set()
        soldict = self.soldict.get(solarSystemID, None)
        for solID, solData in cfg.mapSystemCache.iteritems():
            if session.solarsystemid2 != solID and solData.securityStatus <= const.securityClassLowSec:
                distance = uix.GetLightYearDistance(solarSystemID, solID,
                                                    False)
                if distance is not None and distance <= jumpDriveRange:
                    inRange.add(solID)
            self.soldict[solarSystemID] = inRange
        else:
            inRange = soldict

        scrolllist = []
        if inRange:
            for solarSystemID in inRange:
                blue.pyos.BeNice()
                if not self or self.destroyed:
                    return
                requiredQty, requiredType = self.GetFuelConsumptionForMyShip(
                    session.solarsystemid2, solarSystemID, consumptionType,
                    consumptionAmount)
                entry = self.GetSolarSystemBeaconEntry(solarSystemID,
                                                       requiredQty,
                                                       requiredType,
                                                       jumpDriveRange)
                if entry:
                    scrolllist.append(entry)

        if not len(scrolllist):
            self.sr.scroll.ShowHint(
                localization.GetByLabel('UI/Common/NothingFound'))
        if self.sr.scroll and scrolllist and self.sr.Get('showing',
                                                         None) == 'inrange':
            self.sr.scroll.ShowHint('')
            self.sr.scroll.Load(
                contentList=scrolllist,
                headers=[
                    localization.GetByLabel(
                        'UI/Common/LocationTypes/SolarSystem'),
                    localization.GetByLabel(
                        'UI/CapitalNavigation/CapitalNavigationWindow/SecurityColumnHeader'
                    ),
                    localization.GetByLabel(
                        'UI/CapitalNavigation/CapitalNavigationWindow/FuelColumnHeader'
                    ),
                    localization.GetByLabel('UI/Common/Volume'),
                    localization.GetByLabel('UI/Common/Distance'),
                    localization.GetByLabel(
                        'UI/CapitalNavigation/CapitalNavigationWindow/JumpTo')
                ])
コード例 #29
0
 def GetName(self):
     bayName = inventoryFlagsCommon.GetNameForFlag(self.locationFlag)
     if session.solarsystemid and self.itemID != util.GetActiveShip():
         return localization.GetByLabel('UI/Inventory/BayAndLocationName',
                                        bayName=cfg.invtypes.Get(
                                            self.GetTypeID()).name,
                                        locationName=bayName)
     return bayName
コード例 #30
0
ファイル: navigation.py プロジェクト: R4M80MrX/eve-1
 def GetMenu(self):
     x, y = uicore.ScaleDpi(uicore.uilib.x), uicore.ScaleDpi(uicore.uilib.y)
     if self.scene:
         projection, view, viewport = uix.GetFullscreenProjectionViewAndViewport(
         )
         pick = self.scene.PickObject(x, y, projection, view, viewport)
         if pick and pick.name == str(util.GetActiveShip()):
             return self.GetShipMenu()