From eca916dfaf8ba7583517b6b8821781e3953875f8 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Tue, 19 Aug 2014 22:51:25 +0100 Subject: [PATCH] Further information in the ID command. --- dropbot/bot.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dropbot/bot.py b/dropbot/bot.py index 11f9feb..1953aa7 100644 --- a/dropbot/bot.py +++ b/dropbot/bot.py @@ -468,14 +468,25 @@ class DropBot(ClientXMPP): from collections import defaultdict kill_types = defaultdict(int) + ship_types = defaultdict(int) + alli_assoc = defaultdict(int) sum_value = 0.0 for kill in res: kill_types[kill['victim']['shipTypeID']] += 1 sum_value += float(kill['zkb']['totalValue']) + for attk in kill['attackers']: + alli_assoc[attk['allianceName']] += 1 + if int(attk['characterID']) == char_id: + ship_types[attk['shipTypeID']] += 1 - return '{}, {} kill(s) ({} ISK) in the last week\nActive Systems: {}'.format( + if len(res) == 0: + return '{} has had no kills in the last week'.format(char_name) + + return '{}, {} kill(s) ({} ISK) in the last week\nActive Systems: {}\nActive Ship Types: {}\nAssociates With: {}'.format( char_name, len(res), intcomma(sum_value), - ', '.join(set([self.map.node[int(x['solarSystemID'])]['name'] for x in res])) + ', '.join(set([self.map.node[int(x['solarSystemID'])]['name'] for x in res])), + ', '.join(set([self.types[unicode(x)] for x in ship_types.keys()])), + ', '.join(set([x for x in alli_assoc.keys() if x.strip() != ''])) )