def RenderNormalAssets(self, bloodlineID, camera, character, genderID,
                           scene, tryout):
        doll = character.doll
        for category in self.assetCategoriesToRender:
            typeData = self.characterSvc.GetAvailableTypesByCategory(
                category, genderID, bloodlineID)
            lightScene = trinity.Load(NORMAL_LIGHT_COLOR)
            ccUtil.SetupLighting(scene, lightScene, lightScene)
            cameraSetup = self.SetUpCamera(camera, category, character, SETUP,
                                           scene, genderID)
            log.LogNotice('before dresscode')
            if category in DRESSCODE:
                removeDcModifers = self.EnforceDresscode(
                    bloodlineID, category, doll, genderID)
            else:
                removeDcModifers = []
            log.LogNotice('go render type')
            for itemType in typeData:
                wasRendered = self.RenderNormalType(bloodlineID, camera,
                                                    category, character,
                                                    genderID, itemType, scene)
                if tryout and wasRendered:
                    break

            log.LogNotice('remove the dresscode')
            for dcResPath in removeDcModifers:
                doll.RemoveResource(dcResPath, self.factory)

            log.LogNotice('done with category')
Example #2
0
    def Search_thread(self, *args):
        """
            The amount of data we are iterating over can be huge, and any time we can save in each loop really matters.
            Therefore we have dictionaries with results so we don't have to make the same checks and string manipulation
            over and over.
            Characters with the most items tend to have a lot of the same blueprints, so it can save a lot of time.
        """
        self.ShowLoad()
        if self.sr.maintabs.GetSelectedArgs() == 'search':
            self.sr.scroll.Load(
                contentList=[],
                noContentHint=localization.GetByLabel('UI/Common/GettingData'))
        blue.pyos.synchro.Yield()
        log.LogNotice('Asset Search - fetch items')
        invContainer = sm.GetService('invCache').GetInventory(
            const.containerGlobal)
        allitems = invContainer.ListIncludingContainers()
        log.LogNotice('Asset Search - items fetched =', len(allitems))
        itemRowset = GetFakeRowset(self.nameHelper, allitems)
        log.LogNotice('Asset Search - fake rows created')
        uiSvc = sm.StartService('ui')
        blue.pyos.synchro.Yield()
        if self.sr.maintabs.GetSelectedArgs() == 'search':
            self.sr.scroll.Load(
                contentList=[],
                noContentHint=localization.GetByLabel('UI/Common/Searching'))
        blue.pyos.synchro.Yield()
        searchtype = unicode(self.sr.searchtype.GetValue() or '').lower()
        searchtype, advancedMatches = ParseString(searchtype)
        conditions = self.GetConditions(advancedMatches)
        self.assetKeywordSearch.ResetPerRunDicts()
        allContainersByItemIDs, itemsByContainerID, stations = GetSearchResults(
            self.nameHelper, conditions, itemRowset, searchtype)
        containersInfoByStations = defaultdict(lambda: defaultdict(tuple))
        for containerID, itemsInContainer in itemsByContainerID.iteritems():
            containerItem = allContainersByItemIDs.get(containerID)
            if containerItem.typeID == const.typePlasticWrap:
                continue
            if containerItem:
                containersInfoByStations[
                    containerItem.locationID][containerID] = (containerItem,
                                                              itemsInContainer)

        for stationID in containersInfoByStations.iterkeys():
            stations[stationID].extend([])

        sortlocations = []
        for stationID, stationItems in stations.iteritems():
            solarsystemID = uiSvc.GetStation(stationID).solarSystemID
            stationsContainersInfo = containersInfoByStations.get(
                stationID, {})
            sortlocations.append((solarsystemID, stationID, stationItems,
                                  stationsContainersInfo))

        sortlocations.sort()
        sortlocations = sortlocations
        self.searchlist = sortlocations
        sortKey = self.sr.sortcombosearch.GetValue()
        self.ShowSearch(sortKey)
Example #3
0
    def Search_thread(self, *args):
        self.ShowLoad()
        if self.sr.maintabs.GetSelectedArgs() == 'search':
            self.sr.scroll.Load(
                contentList=[],
                noContentHint=localization.GetByLabel('UI/Common/GettingData'))
        blue.pyos.synchro.Yield()
        log.LogNotice('Asset Search - fetch items')
        invContainer = sm.GetService('invCache').GetInventory(
            const.containerGlobal)
        allitems = invContainer.ListIncludingContainers()
        log.LogNotice('Asset Search - items fetched =', len(allitems))
        itemRowset = GetFakeRowset(allitems)
        log.LogNotice('Asset Search - fake rows created')
        uiSvc = sm.StartService('ui')
        blue.pyos.synchro.Yield()
        if self.sr.maintabs.GetSelectedArgs() == 'search':
            self.sr.scroll.Load(
                contentList=[],
                noContentHint=localization.GetByLabel('UI/Common/Searching'))
        blue.pyos.synchro.Yield()
        searchtype = unicode(self.sr.searchtype.GetValue() or '').lower()
        searchtype, advancedMatches = ParseString(searchtype)
        conditions = self.GetConditions(advancedMatches)
        self.assetKeywordSearch.ResetPerRunDicts()
        allContainersByItemIDs, itemsByContainerID, stations = GetSearchResults(
            conditions, itemRowset, searchtype)
        containersInfoByStations = defaultdict(lambda: defaultdict(tuple))
        for containerID, itemsInContainer in itemsByContainerID.iteritems():
            containerItem = allContainersByItemIDs.get(containerID)
            if containerItem and containerItem.typeID == const.typePlasticWrap:
                continue
            if containerItem:
                containersInfoByStations[
                    containerItem.locationID][containerID] = (containerItem,
                                                              itemsInContainer)

        for stationID in containersInfoByStations.iterkeys():
            stations[stationID].extend([])

        sortlocations = []
        for stationID, stationItems in stations.iteritems():
            stationData = uiSvc.GetStation(stationID)
            if stationData is None:
                continue
            stationsContainersInfo = containersInfoByStations.get(
                stationID, {})
            sortlocations.append((stationData.solarSystemID, stationID,
                                  stationItems, stationsContainersInfo))

        sortlocations.sort()
        sortlocations = sortlocations
        self.searchlist = sortlocations
        sortKey = self.sr.sortcombosearch.GetValue()
        self.ShowSearch(sortKey)
def RealDock(itemID):
    bp = sm.StartService('michelle').GetBallpark()
    if not bp:
        return
    if sm.GetService('viewState').HasActiveTransition():
        return
    eve.Message('OnDockingRequest')
    eve.Message('CustomNotify', {'notify': localization.GetByLabel('UI/Inflight/RequestToDockAt', station=itemID)})
    paymentRequired = 0
    try:
        bp = sm.GetService('michelle').GetRemotePark()
        if bp is not None:
            log.LogNotice('Docking', itemID)
            if uicore.uilib.Key(uiconst.VK_CONTROL) and uicore.uilib.Key(uiconst.VK_SHIFT) and uicore.uilib.Key(uiconst.VK_MENU) and session.role & service.ROLE_GML:
                success = sm.GetService('sessionMgr').PerformSessionChange('dock', bp.CmdTurboDock, itemID)
            else:
                success = sm.GetService('sessionMgr').PerformSessionChange('dock', bp.CmdDock, itemID, session.shipid)
    except UserError as e:
        if e.msg == 'DockingRequestDeniedPaymentRequired':
            sys.exc_clear()
            paymentRequired = e.args[1]['amount']
        else:
            raise
    except Exception as e:
        raise

    if paymentRequired:
        if eve.Message('AskPayDockingFee', {'cost': paymentRequired}, uiconst.YESNO) == uiconst.ID_YES:
            bp = sm.GetService('michelle').GetRemotePark()
            if bp is not None:
                session.ResetSessionChangeTimer('Retrying with docking payment')
                if uicore.uilib.Key(uiconst.VK_CONTROL) and session.role & service.ROLE_GML:
                    sm.GetService('sessionMgr').PerformSessionChange('dock', bp.CmdTurboDock, itemID, paymentRequired)
                else:
                    sm.GetService('sessionMgr').PerformSessionChange('dock', bp.CmdDock, itemID, session.shipid, paymentRequired)
Example #5
0
def SelfDestructShip(pickid):
    if eve.Message('ConfirmSelfDestruct', {}, uiconst.YESNO) == uiconst.ID_YES:
        ship = sm.StartService('gameui').GetShipAccess()
        if ship and not session.stationid:
            log.LogNotice('Self Destruct for', session.shipid)
            sm.StartService('sessionMgr').PerformSessionChange(
                'selfdestruct', ship.SelfDestruct, pickid)
Example #6
0
    def _Populate_t(self, gender, path, key, callBack):
        log.LogInfo('ResData: populating from ', path)
        if gender not in self.genderData:
            self.CreateGenderData(gender)
        genderData = self.genderData[gender]
        entries = genderData.GetEntries(key)
        pathsToEntries = genderData.GetPathsToEntries(key)
        path = path.lower()

        def processAsync(root, respath, dirs, files):
            self._AddEntry(gender, entries, pathsToEntries, root, respath,
                           dirs, files)

        try:
            i = 0
            for root, dirs, files in walk.walk(path):
                if dirs or files:
                    pdCf.BeFrameNice(300)
                    respath = root.split(path)[1]
                    t = uthread.new(processAsync, root, respath, dirs, files)
                    i += 1
                    self._tasklets[t] = True

        finally:
            log.LogNotice('ResData:', i, ' entries populated from ', path)
            if callBack:
                uthread.new(callBack)
    def SetUpCamera(self,
                    camera,
                    category,
                    character,
                    categoryList=SETUP,
                    scene=None,
                    genderID=None):
        if (category, genderID) in categoryList:
            options = categoryList[category, genderID]
        else:
            options = categoryList.get(category, None)
        if options:
            log.LogNotice('+ category = %s' % category)
            boneName, offset, lightSetting = options
            if lightSetting:
                path = '%s%s.red' % (LIGHTLOCATION, lightSetting)
                lightScene = trinity.Load(path)
                ccUtil.SetupLighting(scene, lightScene, lightScene)
            log.LogNotice('before joint')
            joint = 4294967295L
            while joint == 4294967295L:
                log.LogNotice('joint = %s' % joint)
                log.LogNotice('boneName = %s' % boneName)
                joint = character.avatar.GetBoneIndex(boneName)
                log.LogNotice('j = %s' % joint)
                blue.synchro.Yield()
                log.LogNotice('done waiting')

            log.LogNotice('-- joint = %s' % joint)
            poi = character.avatar.GetBonePosition(joint)
            distance, yOffset, xOffset, yaw, pitch = offset
            x, y, z = poi
            if yOffset:
                y += yOffset
            if xOffset:
                x += xOffset
            poi = (x, y, z)
            log.LogNotice('before poi')
            if category in (ccConst.bottomouter, ccConst.feet):
                poi = (0.0, y, z)
            log.LogNotice('before setting camera')
            self.SetCamera(camera, poi, distance, yaw, pitch)
            log.LogNotice('after setting camera')
            return (distance, yaw, pitch, poi)
        else:
            return
Example #8
0
def RealActivateAccelerationGate(itemID):
    if eve.rookieState and not sm.StartService(
            'tutorial').CheckAccelerationGateActivation():
        return
    sm.StartService('sessionMgr').PerformSessionChange(
        localization.GetByLabel('UI/Inflight/ActivateGate'),
        sm.RemoteSvc('keeper').ActivateAccelerationGate,
        itemID,
        violateSafetyTimer=1)
    log.LogNotice('Acceleration Gate activated to ', itemID)
Example #9
0
def RealEnterWormhole(itemID):
    fromSecClass = sm.StartService('map').GetSecurityClass(
        session.solarsystemid)
    if fromSecClass == const.securityClassHighSec and eve.Message(
            'WormholeJumpingFromHiSec', {}, uiconst.YESNO,
            suppress=uiconst.ID_YES) != uiconst.ID_YES:
        return
    log.LogNotice('Wormhole Jump from', session.solarsystemid2, 'to', itemID)
    sm.StartService('sessionMgr').PerformSessionChange(
        localization.GetByLabel('UI/Inflight/EnterWormhole'),
        sm.RemoteSvc('wormholeMgr').WormholeJump, itemID)
Example #10
0
def BoardSMAShip(structureID, shipID):
    ship = sm.StartService('gameui').GetShipAccess()
    if ship:
        log.LogNotice('Boarding SMA ship', structureID, shipID)
        sm.ScatterEvent('OnBeforeActiveShipChanged', shipID,
                        util.GetActiveShip())
        sm.StartService('sessionMgr').PerformSessionChange(
            'board', ship.BoardStoredShip, structureID, shipID)
        shipItem = sm.StartService('godma').GetItem(session.shipid)
        if shipItem and shipItem.groupID != const.groupRookieship:
            sm.StartService('tutorial').OpenTutorialSequence_Check(
                uix.insuranceTutorial)
Example #11
0
def Eject():
    if eve.Message('ConfirmEject', {}, uiconst.YESNO) == uiconst.ID_YES:
        ship = sm.StartService('gameui').GetShipAccess()
        if ship:
            if session.stationid:
                eve.Message('NoEjectingToSpaceInStation')
            else:
                log.LogNotice('Ejecting from ship', session.shipid)
                sm.ScatterEvent('OnBeforeActiveShipChanged', None,
                                util.GetActiveShip())
                sm.StartService('sessionMgr').PerformSessionChange(
                    'eject', ship.Eject)
Example #12
0
    def LogBuy(self, buyItemList):
        totalDisplayed = self.totalAmt.text
        totalSum = self.GetSum()
        multiplier = self.orderMultiplierEdit.GetValue()
        buyTextList = []
        for eachItem in buyItemList:
            text = '[typeID=%s, price=%s, qty=%s]' % (
                eachItem.typeID, eachItem.price, eachItem.quantity)
            buyTextList.append(text)

        buyText = ','.join(buyTextList)
        logInfo = 'Multibuy: totalDisplayed=%s, totalSum=%s, multiplier=%s, buyText=%s' % (
            totalDisplayed, totalSum, multiplier, buyText)
        log.LogNotice(logInfo)
    def EnterAsCharacter(self, charID, loadDungeon, secondChoiceID):
        MAX_RETRIES = 10
        RETRY_SECONDS = 6
        for numTries in xrange(MAX_RETRIES):
            try:
                sm.GetService('sessionMgr').PerformSessionChange('charsel', self.remoteCharacterSvc.SelectCharacterID, charID, loadDungeon, secondChoiceID)
                return
            except UserError as e:
                if e.msg == 'SystemCheck_SelectFailed_Loading' and numTries < MAX_RETRIES - 1:
                    log.LogNotice('System is currently loading. Retrying %s/%s' % (numTries, MAX_RETRIES))
                    blue.pyos.synchro.SleepWallclock(RETRY_SECONDS * 1000)
                else:
                    self.EnableScreen()
                    raise

        self.EnableScreen()
Example #14
0
    def StartDeathScene(self):
        log.LogNotice('DeathTransition:: Starting death scene')
        sceneManager = sm.GetService('sceneManager')
        deathHandler = sm.GetService('gameui').playerDeathHandler
        deathScene = getattr(deathHandler, 'podDeathScene', None)
        if deathScene:
            try:
                deathHandler.podDeathScene = None
                camera = sceneManager.GetRegisteredCamera('default')
                camera.frontClip = 6.0
                corpse = deathHandler.GetCorpseModel()
                corpse.name = 'myCorpse'
                deathScene.objects.insert(0, corpse)
                pod = deathHandler.GetCapsuleModel()
                deathScene.objects.append(pod)
                duration = max(blue.os.desiredSimDilation, 0.2) * 1.75
                uicore.animations.MorphScalar(
                    camera,
                    'translationFromParent',
                    startVal=camera.translationFromParent,
                    endVal=8.0,
                    duration=duration,
                    loops=1)
                uicore.animations.MorphScalar(camera,
                                              'fieldOfView',
                                              startVal=camera.fieldOfView,
                                              endVal=0.55,
                                              duration=duration,
                                              loops=1)
                sceneManager.SetActiveScene(deathScene)
            except Exception:
                log.LogTraceback('Failed at loading podDeathScene',
                                 channel='svc.viewState')

        else:
            log.LogTraceback('Unable to load podDeathScene',
                             channel='svc.viewState')
        self.notifyContainer = uiprimitives.Container(
            name='notifyContainer',
            parent=uicore.desktop,
            state=uiconst.UI_DISABLED,
            align=uiconst.BOTTOMLEFT,
            pos=(20, 0, 500, 100))
        uthread.new(self.WriteCloneActivationText_thread)
Example #15
0
    def StartDeathScene(self):
        log.LogNotice('DeathTransition:: Starting death scene')
        sceneManager = sm.GetService('sceneManager')
        deathHandler = sm.GetService('gameui').playerDeathHandler
        deathScene = getattr(deathHandler, 'podDeathScene', None)
        if deathScene:
            try:
                deathHandler.podDeathScene = None
                sceneManager.SetPrimaryCamera(evecamera.CAM_DEATHSCENE)
                corpse = deathHandler.GetCorpseModel()
                corpse.name = 'myCorpse'
                deathScene.objects.insert(0, corpse)
                pod = deathHandler.GetCapsuleModel()
                deathScene.objects.append(pod)
                sceneManager.SetActiveScene(deathScene)
            except Exception as e:
                log.LogTraceback('Failed at loading podDeathScene: %s' % repr(e), channel='svc.viewState')

        else:
            log.LogTraceback('Unable to load podDeathScene', channel='svc.viewState')
        self.notifyContainer = uiprimitives.Container(name='notifyContainer', parent=uicore.desktop, state=uiconst.UI_DISABLED, align=uiconst.BOTTOMLEFT, pos=(20, 0, 500, 100))
        uthread.new(self.WriteCloneActivationText_thread)
Example #16
0
 def work(self):
     if self.in_work_flag or self.in_fly or self.do_fly: return
     
     self.in_work_flag = True
     
     if self.exp and self.exp['status'] != 4:
         
         if self.exp['status'] == 1:  # 10ка еще не забукана
             
             # Система с 10кой еще не достигнута
             if session.solarsystemid != self.exp['system_id']:
                 self.info('Устанавливаем маршрут до 10ки', self.role)
                 self.set_route(self.exp['system_id'])
                 
                 self.add_flag('fly')
                 
                 self.run_action()
             
             # Находимся в системе с 10кой
             else:
                 journal = sm.GetService('journal')
                 exp_id = self.exp['exp_id']
                 
                 gate = self.get_exp_gate()
                 
                 if exp_id in journal.pathPlexPositionByInstanceID:
                     resp = journal.pathPlexPositionByInstanceID[exp_id]
                 else:
                     resp = sm.RemoteSvc('keeper').CanWarpToPathPlex(exp_id)
                 
                 # Варпаем на врата ускорения
                 if resp is True:
                     self.info('Варпаем на врата ускорения', self.role)
                     
                     self.warp_to_exp()
                 
                 # Если врата в гриде делаем закладку
                 elif gate:
                     self.info('Создаем закладку на 10ку', self.role)
                     
                     self.make_exp_bm(gate)
                     self.set_exp_status(2)
                     
                     self.set_sta_system()
                     
                     bp = sm.GetService('michelle').GetBallpark()
                     
                     if bp:
                         ball = bp.GetBallById(gate.itemID)
                         
                         if ball:
                             
                             mwd = self.get_modules(const.groupAfterBurner)
                             
                             if mwd:
                                 stackless.tasklet(self.modules_on)(mwd)
                             
                             do_action(3 + rnd_keys())
                             
                             movementFunctions.KeepAtRange(gate.itemID, 10000)
                             
                             pause(500)
                             
                             if mwd:
                                 stackless.tasklet(self.modules_off)(mwd)
                             
                             while ball.surfaceDist < 5000 and self.check_in_flags('break'):
                                 pause(100)
                     
                     self.run_action()
         
         elif self.exp['status'] == 2:  # 10ка забукана
             if session.stationid:
                 hangar = invCtrl.StationItems()
                 
                 bms = _bm.get_bookmarks('10/10', True)
                 
                 bmIDs = [x.bookmarkID for x in bms if x.locationID == self.exp['system_id']]
                 
                 if bmIDs:
                     self.info('Переносим буку на станку', self.role)
                     
                     do_action(3 + rnd_keys())
                     
                     hangar.AddBookmarks(bmIDs)
                 
                 self.set_exp_status(3)
                 
                 self.run_action()
             
             elif self.exp['sta_system'] != session.solarsystemid:
                 self.info('Устанавливаем маршрут до станки', self.role)
                 self.set_route(self.exp['sta_system'])
                 
                 self.add_flag('fly')
                 
                 self.run_action()
             
             else:
                 sta = self.get_station()
                 
                 if sta:
                     if sta.surfaceDist() > const.minWarpDistance:
                         self.wait_cooldown()
                         
                         self.info('Варпаем к станке', self.role)
                         sta.warp()
                         
                         self.wait_gate_cloak()
                         self.covert_cloak_on()
                     
                     else:
                         self.info('Докаемся', self.role)
                         self.go(sta)
         
         elif self.exp['status'] == 3:  # 10ка оставлена на ближайшей станке
             self.info('Создаем контракт на буку', self.role)
             
             pause(5000)
             
             if session.stationid:
                 if self.create_contract():
                     self.info('Контракт создан', self.role)
                     
                     self.set_exp_status(4)
                     
                     self.run_action()
                 
                 else:
                     self.warn('Не удалось создать контракт', self.role)
     
     else:
         ret_place = _bm.get_bookmark('RetPlace', ignoreLocation=True)
         
         if ret_place:
             if session.solarsystemid2 != ret_place.locationID:
                 self.info('Устанавливаем маршрут до дома', self.role)
                 
                 self.set_route(ret_place.locationID)
                 
                 self.add_flag('fly')
                 
                 self.run_action()
             
             else:
                 place = self.get_place_by_bm(ret_place)
                 
                 if place.surfaceDist() > const.minWarpDistance:
                     self.wait_cooldown()
                     
                     self.info('Варпаем на ПОС', self.role)
                     
                     place.warp()
                     
                     self.wait_gate_cloak()
                     self.covert_cloak_on()
                 
                 elif place.is_achived():
                     _bm.del_bookmark('RetPlace')
                     
                     ship = self.get_old_ship()
                     
                     if ship:
                         if ship.surfaceDist > 6000:
                             do_action(3 + rnd_keys())
                             
                             sm.GetService('menu').Approach(ship.id)
                         
                         while ship.surfaceDist > 6000:
                             pause(200)
                         
                         self.info('Пересаживаемся на крабский корабль', self.role)
                         
                         do_action(3 + rnd_keys())
                         
                         sm.GetService('menu').Board(ship.id)
                         
                         self.set_yacht_free()
                         
                         # bot.change_args = {}
                         
                         self.warn('Работа с 10ками звершена', self.role)
                         
                         bot.change_role('crub')
                     
                     else:
                         self.warn('Корабль угнан или занят', self.role)
                         
                         ship = sm.StartService('gameui').GetShipAccess()
                         if ship:
                             log.LogNotice('Ejecting from ship', session.shipid)
                             sm.ScatterEvent('OnBeforeActiveShipChanged', None, util.GetActiveShip())
                             sm.StartService('sessionMgr').PerformSessionChange('eject', ship.Eject)
                         
                         self.set_yacht_free()
                         
                         sm.ScatterEvent('OnScriptBreak')
                 
                 else:
                     self.go(place)
     
     self.in_work_flag = False