daily pastebin goal
23%
SHARE
TWEET

aaaa

a guest May 27th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript: function upgrade(x, y) {
  2.     if (map[x][y][2] == "w" && map[x][y][1] >= 1 || map[x][y][1] >= 8) {
  3.         return;
  4.     } else {
  5.         if (mp < cellCost(x, y) || map[x][y][1] >= 15) return;
  6.         var act = false;
  7.         if (x - 1 > -1) {
  8.             if (map[x - 1][y][0] == socketId) act = true
  9.         }
  10.         if (x + 1 < mapSize) {
  11.             if (map[x + 1][y][0] == socketId) act = true
  12.         }
  13.         if (y - 1 > -1) {
  14.             if (map[x][y - 1][0] == socketId) act = true
  15.         }
  16.         if (y + 1 < mapSize) {
  17.             if (map[x][y + 1][0] == socketId) act = true
  18.         }
  19.         if (!act) return;
  20.         mp += -cellCost(x, y);
  21.         refresh();
  22.         socket.emit('upgrade', x, y);
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top