Exemple #1
0
    def unload(self):
        if self.unloadToPOS:
            hangar = self.get_pos_hungar(self.arrayName, self.divName)
        else:
            if not session.stationid:
                self.warn(
                    'Не могу выгрузить ресурсы, необходимо находиться на станции',
                    self.role)
                return

            hangar = invCtrl.StationItems()

        if not hangar:
            self.warn('Не могу получить доступ к ангару', self.role)
            return

        cargo = self.get_ore_cargo()

        do_action(4 + rnd_keys())

        cargo.StackAll()

        pause(1000)

        # Перемещаем ресурсы из трюма в ангар
        all_items = self.get_cargo_items(cargo)

        pause(1000)

        items = []

        if self.isZipping:
            _type = cnt.typesCompress
        else:
            _type = cnt.typesNotCompress

        for item in all_items:
            if item.typeID in _type:
                items.append(item)

        if items:
            while self.jet_is_busy(hangar.itemID):
                pause(500)

            bot.log.info('Перемещаем ресурсы из трюма в ангар', self.role)

            do_action(5 + rnd_keys())

            hangar.AddItems(items)

            self.jet_free(hangar.itemID)

        if self.check_in_flags('unload'):
            self.del_flag('unload')

            self.run_action()
Exemple #2
0
 def GetInvController(self):
     groupID = evetypes.GetGroupID(self.typeID)
     if groupID in CONTAINERGROUPS:
         invController = invCtrl.StationContainer(self.itemID, self.typeID)
     elif self.typeID == const.typeOffice:
         divisionNum = const.corporationDivisionFromFlag.get(self.flagID)
         invController = invCtrl.StationCorpHangar(self.itemID, divisionNum)
     elif groupID in (const.groupAssemblyArray,
                      const.groupMobileLaboratory):
         divisionNum = const.corporationDivisionFromFlag.get(self.flagID)
         invController = invCtrl.POSCorpHangar(self.itemID, divisionNum)
     else:
         invController = invCtrl.StationItems(self.itemID)
     return invController
Exemple #3
0
    def Paste(self, value):
        items, copy = sm.GetService('inv').PopItemClipboard()
        if copy and bool(session.role & service.ROLE_PROGRAMMER):
            import param
            for item in items:
                itemID = sm.GetService('slash').cmd_createitem(param.ParamObject('%s %s' % (item.rec.typeID, item.rec.stacksize)))
                if itemID:
                    invController = invCtrl.StationItems() if session.stationid else invCtrl.ShipCargo()
                    blue.synchro.SleepWallclock(100)
                    newItem = invController.GetItem(itemID)
                    self.invController.AddItems([newItem])

        else:
            self.invController.OnDropData(items)
 def GetInvController(self):
     typeObj = cfg.invtypes.Get(self.typeID)
     if typeObj.groupID in CONTAINERGROUPS:
         invController = invCtrl.StationContainer(self.itemID, self.typeID)
     elif typeObj.typeID == const.typeOffice:
         corpFlags = const.corpHangarTakeRolesByFlag.keys()
         divisionNum = corpFlags.index(self.flagID)
         invController = invCtrl.StationCorpHangar(self.itemID, divisionNum)
     elif typeObj.groupID in (const.groupAssemblyArray, const.groupMobileLaboratory):
         corpFlags = const.corpHangarTakeRolesByFlag.keys()
         divisionNum = corpFlags.index(self.flagID)
         invController = invCtrl.POSCorpHangar(self.itemID, divisionNum)
     else:
         invController = invCtrl.StationItems(self.itemID)
     return invController
Exemple #5
0
 def create_contract(self):
     
     self.do_pass()
     
     items = []
     
     hangar = invCtrl.StationItems()
     
     for item in hangar.GetItems():
         if item.typeID == const.typeBookmark:
             items.append([item.itemID, 1])
     
     contractID = None
     
     if items:
         args = (
             const.conTypeItemExchange,  # type
             True,  # avail
             XXXXXXXXX,  # assigneeID
             1440,  # expiretime
             0,  # duration
             long(session.stationid),  # startStationID
             None,  # endStationID
             0,  # price
             0,  # reward
             0,  # collateral
             self.get_label(),  # title
             '',  # description
             items,  # itemList
             4,  # flag
             [],  # requestItemTypeList
             False  # forCorp
         )
         
         try:
             do_action(15 + rnd_keys(), 24 + rnd_keys(3, 15))
             
             contractID = sm.GetService('contracts').CreateContract(*args)
         except UserError as e:
             self.warn('Ошибка создания контракта: {}'.format(e.msg), self.role)
     
     return contractID
Exemple #6
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
Exemple #7
0
    def GetInvLocationTreeData(self, rootInvID = None):
        """ Returns a tree of all inventory locations currently accessible to the player """
        data = []
        shipID = util.GetActiveShip()
        typeID = None
        if shipID:
            if session.stationid2:
                activeShip = invCtrl.StationShips().GetActiveShip()
                if activeShip:
                    typeID = activeShip.typeID
            else:
                godmaLoc = sm.GetService('clientDogmaIM').GetDogmaLocation()
                if shipID in godmaLoc.dogmaItems:
                    typeID = godmaLoc.dogmaItems[shipID].typeID
            if typeID:
                data.append(TreeDataShip(clsName='ShipCargo', itemID=shipID, typeID=typeID, cmdName='OpenCargoHoldOfActiveShip'))
        if session.stationid2:
            shipsData = []
            activeShipID = util.GetActiveShip()
            singletonShips = [ ship for ship in invCtrl.StationShips().GetItems() if ship.singleton == 1 and ship.itemID != activeShipID ]
            cfg.evelocations.Prime([ ship.itemID for ship in singletonShips ])
            for ship in singletonShips:
                shipsData.append(TreeDataShip(clsName='ShipCargo', itemID=ship.itemID, typeID=ship.typeID))

            SortData(shipsData)
            data.append(TreeDataInv(clsName='StationShips', itemID=session.stationid2, children=shipsData, cmdName='OpenShipHangar'))
            containersData = GetContainerDataFromItems(invCtrl.StationItems().GetItems())
            data.append(TreeDataInv(clsName='StationItems', itemID=session.stationid2, children=containersData, cmdName='OpenHangarFloor'))
            if sm.GetService('corp').GetOffice() is not None:
                forceCollapsedMembers = not (rootInvID and rootInvID[0] in ('StationCorpMember', 'StationCorpMembers'))
                forceCollapsed = not (rootInvID and rootInvID[0] in ('StationCorpHangar', 'StationCorpHangars'))
                data.append(TreeDataStationCorp(forceCollapsed=forceCollapsed, forceCollapsedMembers=forceCollapsedMembers))
            deliveryRoles = const.corpRoleAccountant | const.corpRoleJuniorAccountant | const.corpRoleTrader
            if session.corprole & deliveryRoles > 0:
                data.append(TreeDataInv(clsName='StationCorpDeliveries', itemID=session.stationid2, cmdName='OpenCorpDeliveries'))
        elif session.solarsystemid:
            starbaseData = []
            defensesData = []
            industryData = []
            hangarData = []
            infrastrcutureData = []
            bp = sm.GetService('michelle').GetBallpark()
            if bp:
                for slimItem in bp.slimItems.values():
                    itemID = slimItem.itemID
                    groupID = slimItem.groupID
                    if HasCargoBayComponent(slimItem.typeID):
                        if slimItem.ownerID == session.charid or cfg.spaceComponentStaticData.GetAttributes(slimItem.typeID, CARGO_BAY).allowFreeForAll:
                            data.append(TreeDataInv(clsName='SpaceComponentInventory', itemID=itemID))
                    haveAccess = bool(slimItem) and (slimItem.ownerID == session.charid or slimItem.ownerID == session.corpid or session.allianceid and slimItem.allianceID == session.allianceid)
                    isAnchored = not bp.balls[itemID].isFree
                    if not haveAccess or not isAnchored:
                        continue
                    if groupID == const.groupControlTower:
                        towerData = [TreeDataInv(clsName='POSStrontiumBay', itemID=itemID), TreeDataInv(clsName='POSFuelBay', itemID=itemID)]
                        starbaseData.append(TreeDataCelestialParent(clsName='BaseCelestialContainer', itemID=itemID, children=towerData, iconName='ui_7_64_10'))
                    elif groupID == const.groupCorporateHangarArray:
                        hangarData.append(TreeDataPOSCorp(slimItem=slimItem))
                    elif groupID == const.groupAssemblyArray:
                        industryData.append(TreeDataPOSCorp(slimItem=slimItem))
                    elif groupID == const.groupMobileLaboratory:
                        industryData.append(TreeDataPOSCorp(slimItem=slimItem))
                    elif groupID == const.groupJumpPortalArray:
                        infrastrcutureData.append(TreeDataInv(clsName='POSJumpBridge', itemID=itemID))
                    elif groupID in (const.groupMobileMissileSentry, const.groupMobileProjectileSentry, const.groupMobileHybridSentry):
                        defensesData.append(TreeDataInv(clsName='POSStructureCharges', itemID=itemID))
                    elif groupID == const.groupMobileLaserSentry:
                        sentryData = [TreeDataInv(clsName='POSStructureChargeCrystal', itemID=itemID), TreeDataInv(clsName='POSStructureChargesStorage', itemID=itemID)]
                        defensesData.append(TreeDataCelestialParent(clsName='BaseCelestialContainer', itemID=itemID, children=sentryData, iconName='ui_13_64_9'))
                    elif groupID == const.groupShipMaintenanceArray:
                        hangarData.append(TreeDataInv(clsName='POSShipMaintenanceArray', itemID=itemID))
                    elif groupID == const.groupSilo:
                        industryData.append(TreeDataInv(clsName='POSSilo', itemID=itemID))
                    elif groupID == const.groupMobileReactor:
                        industryData.append(TreeDataInv(clsName='POSMobileReactor', itemID=itemID))
                    elif groupID == const.groupReprocessingArray:
                        industryData.append(TreeDataInv(clsName='POSRefinery', itemID=itemID))
                    elif groupID == const.groupCompressionArray:
                        industryData.append(TreeDataInv(clsName='POSCompression', itemID=itemID))
                    elif groupID in (const.groupConstructionPlatform, const.groupStationUpgradePlatform, const.groupStationImprovementPlatform):
                        industryData.append(TreeDataInv(clsName='POSConstructionPlatform', itemID=itemID))
                    elif groupID == const.groupPersonalHangar:
                        hangarData.append(TreeDataInv(clsName='POSPersonalHangar', itemID=itemID))

            if industryData:
                SortData(industryData)
                starbaseData.append(TreeDataInvFolder(label=localization.GetByLabel('UI/Inventory/POSGroupIndustry'), children=industryData, icon='res:/UI/Texture/WindowIcons/industry.png'))
            if hangarData:
                SortData(hangarData)
                starbaseData.append(TreeDataInvFolder(label=localization.GetByLabel('UI/Inventory/POSGroupStorage'), children=hangarData, icon='ui_26_64_13'))
            if infrastrcutureData:
                SortData(infrastrcutureData)
                starbaseData.append(TreeDataInvFolder(label=localization.GetByLabel('UI/Inventory/POSGroupInfrastructure'), children=infrastrcutureData, icon='res:/ui/Texture/WindowIcons/sovereignty.png'))
            if defensesData:
                SortData(defensesData)
                starbaseData.append(TreeDataInvFolder(label=localization.GetByLabel('UI/Inventory/POSGroupDefenses'), children=defensesData, icon='ui_5_64_13'))
            if starbaseData:
                data.append(TreeDataInvFolder(label=localization.GetByLabel('UI/Inventory/StarbaseStructures'), children=starbaseData, icon='ui_3_64_13'))
        return TreeData(children=data)