Beispiel #1
0
 def IsSellable(self, item):
     sellable = True
     if item.itemID in self.itemDict.keys():
         self.itemAlreadyInList.append(item)
         sellable = False
     elif item.singleton:
         self.itemsNeedRepackaging.append(item)
         sellable = False
     elif IsStation(item.itemID):
         self.cannotTradeItemList.append(item)
         sellable = False
     elif evetypes.GetMarketGroupID(item.typeID) is None:
         self.cannotTradeItemList.append(item)
         sellable = False
     elif item.ownerID not in [session.corpid, session.charid]:
         self.cannotTradeItemList.append(item)
         sellable = False
     elif item.itemID == GetActiveShip():
         self.cannotTradeItemList.append(item)
         sellable = False
     elif bool(item.singleton) and item.categoryID == const.categoryBlueprint:
         self.cannotTradeItemList.append(item)
         sellable = False
     elif not CheckIfInHangarOrCorpHangarAndCanTake(item):
         self.cannotTradeItemList.append(item)
         sellable = False
     return sellable
Beispiel #2
0
 def OnClick(self, *args):
     if self.sr.node:
         if evetypes.GetMarketGroupID(self.sr.node.invtype) is None:
             return
         self.sr.node.scroll.SelectNode(self.sr.node)
         eve.Message('ListEntryClick')
         if self.sr.node.Get('OnClick', None):
             self.sr.node.OnClick(self)
Beispiel #3
0
    def GetModuleLists(self):
        test = {}
        groups = dict.fromkeys([
            groupID
            for groupID in evetypes.GetGroupIDsByCategory(const.categoryModule)
        ])
        for k in cfg.invmetatypesByParent.iterkeys():
            rowset = cfg.invmetatypesByParent[k]
            for row in rowset:
                if row.metaGroupID == 2:
                    typeID = row.typeID
                    if evetypes.Exists(typeID) and evetypes.GetMarketGroupID(
                            typeID) and evetypes.GetCategoryID(
                                typeID) == const.categoryModule:
                        test[evetypes.GetGroupID(typeID)] = typeID

        for typeID in evetypes.Iterate():
            groupID = evetypes.GetGroupID(typeID)
            if groupID not in test and groupID in groups:
                if not cfg.invmetatypesByParent.has_key(typeID):
                    if evetypes.GetMarketGroupID(typeID):
                        test[groupID] = typeID

        targeted = []
        activated = []
        passive = []
        for typeID in test.values():
            effects = [
                cfg.dgmeffects.Get(row.effectID)
                for row in cfg.dgmtypeeffects.get(typeID, [])
            ]
            effectCategories = [
                eff.effectCategory for eff in effects
                if eff.effectName != 'online'
            ]
            if const.dgmEffTarget in effectCategories:
                targeted.append((typeID, effects))
            elif const.dgmEffActivation in effectCategories:
                activated.append((typeID, effects))
            else:
                passive.append((typeID, effects))

        return (targeted, activated, passive)
Beispiel #4
0
def GetMarketTypes():
    data = []
    for typeID in evetypes.Iterate():
        blue.pyos.BeNice()
        if evetypes.IsPublished(typeID) and evetypes.IsGroupPublished(
                typeID) and evetypes.IsCategoryPublished(typeID):
            data.append(
                util.KeyVal(typeID=typeID,
                            marketGroupID=evetypes.GetMarketGroupID(typeID),
                            typeName=evetypes.GetName(typeID)))

    return data
Beispiel #5
0
 def GetItemMenu(self, typeID):
     m = []
     m.append((MenuLabel('UI/Commands/ShowInfo'),
               sm.GetService('info').ShowInfo, (typeID, )))
     if evetypes.GetMarketGroupID(typeID) is not None:
         m.append(
             (MenuLabel('UI/Inventory/ItemActions/ViewTypesMarketDetails'),
              sm.GetService('marketutils').ShowMarketDetails, (typeID,
                                                               None)))
         m.append(
             (MenuLabel('UI/Inventory/ItemActions/AddTypeToMarketQuickbar'),
              sm.GetService('marketutils').AddTypeToQuickBar, (typeID, )))
     return m
Beispiel #6
0
 def GetTopLevelMarketGroupID(self, typeID):
     marketGroupIDFromType = None
     marketGroupID = evetypes.GetMarketGroupID(typeID)
     if marketGroupID is None:
         typeID = sm.GetService('info').GetMetaParentTypeID(typeID)
         if typeID is not None:
             marketGroupIDFromType = evetypes.GetMarketGroupID(
                 sm.GetService('info').GetMetaParentTypeID(typeID))
             topLevelMarketGroupID = self.GetTopLevelMarketGroupIDEx(
                 marketGroupIDFromType)
         else:
             return -1
     else:
         topLevelMarketGroupID = self.GetTopLevelMarketGroupIDEx(
             marketGroupID)
     if not self.topLevelMarketGroup:
         if marketGroupIDFromType:
             self.topLevelMarketGroup = self.GetTopLevelMarketGroupIDEx(
                 marketGroupIDFromType)
         else:
             self.topLevelMarketGroup = self.GetTopLevelMarketGroupIDEx(
                 marketGroupID)
     return topLevelMarketGroupID
Beispiel #7
0
 def Load(self, node):
     GenericMarketItem.Load(self, node)
     self.sr.sublevel = node.Get('sublevel', 0)
     self.sr.label.left = 12 + max(0, self.sr.sublevel * 16)
     if node.get('extraText', ''):
         self.sr.label.text = localization.GetByLabel('UI/Market/Marketbase/QuickbarTypeNameWithExtraText', typeName=node.label, extraText=node.get('extraText', ''))
     else:
         self.sr.label.text = node.label
     if evetypes.GetMarketGroupID(node.invtype) is None:
         self.SetOpacity(0.5)
         if self.hint is not None:
             self.hint += '<br>'
         else:
             self.hint = ''
         self.hint += localization.GetByLabel('UI/Market/Marketbase/NotAvailableOnMarket')
Beispiel #8
0
 def GetMenu(self):
     m = []
     c = self.sr.node.contract
     node = self.sr.node
     m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/ViewContract'),
               self.ViewContract, (node, )))
     if c.startSolarSystemID and c.startSolarSystemID != eve.session.solarsystemid2:
         m.append((uiutil.MenuLabel('UI/Generic/ShowRoute'), self.ShowRoute,
                   (node, )))
     if c.startStationID:
         typeID = self.GetStationType(c.startStationID)
         m += [
             (uiutil.MenuLabel('UI/Contracts/ContractEntry/PickupStation'),
              ('isDynamic', sm.GetService('menu').CelestialMenu,
               (c.startStationID, None, None, 0, typeID)))
         ]
     if c.endStationID and c.endStationID != c.startStationID:
         typeID = self.GetStationType(c.endStationID)
         m += [
             (uiutil.MenuLabel('UI/Contracts/ContractEntry/DropOffStation'),
              ('isDynamic', sm.GetService('menu').CelestialMenu,
               (c.endStationID, None, None, 0, typeID)))
         ]
     if c.type == const.conTypeAuction and c.issuerID != eve.session.charid and c.status == const.conStatusOutstanding and c.dateExpired > blue.os.GetWallclockTime(
     ):
         m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/PlaceBid'),
                   self.PlaceBid, (node, )))
     if self.sr.node.Get('canDismiss', False):
         m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/Dismiss'),
                   self.Dismiss, (node, )))
     if self.sr.node.Get('canGetItems', False):
         m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/GetItems'),
                   self.GetItems, (node, )))
     if self.sr.node.Get('canGetMoney', False):
         m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/GetMoney'),
                   self.GetMoney, (node, )))
     if self.sr.node.Get('canIgnore',
                         True) and c.issuerID != eve.session.charid:
         m.append((uiutil.MenuLabel(
             'UI/Contracts/ContractEntry/IgnoreFromThisIssuer'),
                   self.AddIgnore, (node, )))
     typeID = self.sr.node.Get('typeID', None)
     if typeID and self.sr.node.contract.type != const.conTypeCourier:
         m.append(None)
         m.append((uiutil.MenuLabel('UI/Commands/ShowInfo'),
                   sm.GetService('info').ShowInfo, (typeID, )))
         if evetypes.GetMarketGroupID(typeID) is not None:
             m.append((uiutil.MenuLabel(
                 'UI/Inventory/ItemActions/ViewTypesMarketDetails'),
                       sm.GetService('marketutils').ShowMarketDetails,
                       (typeID, None)))
     m.append(None)
     if c.issuerID == eve.session.charid:
         m.append((uiutil.MenuLabel('UI/Contracts/ContractEntry/Delete'),
                   self.Delete, (node, )))
     if session.role & service.ROLE_GML > 0:
         m.append(('GM - contractID: %s' % node.contract.contractID,
                   blue.pyos.SetClipboardData,
                   (str(node.contract.contractID), )))
         m.append(
             ('GM - issuerID: %s' % node.contract.issuerID,
              blue.pyos.SetClipboardData, (str(node.contract.issuerID), )))
         m.append(('GM - Expire now', self._ExpireContract,
                   (node.contract.contractID, )))
     return m
Beispiel #9
0
 def IsBuyable(self, itemKeyVal):
     buyable = True
     if evetypes.GetMarketGroupID(itemKeyVal.typeID) is None:
         self.cannotTradeItemList.append(itemKeyVal)
         buyable = False
     return buyable
Beispiel #10
0
    def Test(self, *args):
        if eve.session.stationid:
            return
        self.Hide()

        def _Click(module):
            module.Click()
            while module.sr.glow.state == uiconst.UI_HIDDEN:
                blue.pyos.synchro.SleepWallclock(1)

            try:
                module.Click()
            except:
                pass

        def _Idle(module):
            return module.sr.glow.state == uiconst.UI_HIDDEN and module.sr.busy.state == uiconst.UI_HIDDEN and module.blinking == False and module.reloadingAmmo is False

        def _WaitForIdle(module, timeout=60000, reason=None):
            if reason:
                print 'WaitForIdle: %s' % reason
            blue.pyos.synchro.SleepWallclock(100)
            timeout -= 100
            while not _Idle(module) and timeout > 0:
                blue.pyos.synchro.SleepWallclock(100)
                timeout -= 100

        self.GetAmmo()
        t, a, p = self.GetModuleLists()
        ship = sm.GetService('godma').GetItem(eve.session.shipid)
        if eve.session.role & ROLE_PROGRAMMER:
            if ship.cpuOutput != 13371337:
                w = sm.RemoteSvc('slash')
                w.SlashCmd('/dogma me cpuOutput = 13371337')
                w.SlashCmd('/dogma me powerOutput = 10000000')
                w.SlashCmd('/dogma me hiSlots = 8')
                w.SlashCmd('/dogma me medSlots = 8')
                w.SlashCmd('/dogma me lowSlots = 8')
                w.SlashCmd('/dogma me rigSlots = 8')
                w.SlashCmd('/dogma me upgradeCapacity = 10000')
                w.SlashCmd('/dogma me turretSlotsLeft = 8')
                w.SlashCmd('/dogma me launcherSlotsLeft = 8')
                w.SlashCmd('/dogma me upgradeSlotsLeft = 8')
                w.SlashCmd('/dogma me capacity = 1000000')
                w.SlashCmd('/dogma me capacitorCapacity = 1000000')
        errors = []
        t = filter(lambda x: self.testgroups[x[0].groupID], t + a)
        total = len(t)
        current = 0
        while t:
            sm.RemoteSvc('slash').SlashCmd('/unload me all')
            slotsLeft = {
                'hiPower':
                [x + const.flagHiSlot0 for x in range(int(ship.hiSlots))],
                'medPower':
                [x + const.flagMedSlot0 for x in range(int(ship.medSlots))],
                'loPower':
                [x + const.flagLoSlot0 for x in range(int(ship.lowSlots))],
                'rigSlot':
                [x + const.flagRigSlot0 for x in range(int(ship.rigSlots))]
            }
            for item in t[:]:
                typeID, effects = item
                Progress(
                    'Module Test', 'Fitting %d/%d: %s' %
                    (current, total, evetypes.GetName(typeID)), current, total)
                current += 1
                try:
                    slotType = [
                        eff.effectName for eff in effects
                        if eff.effectName.endswith('Power')
                        or eff.effectName == 'rigSlot'
                    ][0]
                    if slotsLeft[slotType]:
                        sm.RemoteSvc('slash').SlashCmd('/fit me %s' % typeID)
                        t.remove(item)
                        flag = slotsLeft[slotType].pop(0)
                        module = []
                        while not module:
                            blue.pyos.synchro.SleepSim(500)
                            module = [
                                x for x in sm.GetService('godma').GetItem(
                                    eve.session.shipid).modules
                                if x.flagID == flag
                            ]

                        if not eve.session.stationid:
                            sm.RemoteSvc('slash').SlashCmd('/heal me capac=1')
                        if slotsLeft.values() == [[], [], [], []]:
                            break
                except UserError as e:
                    errors.append((typeID, str(e)))

            Progress('Module Test', 'Testing, hold on...', current, total)
            for itemID in sm.GetService('target').GetTargets():
                slimItem = uix.GetBallparkRecord(itemID)
                if slimItem.typeID == 12403:
                    break
            else:
                itemID = sm.RemoteSvc('slash').SlashCmd('/spawn 12403 victim')
                sm.GetService('target').ClearTargets()
                sm.GetService('target').LockTarget(itemID)
                slimItem = uix.GetBallparkRecord(itemID)

            if slimItem:
                sm.GetService('state').SetState(slimItem.itemID,
                                                state.selected, 1)
                sm.GetService('state').SetState(slimItem.itemID,
                                                state.activeTarget, 1)
            if not uicore.layer.shipui:
                return
            for module in uicore.layer.shipui.slotsContainer.modulesByID.itervalues(
            ):
                module.SetRepeat(1000)
                attr = sm.GetService('godma').GetType(module.moduleinfo.typeID)
                groups = []
                for x in range(1, 4):
                    if attr.AttributeExists('chargeGroup%d' % x):
                        groups.append(getattr(attr, 'chargeGroup%d' % x))

                if groups:
                    module.SetAutoReload(0)
                    for gid in groups:
                        for ammo in self.ammo[gid]:
                            if ammo.chargeSize == attr.chargeSize and evetypes.GetMarketGroupID(
                                    ammo.typeID):
                                print '%s <- %s' % (evetypes.GetName(
                                    attr.typeID), evetypes.GetName(
                                        ammo.typeID))
                                sm.RemoteSvc('slash').SlashCmd('/create %d' %
                                                               ammo.typeID)
                                try:
                                    module.ChangeAmmo(module.id, 1,
                                                      ammo.typeID)
                                    _WaitForIdle(module,
                                                 2000,
                                                 reason='pre-activate')
                                    if attr.chargeSize == 4:
                                        blue.pyos.synchro.SleepSim(5000)
                                    else:
                                        blue.pyos.synchro.SleepSim(1000)
                                    _Click(module)
                                    _WaitForIdle(module,
                                                 reason='post-activate')
                                except UserError as e:
                                    errors.append(
                                        (module.moduleinfo.typeID, str(e)))

                                sm.RemoteSvc('slash').SlashCmd(
                                    '/unload me %d' % ammo.typeID)
                                break

                        break

                else:
                    try:
                        _Click(module)
                    except UserError as e:
                        errors.append((module.moduleinfo.typeID, str(e)))

            busy = True
            timeout = 30000
            while busy and timeout > 0:
                blue.pyos.synchro.SleepSim(250)
                timeout -= 250
                for module in uicore.layer.shipui.slotsContainer.modulesByID.itervalues(
                ):
                    if not _Idle(module):
                        break
                else:
                    busy = False

        Progress('Module Test', 'Done!', 3, 4)
        blue.pyos.synchro.Sleep(2000)
        Progress('Module Test', 'Done!', 4, 4)
        for typeID, errormsg in errors:
            self.LogError('%d: %s' % (typeID, errormsg))