@@ -0,0 +1,1822 @@
+#!/usr/bin/python%0A# Copyright (C) 2016 by Daniel Kraft %3Cd@domob.eu%3E%0A%0A# Find information about nearby loot and banks for a player.%0A%0Aimport jsonrpc%0Aimport sys%0A%0Aname = %22domob%22%0Arpc = jsonrpc.ServiceProxy (%22http://huntercoind:password@localhost:8399/%22)%0A%0Adef distLInf (a, b):%0A  %22%22%22%0A  Utility method to compute the L-infinity distance between%0A  the given two coordinates.%0A  %22%22%22%0A%0A  return max (abs (a%5B0%5D - b%5B0%5D), abs (a%5B1%5D - b%5B1%5D))%0A%0Adef pathlen (a, path):%0A  %22%22%22%0A  Compute the L-infinity path length from a via the given%0A  list of way points.%0A  %22%22%22%0A%0A  if len (path) == 0:%0A    return 0%0A  res = distLInf (a, %5Bpath%5B0%5D, path%5B1%5D%5D)%0A  for i in range (2, len (path), 2):%0A    res += distLInf (%5Bpath%5Bi - 2%5D, path%5Bi - 1%5D%5D, %5Bpath%5Bi%5D, path%5Bi + 1%5D%5D)%0A%0A  return res%0A%0Adef distTo (rpc, a, b):%0A  %22%22%22%0A  Compute the travel distance from a to b.%0A  %22%22%22%0A  path = rpc.game_getpath (a, b)%0A  return pathlen (a, path)%0A%0Adef findNearby (rpc, pos, arr):%0A  %22%22%22%0A  Find the nearest 'object' from arr, which can be loot or banks.%0A  %22%22%22%0A%0A  bestObj = None%0A  for obj in arr:%0A    curPos = %5Bobj%5B'x'%5D, obj%5B'y'%5D%5D%0A    curDist = distLInf (pos, curPos)%0A    if bestObj is None or curDist %3C bestDist:%0A      curDist = distTo (rpc, pos, curPos)%0A    if bestObj is None or curDist %3C bestDist:%0A      bestObj = obj%0A      bestPos = curPos%0A      bestDist = curDist%0A%0A  return bestObj, bestPos, bestDist%0A%0Astate = rpc.game_getstate ()%0Aif not name in state%5B'players'%5D:%0A  print %22Player not found!%22%0A  sys.exit (-1)%0A%0Aplayer = state%5B'players'%5D%5Bname%5D%5B%220%22%5D%0Apos = %5Bplayer%5B'x'%5D, player%5B'y'%5D%5D%0A%0A#loot, pos, dist = findNearby (rpc, pos, state%5B'loot'%5D)%0A#print %22Nearest loot: (%25d, %25d), distance = %25d, %25.8f HUC%22 %25 (pos%5B0%5D, pos%5B1%5D, dist, loot%5B'amount'%5D)%0A%0Abank, pos, dist = findNearby (rpc, pos, state%5B'banks'%5D)%0Aprint %22Nearest bank: (%25d, %25d), distance = %25d, life %25d%22 %25 (pos%5B0%5D, pos%5B1%5D, dist, bank%5B'life'%5D)%0A

Add contrib script to find nearby banks and loot.