 
 #semi-mute
 #if (msg.random([0..10]) < 3)
+
+report_kill = (robot, msg, kill) ->
+  name_for_id(robot, msg, kill.victim.shipTypeID, (msg, ship) ->
+    msg.send "#{kill.victim.characterName} died last in a #{ship}" # + " https://beta.eve-kill.net/kill/#{kill.killID}" 
+  )
+
+name_for_id = (robot, msg, id, callback) ->
+  name = robot.brain.get "itemID.#{id}"
+  if name?
+    callback(msg, name)
+  else
+    msg.http("https://api.eveonline.com/Eve/TypeName.xml.aspx?ids=#{id}")
+      .get() (err2, res2, xml) ->
+        if res2.statusCode isnt 200 or err2
+          return '<unknown: #{id}>'
+        tree = JSON.parse(parser.toJson(xml))
+        robot.brain.set "itemID.#{id}", tree.eveapi.result.rowset.row.typeName
+        callback(msg, tree.eveapi.result.rowset.row.typeName)
 
 awake = (robot) ->
   wake = robot.brain.get 'sleepUntil' 

# OscarRobo will fill the world with bad attitude.
#
# OscarRobo losses - Ask about recent losses by your corp
# OscarRobo kills - Ask about recent kills by your corp
# OscarRobo sleep - Mute OscarRobo's snark for 15 minutes
# OscarRobo wake - Unmute OscarRobo's snark
# I hate <target> - Oscar will insult <target>

# TODO ensure these are set
corp_id = process.env.HUBOT_CORP_ID
email = process.env.HUBOT_OPERATOR_EMAIL
version = "0.0.3"

#   depends on xml2json - so `npm install xml2json` already
#   depends on moment - so `npm install moment` already
