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.cannotSellItemList.append(item) sellable = False elif cfg.invtypes.Get(item.typeID).marketGroupID is None: self.cannotSellItemList.append(item) sellable = False elif item.ownerID not in [session.corpid, session.charid]: self.cannotSellItemList.append(item) sellable = False elif item.itemID == GetActiveShip(): self.cannotSellItemList.append(item) sellable = False elif bool( item.singleton) and item.categoryID == const.categoryBlueprint: self.cannotSellItemList.append(item) sellable = False elif not CheckIfInHangarOrCorpHangarAndCanTake(item): self.cannotSellItemList.append(item) sellable = False return sellable
def ProcessInventoryChange(self, items, change, isRemote, inventory2): """Translate inventory changes into session changes""" if macho.mode != 'server': return if isRemote: return if const.ixLocationID not in change and const.ixFlag not in change: return locationID = locationGroupID = None if const.ixLocationID in change: locationID = change[const.ixLocationID][1] if IsSolarSystem(locationID): locationGroupID = const.groupSolarSystem elif IsStation(locationID): locationGroupID = const.groupStation chars = {} for item in items: if item.categoryID == const.categoryShip and None not in (locationID, locationGroupID): inv2 = self.i2.GetInventory(locationID, locationGroupID) for i in inv2.SelectItems(item.itemID): if i.groupID == const.groupCharacter: chars[i.itemID] = self.GetSessionValuesFromItemID(item.itemID, inventory2, item) elif item.groupID == const.groupCharacter: if const.ixLocationID in change and item.customInfo == logConst.eventMovementUndock: continue chars[item.itemID] = self.GetSessionValuesFromItemID(item.itemID, inventory2, item) if len(chars) == 0: return for charID, updateDict in chars.iteritems(): for sess in base.FindSessions('charid', [charID]): sess.LogSessionHistory('Transmogrifying OnInventoryChange to SetAttributes') sess.SetAttributes(updateDict) sess.LogSessionHistory('Transmogrified OnInventoryChange to SetAttributes')
def IsWithinRange(self): if IsStation(self.facilityID): return self.facilityID == session.stationid2 if session.solarsystemid: bp = sm.GetService('michelle').GetBallpark() if bp is None: return False return bp.GetBall(self.facilityID) is not None return False
def IsWithinRange(self): """ Is this blueprint within inventory interaction range """ if IsStation(self.facilityID): return self.facilityID == session.stationid2 if session.solarsystemid: bp = sm.GetService('michelle').GetBallpark() if bp is None: return False return bp.GetBall(self.facilityID) is not None return False
def GetSessionValuesFromItemID(self, itemID, inventory2 = None, theItem = None): if itemID == const.locationAbstract: raise RuntimeError('Invalid argument, itemID cannot be 0') def GetItem(id): return sm.services['i2'].GetItemMx(id) updateDict = {'shipid': None, 'stationid': None, 'stationid2': None, 'structureid': None, 'solarsystemid': None, 'solarsystemid2': None, 'regionid': None, 'constellationid': None, 'worldspaceid': None} solsysID = None while 1: if inventory2 is None: item = GetItem(itemID) elif theItem and theItem.itemID == itemID: item = theItem elif itemID < const.minPlayerItem: if IsStation(itemID): station = self.stationSvc.GetStation(itemID) updateDict['stationid'] = itemID updateDict['stationid2'] = itemID solsysID = station.solarSystemID break else: item = inventory2.InvGetItem(itemID) else: item = inventory2.InvGetItem(itemID, 1) if item.categoryID == const.categoryShip: updateDict['shipid'] = itemID elif item.groupID == const.groupStation: updateDict['stationid'] = itemID updateDict['stationid2'] = itemID updateDict['worldspaceid'] = itemID solsysID = item.locationID break elif item.categoryID == const.categoryStructure: updateDict['structureid'] = itemID elif item.groupID == const.groupWorldSpace: updateDict['worldspaceid'] = itemID locationID = item.locationID if not IsStation(locationID): raise RuntimeError('Setting stationid2 = %s which is not a station!' % locationID) updateDict['stationid2'] = locationID station = self.stationSvc.GetStation(locationID) solsysID = station.solarSystemID break elif item.typeID == const.typeSolarSystem: solsysID = item.itemID updateDict['solarsystemid'] = itemID break elif item.locationID == const.locationAbstract: break itemID = item.locationID if solsysID is not None: primeditems = sm.services['i2'].__primeditems__ if solsysID in primeditems: updateDict['solarsystemid2'] = solsysID updateDict['constellationid'] = primeditems[solsysID].locationID updateDict['regionid'] = primeditems[updateDict['constellationid']].locationID return updateDict