def patrolcontested(startsystem, maxlength): db = DBConnection() systems = db.get_interesting_systems_for_hot() apiroot = api.root() contested = [] for row in apiroot.map.FacWarSystems().solarSystems: if ((row.owningFactionID in (MINMATAR_REPUBLIC, AMARR_EMPIRE) or row.occupyingFactionID in (MINMATAR_REPUBLIC, AMARR_EMPIRE) ) and row.contested == 'True' ): contested.append((0, row.solarSystemID)) return patrol_generic(db, startsystem, maxlength, systems, contested)
def patrol(startsystem, maxlength): db = DBConnection() systems = db.get_interesting_systems_for_hot() apiroot = api.root() kills = [] data = apiroot.map.Kills() datatime = datetime.datetime.utcfromtimestamp(data.dataTime) for row in data.solarSystems: if (row.shipKills > 0 and row.solarSystemID in systems ): kills.append((row.shipKills, row.solarSystemID)) killdict = dict((sysid, nkills) for (nkills, sysid) in kills) kills.sort(key=lambda elt: (-elt[0], elt[1])) return patrol_generic(db, startsystem, maxlength, systems, kills)
def hot(): db = DBConnection() systems = db.get_interesting_systems_for_hot() apiroot = api.root() kills = [] data = apiroot.map.Kills() datatime = datetime.datetime.utcfromtimestamp(data.dataTime) for row in data.solarSystems: if (row.shipKills > 0 and row.solarSystemID in systems ): kills.append((row.shipKills, systems[row.solarSystemID])) kills.sort(key=lambda elt: (-elt[0], elt[1])) return (", ".join("{1} ({0})".format(*row) for row in kills[:20]) + " (from {0})".format(datatime.strftime("%Y-%m-%d %H:%M:%S")))
def pricecheck(typename): conn = DBConnection() typename, typeid = conn.find_type(typename) if typeid is None: return {'typenames': typename} corplist = conn.sold_by_npccorps(typeid) if len(corplist) > 0: return {'source': 'npc', 'typename': typename, 'corporations': corplist, 'price': conn.baseprice(typeid) * 0.9} if conn.marketgroup(typeid) is None: return {'source': 'contracts', 'typename': typename, 'price': faction_pricecheck(typeid)} marketorders = list(evecentral.quicklook(typeid=typeid, sethours=7 * 24, regionlimit=[REGION_HEIMATAR, REGION_METROPOLIS, REGION_MOLDENHEATH, REGION_THEFORGE])) marketorders.extend(conn.pricecheck(typeid=typeid, sethours=7 * 24, regionlimit=[REGION_HEIMATAR, REGION_METROPOLIS, REGION_MOLDENHEATH, REGION_THEFORGE])) if len(marketorders) == 0: return {'source': 'market', 'price': None} marketorders.sort(key=lambda order: order['price']) order = marketorders[0] if 'systemname' not in order: if 'stationid' in order: order['systemname'] = conn.stationid2systemname(order['stationid']) if 'regionname' not in order: order['regionname'] = conn.itemname(order['regionid']) return {'source': 'market', 'typename': typename, 'price': order['price'], 'quantity': order['quantity'], 'system': order['systemname'], 'region': order['regionname'], 'checked': order['checked']}