 module.exports = (robot) ->
   badges = {}
 
+  sayBadges = (a) ->
+    badgeReq = for kind, amt of a
+      Array(amt+1).join ":#{kind}:"
+
   robot.brain.on "loaded", ->
     badges = robot.brain.data.ingressBadges ?= {}
 
   robot.respond /AP\s+(?:to|(?:un)?til)\s+L?(\d{1,2})/i, (msg) ->
-    lv = msg.match[1]
-    ap = apToLv[lv]
-    msg.reply "You need #{ap} AP to reach L#{lv}" if ap
+    [lv, lvl] = [msg.match[1], levels[msg.match[1]]]
+    if lvl.badges?
+      badgeReq = sayBadges lvl.badges
+    msg.reply "You need #{lvl.ap} AP#{if badgeReq? then ' ' + badgeReq.join ' ' else ''}
+        to reach L#{lv}#{if lv > 15 then ' (hang in there!)' else ''}"
 
   robot.respond /AP all/i, (msg) ->
-    msg.send "L#{i+1} = #{ap} AP" for ap, i in apToLv.slice 1
+    lvls = for lv, lvl of levels
+      if lvl.badges?
+        badgeReq = sayBadges lvl.badges
+      "\nL#{lv} = #{lvl.ap} AP#{if badgeReq? then ' ' + badgeReq.join ' ' else ''}"
+    msg.send lvls.join ""
 
   robot.respond /(I|@?\w+) (?:have|has|got|earned)(?: the)? :?(\w+):? badge/i, (msg) ->
     who = msg.match[1].replace '@', ''

# 14  2 Plat,               17000000,   13900
# 15  3 Plat,               24000000,   14200
# 16  4 Plat, 2 Black,      40000000,   14400

badgeList = [
  'builder1', 'builder2', 'builder3', 'builder4', 'builder5',

# Author:
#   therealklanni

# Quick refrence for what badges are need at what level
# LVL   Badges              AP          Max xm
# 9   4 Silver, 1 Gold,     2400000,    10900
