|
var global = self; |
|
|
|
var Reflect = { |
|
global: global |
|
}; |
|
|
|
!function a(b, c, d) { |
|
function e(g, h) { |
|
if (!c[g]) { |
|
if (!b[g]) { |
|
var i = "function" == typeof require && require; |
|
if (!h && i) return i(g, !0); |
|
if (f) return f(g, !0); |
|
var j = new Error("Cannot find module '" + g + "'"); |
|
throw j.code = "MODULE_NOT_FOUND", j; |
|
} |
|
var k = c[g] = { |
|
exports: {} |
|
}; |
|
b[g][0].call(k.exports, function(a) { |
|
var c = b[g][1][a]; |
|
return e(c ? c : a); |
|
}, k, k.exports, a, b, c, d); |
|
} |
|
return c[g].exports; |
|
} |
|
for (var f = "function" == typeof require && require, g = 0; g < d.length; g++) e(d[g]); |
|
return e; |
|
}({ |
|
1: [ function(a, b, c) { |
|
b.exports = a("./src/PathFinding"); |
|
}, { |
|
"./src/PathFinding": 4 |
|
} ], |
|
2: [ function(a, b, c) { |
|
b.exports = a("./lib/heap"); |
|
}, { |
|
"./lib/heap": 3 |
|
} ], |
|
3: [ function(a, b, c) { |
|
(function() { |
|
var a, c, d, e, f, g, h, i, j, k, l, m, n, o, p; |
|
d = Math.floor, k = Math.min, c = function(a, b) { |
|
return b > a ? -1 : a > b ? 1 : 0; |
|
}, j = function(a, b, e, f, g) { |
|
var h; |
|
if (null == e && (e = 0), null == g && (g = c), 0 > e) throw new Error("lo must be non-negative"); |
|
for (null == f && (f = a.length); f > e; ) h = d((e + f) / 2), g(b, a[h]) < 0 ? f = h : e = h + 1; |
|
return [].splice.apply(a, [ e, e - e ].concat(b)), b; |
|
}, g = function(a, b, d) { |
|
return null == d && (d = c), a.push(b), o(a, 0, a.length - 1, d); |
|
}, f = function(a, b) { |
|
var d, e; |
|
return null == b && (b = c), d = a.pop(), a.length ? (e = a[0], a[0] = d, p(a, 0, b)) : e = d, |
|
e; |
|
}, i = function(a, b, d) { |
|
var e; |
|
return null == d && (d = c), e = a[0], a[0] = b, p(a, 0, d), e; |
|
}, h = function(a, b, d) { |
|
var e; |
|
return null == d && (d = c), a.length && d(a[0], b) < 0 && (e = [ a[0], b ], b = e[0], |
|
a[0] = e[1], p(a, 0, d)), b; |
|
}, e = function(a, b) { |
|
var e, f, g, h, i, j; |
|
for (null == b && (b = c), h = function() { |
|
j = []; |
|
for (var b = 0, c = d(a.length / 2); c >= 0 ? c > b : b > c; c >= 0 ? b++ : b--) j.push(b); |
|
return j; |
|
}.apply(this).reverse(), i = [], f = 0, g = h.length; g > f; f++) e = h[f], i.push(p(a, e, b)); |
|
return i; |
|
}, n = function(a, b, d) { |
|
var e; |
|
return null == d && (d = c), e = a.indexOf(b), -1 !== e ? (o(a, 0, e, d), p(a, e, d)) : void 0; |
|
}, l = function(a, b, d) { |
|
var f, g, i, j, k; |
|
if (null == d && (d = c), g = a.slice(0, b), !g.length) return g; |
|
for (e(g, d), k = a.slice(b), i = 0, j = k.length; j > i; i++) f = k[i], h(g, f, d); |
|
return g.sort(d).reverse(); |
|
}, m = function(a, b, d) { |
|
var g, h, i, l, m, n, o, p, q, r; |
|
if (null == d && (d = c), 10 * b <= a.length) { |
|
if (l = a.slice(0, b).sort(d), !l.length) return l; |
|
for (i = l[l.length - 1], p = a.slice(b), m = 0, o = p.length; o > m; m++) g = p[m], |
|
d(g, i) < 0 && (j(l, g, 0, null, d), l.pop(), i = l[l.length - 1]); |
|
return l; |
|
} |
|
for (e(a, d), r = [], h = n = 0, q = k(b, a.length); q >= 0 ? q > n : n > q; h = q >= 0 ? ++n : --n) r.push(f(a, d)); |
|
return r; |
|
}, o = function(a, b, d, e) { |
|
var f, g, h; |
|
for (null == e && (e = c), f = a[d]; d > b && (h = d - 1 >> 1, g = a[h], e(f, g) < 0); ) a[d] = g, |
|
d = h; |
|
return a[d] = f; |
|
}, p = function(a, b, d) { |
|
var e, f, g, h, i; |
|
for (null == d && (d = c), f = a.length, i = b, g = a[b], e = 2 * b + 1; f > e; ) h = e + 1, |
|
f > h && !(d(a[e], a[h]) < 0) && (e = h), a[b] = a[e], b = e, e = 2 * b + 1; |
|
return a[b] = g, o(a, i, b, d); |
|
}, a = function() { |
|
function a(a) { |
|
this.cmp = null != a ? a : c, this.nodes = []; |
|
} |
|
return a.push = g, a.pop = f, a.replace = i, a.pushpop = h, a.heapify = e, a.updateItem = n, |
|
a.nlargest = l, a.nsmallest = m, a.prototype.push = function(a) { |
|
return g(this.nodes, a, this.cmp); |
|
}, a.prototype.pop = function() { |
|
return f(this.nodes, this.cmp); |
|
}, a.prototype.peek = function() { |
|
return this.nodes[0]; |
|
}, a.prototype.contains = function(a) { |
|
return -1 !== this.nodes.indexOf(a); |
|
}, a.prototype.replace = function(a) { |
|
return i(this.nodes, a, this.cmp); |
|
}, a.prototype.pushpop = function(a) { |
|
return h(this.nodes, a, this.cmp); |
|
}, a.prototype.heapify = function() { |
|
return e(this.nodes, this.cmp); |
|
}, a.prototype.updateItem = function(a) { |
|
return n(this.nodes, a, this.cmp); |
|
}, a.prototype.clear = function() { |
|
return this.nodes = []; |
|
}, a.prototype.empty = function() { |
|
return 0 === this.nodes.length; |
|
}, a.prototype.size = function() { |
|
return this.nodes.length; |
|
}, a.prototype.clone = function() { |
|
var b; |
|
return b = new a(), b.nodes = this.nodes.slice(0), b; |
|
}, a.prototype.toArray = function() { |
|
return this.nodes.slice(0); |
|
}, a.prototype.insert = a.prototype.push, a.prototype.top = a.prototype.peek, a.prototype.front = a.prototype.peek, |
|
a.prototype.has = a.prototype.contains, a.prototype.copy = a.prototype.clone, a; |
|
}(), ("undefined" != typeof b && null !== b ? b.exports : void 0) ? b.exports = a : window.Heap = a; |
|
}).call(this); |
|
}, {} ], |
|
4: [ function(a, b, c) { |
|
b.exports = { |
|
Heap: a("heap"), |
|
Node: a("./core/Node"), |
|
Grid: a("./core/Grid"), |
|
Util: a("./core/Util"), |
|
DiagonalMovement: a("./core/DiagonalMovement"), |
|
Heuristic: a("./core/Heuristic"), |
|
AStarFinder: a("./finders/AStarFinder"), |
|
BestFirstFinder: a("./finders/BestFirstFinder"), |
|
BreadthFirstFinder: a("./finders/BreadthFirstFinder"), |
|
DijkstraFinder: a("./finders/DijkstraFinder"), |
|
BiAStarFinder: a("./finders/BiAStarFinder"), |
|
BiBestFirstFinder: a("./finders/BiBestFirstFinder"), |
|
BiBreadthFirstFinder: a("./finders/BiBreadthFirstFinder"), |
|
BiDijkstraFinder: a("./finders/BiDijkstraFinder"), |
|
IDAStarFinder: a("./finders/IDAStarFinder"), |
|
JumpPointFinder: a("./finders/JumpPointFinder") |
|
}; |
|
}, { |
|
"./core/DiagonalMovement": 5, |
|
"./core/Grid": 6, |
|
"./core/Heuristic": 7, |
|
"./core/Node": 8, |
|
"./core/Util": 9, |
|
"./finders/AStarFinder": 10, |
|
"./finders/BestFirstFinder": 11, |
|
"./finders/BiAStarFinder": 12, |
|
"./finders/BiBestFirstFinder": 13, |
|
"./finders/BiBreadthFirstFinder": 14, |
|
"./finders/BiDijkstraFinder": 15, |
|
"./finders/BreadthFirstFinder": 16, |
|
"./finders/DijkstraFinder": 17, |
|
"./finders/IDAStarFinder": 18, |
|
"./finders/JumpPointFinder": 23, |
|
heap: 2 |
|
} ], |
|
5: [ function(a, b, c) { |
|
var d = { |
|
Always: 1, |
|
Never: 2, |
|
IfAtMostOneObstacle: 3, |
|
OnlyWhenNoObstacles: 4 |
|
}; |
|
b.exports = d; |
|
}, {} ], |
|
6: [ function(a, b, c) { |
|
function d(a, b, c) { |
|
this.width = a, this.height = b, this.nodes = this._buildNodes(a, b, c); |
|
} |
|
var e = a("./Node"), f = a("./DiagonalMovement"); |
|
d.prototype._buildNodes = function(a, b, c) { |
|
var d, f, g = new Array(b); |
|
for (d = 0; b > d; ++d) for (g[d] = new Array(a), f = 0; a > f; ++f) g[d][f] = new e(f, d); |
|
if (void 0 === c) return g; |
|
if (c.length !== b || c[0].length !== a) throw new Error("Matrix size does not fit"); |
|
for (d = 0; b > d; ++d) for (f = 0; a > f; ++f) c[d][f] && (g[d][f].walkable = !1), |
|
g[d][f].weight = c[d][f]; |
|
return g; |
|
}, d.prototype.getNodeAt = function(a, b) { |
|
return this.nodes[b][a]; |
|
}, d.prototype.isWalkableAt = function(a, b) { |
|
return this.isInside(a, b) && this.nodes[b][a].weight > 0; |
|
}, d.prototype.isInside = function(a, b) { |
|
return a >= 0 && a < this.width && b >= 0 && b < this.height; |
|
}, d.prototype.setWalkableAt = function(a, b, c) { |
|
this.nodes[b][a].weight = 1; |
|
}, d.prototype.getNeighbors = function(a, b) { |
|
var c = a.x, d = a.y, e = [], g = !1, h = !1, i = !1, j = !1, k = !1, l = !1, m = !1, n = !1, o = this.nodes; |
|
if (this.isWalkableAt(c, d - 1) && (e.push(o[d - 1][c]), g = !0), this.isWalkableAt(c + 1, d) && (e.push(o[d][c + 1]), |
|
i = !0), this.isWalkableAt(c, d + 1) && (e.push(o[d + 1][c]), k = !0), this.isWalkableAt(c - 1, d) && (e.push(o[d][c - 1]), |
|
m = !0), b === f.Never) return e; |
|
if (b === f.OnlyWhenNoObstacles) h = m && g, j = g && i, l = i && k, n = k && m; else if (b === f.IfAtMostOneObstacle) h = m || g, |
|
j = g || i, l = i || k, n = k || m; else { |
|
if (b !== f.Always) throw new Error("Incorrect value of diagonalMovement"); |
|
h = !0, j = !0, l = !0, n = !0; |
|
} |
|
return h && this.isWalkableAt(c - 1, d - 1) && e.push(o[d - 1][c - 1]), j && this.isWalkableAt(c + 1, d - 1) && e.push(o[d - 1][c + 1]), |
|
l && this.isWalkableAt(c + 1, d + 1) && e.push(o[d + 1][c + 1]), n && this.isWalkableAt(c - 1, d + 1) && e.push(o[d + 1][c - 1]), |
|
e; |
|
}, d.prototype.clone = function() { |
|
var a, b, c = this.width, f = this.height, g = this.nodes, h = new d(c, f), i = new Array(f); |
|
for (a = 0; f > a; ++a) for (i[a] = new Array(c), b = 0; c > b; ++b) i[a][b] = new e(b, a, g[a][b].walkable, g[a][b].weight); |
|
return h.nodes = i, h; |
|
}, b.exports = d; |
|
}, { |
|
"./DiagonalMovement": 5, |
|
"./Node": 8 |
|
} ], |
|
7: [ function(a, b, c) { |
|
b.exports = { |
|
manhattan: function(a, b) { |
|
return a + b; |
|
}, |
|
euclidean: function(a, b) { |
|
return Math.sqrt(a * a + b * b); |
|
}, |
|
octile: function(a, b) { |
|
var c = Math.SQRT2 - 1; |
|
return b > a ? c * a + b : c * b + a; |
|
}, |
|
chebyshev: function(a, b) { |
|
return Math.max(a, b); |
|
} |
|
}; |
|
}, {} ], |
|
8: [ function(a, b, c) { |
|
function d(a, b, c, d) { |
|
this.x = a, this.y = b, this.walkable = void 0 === c ? !0 : c, this.weight = d; |
|
} |
|
b.exports = d; |
|
}, {} ], |
|
9: [ function(a, b, c) { |
|
function d(a) { |
|
for (var b = [ [ a.x, a.y ] ]; a.parent; ) a = a.parent, b.push([ a.x, a.y ]); |
|
return b.reverse(); |
|
} |
|
function e(a, b) { |
|
var c = d(a), e = d(b); |
|
return c.concat(e.reverse()); |
|
} |
|
function f(a) { |
|
var b, c, d, e, f, g = 0; |
|
for (b = 1; b < a.length; ++b) c = a[b - 1], d = a[b], e = c[0] - d[0], f = c[1] - d[1], |
|
g += Math.sqrt(e * e + f * f); |
|
return g; |
|
} |
|
function g(a, b, c, d) { |
|
var e, f, g, h, i, j, k = Math.abs, l = []; |
|
for (g = k(c - a), h = k(d - b), e = c > a ? 1 : -1, f = d > b ? 1 : -1, i = g - h; ;) { |
|
if (l.push([ a, b ]), a === c && b === d) break; |
|
j = 2 * i, j > -h && (i -= h, a += e), g > j && (i += g, b += f); |
|
} |
|
return l; |
|
} |
|
function h(a) { |
|
var b, c, d, e, f, h, i = [], j = a.length; |
|
if (2 > j) return i; |
|
for (f = 0; j - 1 > f; ++f) for (b = a[f], c = a[f + 1], d = g(b[0], b[1], c[0], c[1]), |
|
e = d.length, h = 0; e - 1 > h; ++h) i.push(d[h]); |
|
return i.push(a[j - 1]), i; |
|
} |
|
function i(a, b) { |
|
var c, d, e, f, h, i, j, k, l, m, n, o = b.length, p = b[0][0], q = b[0][1], r = b[o - 1][0], s = b[o - 1][1]; |
|
for (c = p, d = q, h = [ [ c, d ] ], i = 2; o > i; ++i) { |
|
for (k = b[i], e = k[0], f = k[1], l = g(c, d, e, f), n = !1, j = 1; j < l.length; ++j) if (m = l[j], |
|
!a.isWalkableAt(m[0], m[1])) { |
|
n = !0; |
|
break; |
|
} |
|
n && (lastValidCoord = b[i - 1], h.push(lastValidCoord), c = lastValidCoord[0], |
|
d = lastValidCoord[1]); |
|
} |
|
return h.push([ r, s ]), h; |
|
} |
|
function j(a) { |
|
if (a.length < 3) return a; |
|
var b, c, d, e, f, g, h = [], i = a[0][0], j = a[0][1], k = a[1][0], l = a[1][1], m = k - i, n = l - j; |
|
for (f = Math.sqrt(m * m + n * n), m /= f, n /= f, h.push([ i, j ]), g = 2; g < a.length; g++) b = k, |
|
c = l, d = m, e = n, k = a[g][0], l = a[g][1], m = k - b, n = l - c, f = Math.sqrt(m * m + n * n), |
|
m /= f, n /= f, (m !== d || n !== e) && h.push([ b, c ]); |
|
return h.push([ k, l ]), h; |
|
} |
|
c.backtrace = d, c.biBacktrace = e, c.pathLength = f, c.interpolate = g, c.expandPath = h, |
|
c.smoothenPath = i, c.compressPath = j; |
|
}, {} ], |
|
10: [ function(a, b, c) { |
|
function d(a) { |
|
a = a || {}, this.allowDiagonal = a.allowDiagonal, this.dontCrossCorners = a.dontCrossCorners, |
|
this.heuristic = a.heuristic || g.manhattan, this.weight = a.weight || 1, this.maxOpsLimit = a.maxOpsLimit, |
|
this.diagonalMovement = a.diagonalMovement, this.diagonalMovement || (this.allowDiagonal ? this.dontCrossCorners ? this.diagonalMovement = h.OnlyWhenNoObstacles : this.diagonalMovement = h.IfAtMostOneObstacle : this.diagonalMovement = h.Never), |
|
this.diagonalMovement === h.Never ? this.heuristic = a.heuristic || g.manhattan : this.heuristic = a.heuristic || g.octile; |
|
} |
|
var e = a("heap"), f = a("../core/Util"), g = a("../core/Heuristic"), h = a("../core/DiagonalMovement"); |
|
d.prototype.findPath = function(a, b, c, d, g) { |
|
var h, i, j, k, l, m, n, o, p = new e(function(a, b) { |
|
return a.f - b.f; |
|
}), q = g.getNodeAt(a, b), r = -999 != c ? g.getNodeAt(c, d) : null, s = this.heuristic, t = this.diagonalMovement, u = this.weight, v = Math.abs, w = (Math.SQRT2, |
|
q), x = 0; |
|
for (q.g = 0, q.f = 0, q.h = r ? u * s(v(a - c), v(b - d)) : 0, p.push(q), q.opened = !0; !p.empty(); ) { |
|
if (h = p.pop(), h.closed = !0, h === r || 999 == h.weight) return f.backtrace(h); |
|
if (x++, this.maxOpsLimit && x > this.maxOpsLimit) break; |
|
for (i = g.getNeighbors(h, t), k = 0, l = i.length; l > k; ++k) j = i[k], j.closed || (m = j.x, |
|
n = j.y, o = h.g + j.weight * (m - h.x === 0 || n - h.y === 0 ? 1 : 1.00000001), |
|
(!j.opened || o < j.g) && (j.g = o, j.h = j.h || u * s(v(m - c), v(n - d)), j.f = j.g + j.h, |
|
j.parent = h, (j.h < w.h || j.h === w.h && j.g < w.g) && (w = j), j.opened ? p.updateItem(j) : (p.push(j), |
|
j.opened = !0))); |
|
} |
|
return f.backtrace(w); |
|
}, b.exports = d; |
|
}, { |
|
"../core/DiagonalMovement": 5, |
|
"../core/Heuristic": 7, |
|
"../core/Util": 9, |
|
heap: 2 |
|
} ], |
|
11: [ function(a, b, c) { |
|
function d(a) { |
|
e.call(this, a); |
|
var b = this.heuristic; |
|
this.heuristic = function(a, c) { |
|
return 1e6 * b(a, c); |
|
}; |
|
} |
|
var e = a("./AStarFinder"); |
|
d.prototype = new e(), d.prototype.constructor = d, b.exports = d; |
|
}, { |
|
"./AStarFinder": 10 |
|
} ], |
|
12: [ function(a, b, c) { |
|
function d(a) { |
|
a = a || {}, this.allowDiagonal = a.allowDiagonal, this.dontCrossCorners = a.dontCrossCorners, |
|
this.diagonalMovement = a.diagonalMovement, this.heuristic = a.heuristic || g.manhattan, |
|
this.weight = a.weight || 1, this.diagonalMovement || (this.allowDiagonal ? this.dontCrossCorners ? this.diagonalMovement = h.OnlyWhenNoObstacles : this.diagonalMovement = h.IfAtMostOneObstacle : this.diagonalMovement = h.Never), |
|
this.diagonalMovement === h.Never ? this.heuristic = a.heuristic || g.manhattan : this.heuristic = a.heuristic || g.octile; |
|
} |
|
var e = a("heap"), f = a("../core/Util"), g = a("../core/Heuristic"), h = a("../core/DiagonalMovement"); |
|
d.prototype.findPath = function(a, b, c, d, g) { |
|
var h, i, j, k, l, m, n, o, p = function(a, b) { |
|
return a.f - b.f; |
|
}, q = new e(p), r = new e(p), s = g.getNodeAt(a, b), t = g.getNodeAt(c, d), u = this.heuristic, v = this.diagonalMovement, w = this.weight, x = Math.abs, y = Math.SQRT2, z = 1, A = 2; |
|
for (s.g = 0, s.f = 0, q.push(s), s.opened = z, t.g = 0, t.f = 0, r.push(t), t.opened = A; !q.empty() && !r.empty(); ) { |
|
for (h = q.pop(), h.closed = !0, i = g.getNeighbors(h, v), k = 0, l = i.length; l > k; ++k) if (j = i[k], |
|
!j.closed) { |
|
if (j.opened === A) return f.biBacktrace(h, j); |
|
m = j.x, n = j.y, o = h.g + (m - h.x === 0 || n - h.y === 0 ? 1 : y), (!j.opened || o < j.g) && (j.g = o, |
|
j.h = j.h || w * u(x(m - c), x(n - d)), j.f = j.g + j.h, j.parent = h, j.opened ? q.updateItem(j) : (q.push(j), |
|
j.opened = z)); |
|
} |
|
for (h = r.pop(), h.closed = !0, i = g.getNeighbors(h, v), k = 0, l = i.length; l > k; ++k) if (j = i[k], |
|
!j.closed) { |
|
if (j.opened === z) return f.biBacktrace(j, h); |
|
m = j.x, n = j.y, o = h.g + (m - h.x === 0 || n - h.y === 0 ? 1 : y), (!j.opened || o < j.g) && (j.g = o, |
|
j.h = j.h || w * u(x(m - a), x(n - b)), j.f = j.g + j.h, j.parent = h, j.opened ? r.updateItem(j) : (r.push(j), |
|
j.opened = A)); |
|
} |
|
} |
|
return []; |
|
}, b.exports = d; |
|
}, { |
|
"../core/DiagonalMovement": 5, |
|
"../core/Heuristic": 7, |
|
"../core/Util": 9, |
|
heap: 2 |
|
} ], |
|
13: [ function(a, b, c) { |
|
function d(a) { |
|
e.call(this, a); |
|
var b = this.heuristic; |
|
this.heuristic = function(a, c) { |
|
return 1e6 * b(a, c); |
|
}; |
|
} |
|
var e = a("./BiAStarFinder"); |
|
d.prototype = new e(), d.prototype.constructor = d, b.exports = d; |
|
}, { |
|
"./BiAStarFinder": 12 |
|
} ], |
|
14: [ function(a, b, c) { |
|
function d(a) { |
|
a = a || {}, this.allowDiagonal = a.allowDiagonal, this.dontCrossCorners = a.dontCrossCorners, |
|
this.diagonalMovement = a.diagonalMovement, this.diagonalMovement || (this.allowDiagonal ? this.dontCrossCorners ? this.diagonalMovement = f.OnlyWhenNoObstacles : this.diagonalMovement = f.IfAtMostOneObstacle : this.diagonalMovement = f.Never); |
|
} |
|
var e = a("../core/Util"), f = a("../core/DiagonalMovement"); |
|
d.prototype.findPath = function(a, b, c, d, f) { |
|
var g, h, i, j, k, l = f.getNodeAt(a, b), m = f.getNodeAt(c, d), n = [], o = [], p = this.diagonalMovement, q = 0, r = 1; |
|
for (n.push(l), l.opened = !0, l.by = q, o.push(m), m.opened = !0, m.by = r; n.length && o.length; ) { |
|
for (i = n.shift(), i.closed = !0, g = f.getNeighbors(i, p), j = 0, k = g.length; k > j; ++j) if (h = g[j], |
|
!h.closed) if (h.opened) { |
|
if (h.by === r) return e.biBacktrace(i, h); |
|
} else n.push(h), h.parent = i, h.opened = !0, h.by = q; |
|
for (i = o.shift(), i.closed = !0, g = f.getNeighbors(i, p), j = 0, k = g.length; k > j; ++j) if (h = g[j], |
|
!h.closed) if (h.opened) { |
|
if (h.by === q) return e.biBacktrace(h, i); |
|
} else o.push(h), h.parent = i, h.opened = !0, h.by = r; |
|
} |
|
return []; |
|
}, b.exports = d; |
|
}, { |
|
"../core/DiagonalMovement": 5, |
|
"../core/Util": 9 |
|
} ], |
|
15: [ function(a, b, c) { |
|
function d(a) { |
|
e.call(this, a), this.heuristic = function(a, b) { |
|
return 0; |
|
}; |
|
} |
|
var e = a("./BiAStarFinder"); |
|
d.prototype = new e(), d.prototype.constructor = d, b.exports = d; |
|
}, { |
|
"./BiAStarFinder": 12 |
|
} ], |
|
16: [ function(a, b, c) { |
|
function d(a) { |
|
a = a || {}, this.allowDiagonal = a.allowDiagonal, this.dontCrossCorners = a.dontCrossCorners, |
|
this.diagonalMovement = a.diagonalMovement, this.diagonalMovement || (this.allowDiagonal ? this.dontCrossCorners ? this.diagonalMovement = f.OnlyWhenNoObstacles : this.diagonalMovement = f.IfAtMostOneObstacle : this.diagonalMovement = f.Never); |
|
} |
|
var e = a("../core/Util"), f = a("../core/DiagonalMovement"); |
|
d.prototype.findPath = function(a, b, c, d, f) { |
|
var g, h, i, j, k, l = [], m = this.diagonalMovement, n = f.getNodeAt(a, b), o = f.getNodeAt(c, d); |
|
for (l.push(n), n.opened = !0; l.length; ) { |
|
if (i = l.shift(), i.closed = !0, i === o) return e.backtrace(o); |
|
for (g = f.getNeighbors(i, m), j = 0, k = g.length; k > j; ++j) h = g[j], h.closed || h.opened || (l.push(h), |
|
h.opened = !0, h.parent = i); |
|
} |
|
return []; |
|
}, b.exports = d; |
|
}, { |
|
"../core/DiagonalMovement": 5, |
|
"../core/Util": 9 |
|
} ], |
|
17: [ function(a, b, c) { |
|
function d(a) { |
|
e.call(this, a), this.heuristic = function(a, b) { |
|
return 0; |
|
}; |
|
} |
|
var e = a("./AStarFinder"); |
|
d.prototype = new e(), d.prototype.constructor = d, b.exports = d; |
|
}, { |
|
"./AStarFinder": 10 |
|
} ], |
|
18: [ function(a, b, c) { |
|
function d(a) { |
|
a = a || {}, this.allowDiagonal = a.allowDiagonal, this.dontCrossCorners = a.dontCrossCorners, |
|
this.diagonalMovement = a.diagonalMovement, this.heuristic = a.heuristic || e.manhattan, |
|
this.weight = a.weight || 1, this.trackRecursion = a.trackRecursion || !1, this.timeLimit = a.timeLimit || 1 / 0, |
|
this.diagonalMovement || (this.allowDiagonal ? this.dontCrossCorners ? this.diagonalMovement = g.OnlyWhenNoObstacles : this.diagonalMovement = g.IfAtMostOneObstacle : this.diagonalMovement = g.Never), |
|
this.diagonalMovement === g.Never ? this.heuristic = a.heuristic || e.manhattan : this.heuristic = a.heuristic || e.octile; |
|
} |
|
var e = (a("../core/Util"), a("../core/Heuristic")), f = a("../core/Node"), g = a("../core/DiagonalMovement"); |
|
d.prototype.findPath = function(a, b, c, d, e) { |
|
var g, h, i, j = 0, k = new Date().getTime(), l = function(a, b) { |
|
return this.heuristic(Math.abs(b.x - a.x), Math.abs(b.y - a.y)); |
|
}.bind(this), m = function(a, b) { |
|
return a.x === b.x || a.y === b.y ? 1 : Math.SQRT2; |
|
}, n = function(a, b, c, d, g) { |
|
if (j++, this.timeLimit > 0 && new Date().getTime() - k > 1e3 * this.timeLimit) return 1 / 0; |
|
var h = b + l(a, p) * this.weight; |
|
if (h > c) return h; |
|
if (a == p) return d[g] = [ a.x, a.y ], a; |
|
var i, o, q, r, s = e.getNeighbors(a, this.diagonalMovement); |
|
for (q = 0, i = 1 / 0; r = s[q]; ++q) { |
|
if (this.trackRecursion && (r.retainCount = r.retainCount + 1 || 1, r.tested !== !0 && (r.tested = !0)), |
|
o = n(r, b + m(a, r), c, d, g + 1), o instanceof f) return d[g] = [ a.x, a.y ], |
|
o; |
|
this.trackRecursion && 0 === --r.retainCount && (r.tested = !1), i > o && (i = o); |
|
} |
|
return i; |
|
}.bind(this), o = e.getNodeAt(a, b), p = e.getNodeAt(c, d), q = l(o, p); |
|
for (g = 0; !0; ++g) { |
|
if (h = [], i = n(o, 0, q, h, 0), i === 1 / 0) return []; |
|
if (i instanceof f) return h; |
|
q = i; |
|
} |
|
return []; |
|
}, b.exports = d; |
|
}, { |
|
"../core/DiagonalMovement": 5, |
|
"../core/Heuristic": 7, |
|
"../core/Node": 8, |
|
"../core/Util": 9 |
|
} ], |
|
19: [ function(a, b, c) { |
|
function d(a) { |
|
e.call(this, a); |
|
} |
|
var e = a("./JumpPointFinderBase"), f = a("../core/DiagonalMovement"); |
|
d.prototype = new e(), d.prototype.constructor = d, d.prototype._jump = function(a, b, c, d) { |
|
var e = this.grid, f = a - c, g = b - d; |
|
if (!e.isWalkableAt(a, b)) return null; |
|
if (this.trackJumpRecursion === !0 && (e.getNodeAt(a, b).tested = !0), e.getNodeAt(a, b) === this.endNode) return [ a, b ]; |
|
if (0 !== f && 0 !== g) { |
|
if (e.isWalkableAt(a - f, b + g) && !e.isWalkableAt(a - f, b) || e.isWalkableAt(a + f, b - g) && !e.isWalkableAt(a, b - g)) return [ a, b ]; |
|
if (this._jump(a + f, b, a, b) || this._jump(a, b + g, a, b)) return [ a, b ]; |
|
} else if (0 !== f) { |
|
if (e.isWalkableAt(a + f, b + 1) && !e.isWalkableAt(a, b + 1) || e.isWalkableAt(a + f, b - 1) && !e.isWalkableAt(a, b - 1)) return [ a, b ]; |
|
} else if (e.isWalkableAt(a + 1, b + g) && !e.isWalkableAt(a + 1, b) || e.isWalkableAt(a - 1, b + g) && !e.isWalkableAt(a - 1, b)) return [ a, b ]; |
|
return this._jump(a + f, b + g, a, b); |
|
}, d.prototype._findNeighbors = function(a) { |
|
var b, c, d, e, g, h, i, j, k = a.parent, l = a.x, m = a.y, n = this.grid, o = []; |
|
if (k) b = k.x, c = k.y, d = (l - b) / Math.max(Math.abs(l - b), 1), e = (m - c) / Math.max(Math.abs(m - c), 1), |
|
0 !== d && 0 !== e ? (n.isWalkableAt(l, m + e) && o.push([ l, m + e ]), n.isWalkableAt(l + d, m) && o.push([ l + d, m ]), |
|
n.isWalkableAt(l + d, m + e) && o.push([ l + d, m + e ]), n.isWalkableAt(l - d, m) || o.push([ l - d, m + e ]), |
|
n.isWalkableAt(l, m - e) || o.push([ l + d, m - e ])) : 0 === d ? (n.isWalkableAt(l, m + e) && o.push([ l, m + e ]), |
|
n.isWalkableAt(l + 1, m) || o.push([ l + 1, m + e ]), n.isWalkableAt(l - 1, m) || o.push([ l - 1, m + e ])) : (n.isWalkableAt(l + d, m) && o.push([ l + d, m ]), |
|
n.isWalkableAt(l, m + 1) || o.push([ l + d, m + 1 ]), n.isWalkableAt(l, m - 1) || o.push([ l + d, m - 1 ])); else for (g = n.getNeighbors(a, f.Always), |
|
i = 0, j = g.length; j > i; ++i) h = g[i], o.push([ h.x, h.y ]); |
|
return o; |
|
}, b.exports = d; |
|
}, { |
|
"../core/DiagonalMovement": 5, |
|
"./JumpPointFinderBase": 24 |
|
} ], |
|
20: [ function(a, b, c) { |
|
function d(a) { |
|
e.call(this, a); |
|
} |
|
var e = a("./JumpPointFinderBase"), f = a("../core/DiagonalMovement"); |
|
d.prototype = new e(), d.prototype.constructor = d, d.prototype._jump = function(a, b, c, d) { |
|
var e = this.grid, f = a - c, g = b - d; |
|
if (!e.isWalkableAt(a, b)) return null; |
|
if (this.trackJumpRecursion === !0 && (e.getNodeAt(a, b).tested = !0), e.getNodeAt(a, b) === this.endNode) return [ a, b ]; |
|
if (0 !== f && 0 !== g) { |
|
if (e.isWalkableAt(a - f, b + g) && !e.isWalkableAt(a - f, b) || e.isWalkableAt(a + f, b - g) && !e.isWalkableAt(a, b - g)) return [ a, b ]; |
|
if (this._jump(a + f, b, a, b) || this._jump(a, b + g, a, b)) return [ a, b ]; |
|
} else if (0 !== f) { |
|
if (e.isWalkableAt(a + f, b + 1) && !e.isWalkableAt(a, b + 1) || e.isWalkableAt(a + f, b - 1) && !e.isWalkableAt(a, b - 1)) return [ a, b ]; |
|
} else if (e.isWalkableAt(a + 1, b + g) && !e.isWalkableAt(a + 1, b) || e.isWalkableAt(a - 1, b + g) && !e.isWalkableAt(a - 1, b)) return [ a, b ]; |
|
return e.isWalkableAt(a + f, b) || e.isWalkableAt(a, b + g) ? this._jump(a + f, b + g, a, b) : null; |
|
}, d.prototype._findNeighbors = function(a) { |
|
var b, c, d, e, g, h, i, j, k = a.parent, l = a.x, m = a.y, n = this.grid, o = []; |
|
if (k) b = k.x, c = k.y, d = (l - b) / Math.max(Math.abs(l - b), 1), e = (m - c) / Math.max(Math.abs(m - c), 1), |
|
0 !== d && 0 !== e ? (n.isWalkableAt(l, m + e) && o.push([ l, m + e ]), n.isWalkableAt(l + d, m) && o.push([ l + d, m ]), |
|
(n.isWalkableAt(l, m + e) || n.isWalkableAt(l + d, m)) && o.push([ l + d, m + e ]), |
|
!n.isWalkableAt(l - d, m) && n.isWalkableAt(l, m + e) && o.push([ l - d, m + e ]), |
|
!n.isWalkableAt(l, m - e) && n.isWalkableAt(l + d, m) && o.push([ l + d, m - e ])) : 0 === d ? n.isWalkableAt(l, m + e) && (o.push([ l, m + e ]), |
|
n.isWalkableAt(l + 1, m) || o.push([ l + 1, m + e ]), n.isWalkableAt(l - 1, m) || o.push([ l - 1, m + e ])) : n.isWalkableAt(l + d, m) && (o.push([ l + d, m ]), |
|
n.isWalkableAt(l, m + 1) || o.push([ l + d, m + 1 ]), n.isWalkableAt(l, m - 1) || o.push([ l + d, m - 1 ])); else for (g = n.getNeighbors(a, f.IfAtMostOneObstacle), |
|
i = 0, j = g.length; j > i; ++i) h = g[i], o.push([ h.x, h.y ]); |
|
return o; |
|
}, b.exports = d; |
|
}, { |
|
"../core/DiagonalMovement": 5, |
|
"./JumpPointFinderBase": 24 |
|
} ], |
|
21: [ function(a, b, c) { |
|
function d(a) { |
|
e.call(this, a); |
|
} |
|
var e = a("./JumpPointFinderBase"), f = a("../core/DiagonalMovement"); |
|
d.prototype = new e(), d.prototype.constructor = d, d.prototype._jump = function(a, b, c, d) { |
|
var e = this.grid, f = a - c, g = b - d; |
|
if (!e.isWalkableAt(a, b)) return null; |
|
if (this.trackJumpRecursion === !0 && (e.getNodeAt(a, b).tested = !0), e.getNodeAt(a, b) === this.endNode) return [ a, b ]; |
|
if (0 !== f && 0 !== g) { |
|
if (this._jump(a + f, b, a, b) || this._jump(a, b + g, a, b)) return [ a, b ]; |
|
} else if (0 !== f) { |
|
if (e.isWalkableAt(a, b - 1) && !e.isWalkableAt(a - f, b - 1) || e.isWalkableAt(a, b + 1) && !e.isWalkableAt(a - f, b + 1)) return [ a, b ]; |
|
} else if (0 !== g && (e.isWalkableAt(a - 1, b) && !e.isWalkableAt(a - 1, b - g) || e.isWalkableAt(a + 1, b) && !e.isWalkableAt(a + 1, b - g))) return [ a, b ]; |
|
return e.isWalkableAt(a + f, b) && e.isWalkableAt(a, b + g) ? this._jump(a + f, b + g, a, b) : null; |
|
}, d.prototype._findNeighbors = function(a) { |
|
var b, c, d, e, g, h, i, j, k = a.parent, l = a.x, m = a.y, n = this.grid, o = []; |
|
if (k) if (b = k.x, c = k.y, d = (l - b) / Math.max(Math.abs(l - b), 1), e = (m - c) / Math.max(Math.abs(m - c), 1), |
|
0 !== d && 0 !== e) n.isWalkableAt(l, m + e) && o.push([ l, m + e ]), n.isWalkableAt(l + d, m) && o.push([ l + d, m ]), |
|
n.isWalkableAt(l, m + e) && n.isWalkableAt(l + d, m) && o.push([ l + d, m + e ]); else { |
|
var p; |
|
if (0 !== d) { |
|
p = n.isWalkableAt(l + d, m); |
|
var q = n.isWalkableAt(l, m + 1), r = n.isWalkableAt(l, m - 1); |
|
p && (o.push([ l + d, m ]), q && o.push([ l + d, m + 1 ]), r && o.push([ l + d, m - 1 ])), |
|
q && o.push([ l, m + 1 ]), r && o.push([ l, m - 1 ]); |
|
} else if (0 !== e) { |
|
p = n.isWalkableAt(l, m + e); |
|
var s = n.isWalkableAt(l + 1, m), t = n.isWalkableAt(l - 1, m); |
|
p && (o.push([ l, m + e ]), s && o.push([ l + 1, m + e ]), t && o.push([ l - 1, m + e ])), |
|
s && o.push([ l + 1, m ]), t && o.push([ l - 1, m ]); |
|
} |
|
} else for (g = n.getNeighbors(a, f.OnlyWhenNoObstacles), i = 0, j = g.length; j > i; ++i) h = g[i], |
|
o.push([ h.x, h.y ]); |
|
return o; |
|
}, b.exports = d; |
|
}, { |
|
"../core/DiagonalMovement": 5, |
|
"./JumpPointFinderBase": 24 |
|
} ], |
|
22: [ function(a, b, c) { |
|
function d(a) { |
|
e.call(this, a); |
|
} |
|
var e = a("./JumpPointFinderBase"), f = a("../core/DiagonalMovement"); |
|
d.prototype = new e(), d.prototype.constructor = d, d.prototype._jump = function(a, b, c, d) { |
|
var e = this.grid, f = a - c, g = b - d; |
|
if (!e.isWalkableAt(a, b)) return null; |
|
if (this.trackJumpRecursion === !0 && (e.getNodeAt(a, b).tested = !0), e.getNodeAt(a, b) === this.endNode) return [ a, b ]; |
|
if (0 !== f) { |
|
if (e.isWalkableAt(a, b - 1) && !e.isWalkableAt(a - f, b - 1) || e.isWalkableAt(a, b + 1) && !e.isWalkableAt(a - f, b + 1)) return [ a, b ]; |
|
} else { |
|
if (0 === g) throw new Error("Only horizontal and vertical movements are allowed"); |
|
if (e.isWalkableAt(a - 1, b) && !e.isWalkableAt(a - 1, b - g) || e.isWalkableAt(a + 1, b) && !e.isWalkableAt(a + 1, b - g)) return [ a, b ]; |
|
if (this._jump(a + 1, b, a, b) || this._jump(a - 1, b, a, b)) return [ a, b ]; |
|
} |
|
return this._jump(a + f, b + g, a, b); |
|
}, d.prototype._findNeighbors = function(a) { |
|
var b, c, d, e, g, h, i, j, k = a.parent, l = a.x, m = a.y, n = this.grid, o = []; |
|
if (k) b = k.x, c = k.y, d = (l - b) / Math.max(Math.abs(l - b), 1), e = (m - c) / Math.max(Math.abs(m - c), 1), |
|
0 !== d ? (n.isWalkableAt(l, m - 1) && o.push([ l, m - 1 ]), n.isWalkableAt(l, m + 1) && o.push([ l, m + 1 ]), |
|
n.isWalkableAt(l + d, m) && o.push([ l + d, m ])) : 0 !== e && (n.isWalkableAt(l - 1, m) && o.push([ l - 1, m ]), |
|
n.isWalkableAt(l + 1, m) && o.push([ l + 1, m ]), n.isWalkableAt(l, m + e) && o.push([ l, m + e ])); else for (g = n.getNeighbors(a, f.Never), |
|
i = 0, j = g.length; j > i; ++i) h = g[i], o.push([ h.x, h.y ]); |
|
return o; |
|
}, b.exports = d; |
|
}, { |
|
"../core/DiagonalMovement": 5, |
|
"./JumpPointFinderBase": 24 |
|
} ], |
|
23: [ function(a, b, c) { |
|
function d(a) { |
|
return a = a || {}, a.diagonalMovement === e.Never ? new f(a) : a.diagonalMovement === e.Always ? new g(a) : a.diagonalMovement === e.OnlyWhenNoObstacles ? new h(a) : new i(a); |
|
} |
|
var e = a("../core/DiagonalMovement"), f = a("./JPFNeverMoveDiagonally"), g = a("./JPFAlwaysMoveDiagonally"), h = a("./JPFMoveDiagonallyIfNoObstacles"), i = a("./JPFMoveDiagonallyIfAtMostOneObstacle"); |
|
b.exports = d; |
|
}, { |
|
"../core/DiagonalMovement": 5, |
|
"./JPFAlwaysMoveDiagonally": 19, |
|
"./JPFMoveDiagonallyIfAtMostOneObstacle": 20, |
|
"./JPFMoveDiagonallyIfNoObstacles": 21, |
|
"./JPFNeverMoveDiagonally": 22 |
|
} ], |
|
24: [ function(a, b, c) { |
|
function d(a) { |
|
a = a || {}, this.heuristic = a.heuristic || g.manhattan, this.trackJumpRecursion = a.trackJumpRecursion || !1; |
|
} |
|
var e = a("heap"), f = a("../core/Util"), g = a("../core/Heuristic"); |
|
a("../core/DiagonalMovement"); |
|
d.prototype.findPath = function(a, b, c, d, g) { |
|
var h, i = this.openList = new e(function(a, b) { |
|
return a.f - b.f; |
|
}), j = this.startNode = g.getNodeAt(a, b), k = this.endNode = g.getNodeAt(c, d); |
|
for (this.grid = g, j.g = 0, j.f = 0, i.push(j), j.opened = !0; !i.empty(); ) { |
|
if (h = i.pop(), h.closed = !0, h === k) return f.expandPath(f.backtrace(k)); |
|
this._identifySuccessors(h); |
|
} |
|
return []; |
|
}, d.prototype._identifySuccessors = function(a) { |
|
var b, c, d, e, f, h, i, j, k, l, m = this.grid, n = this.heuristic, o = this.openList, p = this.endNode.x, q = this.endNode.y, r = a.x, s = a.y, t = Math.abs; |
|
Math.max; |
|
for (b = this._findNeighbors(a), e = 0, f = b.length; f > e; ++e) if (c = b[e], |
|
d = this._jump(c[0], c[1], r, s)) { |
|
if (h = d[0], i = d[1], l = m.getNodeAt(h, i), l.closed) continue; |
|
j = g.octile(t(h - r), t(i - s)), k = a.g + j, (!l.opened || k < l.g) && (l.g = k, |
|
l.h = l.h || n(t(h - p), t(i - q)), l.f = l.g + l.h, l.parent = a, l.opened ? o.updateItem(l) : (o.push(l), |
|
l.opened = !0)); |
|
} |
|
}, b.exports = d; |
|
}, { |
|
"../core/DiagonalMovement": 5, |
|
"../core/Heuristic": 7, |
|
"../core/Util": 9, |
|
heap: 2 |
|
} ], |
|
25: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = {}; |
|
try { |
|
e = a("./local-config"); |
|
} catch (f) {} |
|
d.merge(e, { |
|
redis: { |
|
port: 6379, |
|
host: "127.0.0.1", |
|
options: {} |
|
} |
|
}), b.exports = e; |
|
}, { |
|
"./local-config": 58, |
|
lodash: 60 |
|
} ], |
|
26: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a) { |
|
for (var b in a) "_" != b[0] ? e.isArray(a[b]) ? a[b].forEach(d) : e.isObject(a[b]) && d(a[b]) : delete a[b]; |
|
} |
|
var e = (a("q"), a("./local-storage"), a("lodash")), f = a("./message-mux"); |
|
b.exports = function(a) { |
|
var b = [], c = [], g = []; |
|
return { |
|
update: function(a, c) { |
|
c = e.cloneDeep(c), d(c), e.isObject(a) && (e.merge(a, c), a = a._id), b.push({ |
|
_id: a, |
|
data: c |
|
}); |
|
}, |
|
insert: function(a) { |
|
a = e.cloneDeep(a), d(a), c.push(a); |
|
}, |
|
remove: function(a) { |
|
g.push(a); |
|
}, |
|
execute: function() { |
|
return f.sendMessage({ |
|
type: "bulk", |
|
storage: a, |
|
updates: b, |
|
inserts: c, |
|
removes: g |
|
}); |
|
} |
|
}; |
|
}; |
|
}, { |
|
"./local-storage": 30, |
|
"./message-mux": 31, |
|
lodash: 32, |
|
q: 33 |
|
} ], |
|
27: [ function(a, b, c) { |
|
"use strict"; |
|
b.exports = { |
|
localStorage: { |
|
PENDING_QUEUE: "pendingQueue_", |
|
PROCESSING_QUEUE: "processingQueue_", |
|
USERS: "users", |
|
USERS_CODE: "users.code.activeSim", |
|
USERS_MEMORY: "users.memory", |
|
TRANSACTIONS: "transactions", |
|
ROOMS: "rooms", |
|
ROOMS_OBJECTS: "rooms.objects", |
|
ROOMS_FLAGS: "rooms.flags", |
|
ROOMS_TERRAIN: "rooms.terrain", |
|
ROOMS_INTENTS: "rooms.intents", |
|
GAME_TIME: "gametime", |
|
RUN_TIMESTAMP: "runTimestamp", |
|
GAME_INFO: "gameinfo", |
|
REPLAY: "replay" |
|
} |
|
}; |
|
}, {} ], |
|
28: [ function(require, module, exports) { |
|
"use strict"; |
|
function EvalCodeError(a) { |
|
this.toString = function() { |
|
return a; |
|
}; |
|
} |
|
!function() { |
|
var a = require("lodash"), b = require("q"), c = require("./config"), d = require("./local-storage"), e = require("./bulk"), f = require("./workers"), g = require("./message-mux"), h = { |
|
0: [], |
|
1: [], |
|
2: [] |
|
}, i = b.defer(), j = new Date().getTime(), k = require("../utils"); |
|
self.onmessage = function(a) { |
|
"setTickPeriod" == a.data.type ? i.resolve(a.data.period) : "worker" == a.data.type ? f.handleMessage(a.data) : a.data.consoleCommand ? h[a.data.userId].push({ |
|
expression: a.data.consoleCommand |
|
}) : g.handleMessage(a.data); |
|
}, setInterval(function() { |
|
d.get(c.localStorage.RUN_TIMESTAMP).then(function(a) { |
|
a > j && self.close(); |
|
}); |
|
}, 1e3), exports.queue = require("./queue"), exports.getTickPeriod = function() { |
|
return i.promise; |
|
}, exports.connect = function() { |
|
return b.all([ d.initArray(c.localStorage.USERS), d.initArray(c.localStorage.ROOMS, [ { |
|
_id: "sim" |
|
} ]), d.initArray(c.localStorage.ROOMS_OBJECTS), d.initArray(c.localStorage.ROOMS_FLAGS), d.initArray(c.localStorage.ROOMS_INTENTS) ]); |
|
}, exports.setupRunner = function() {}, exports.setupProcessor = function() {}, |
|
exports.setupMain = function() {}, exports.getUserData = function(b) { |
|
return d.get(c.localStorage.USERS).then(function(c) { |
|
var d = new Object({ |
|
user: a.find(d[0], function(a) { |
|
return a._id == b; |
|
}), |
|
cpu: 1 / 0 |
|
}); |
|
return d; |
|
}); |
|
}, exports.getRuntimeData = function(e) { |
|
return b.all([ d.get(c.localStorage.USERS), d.get(c.localStorage.USERS_CODE).then(function(b) { |
|
return a.find(b, function(a) { |
|
return a._id == e; |
|
}); |
|
}), d.get(c.localStorage.ROOMS_OBJECTS), d.get(c.localStorage.ROOMS), d.get(c.localStorage.GAME_TIME), d.get(c.localStorage.ROOMS_TERRAIN), d.get(c.localStorage.USERS_MEMORY).then(function(b) { |
|
return a.find(b, function(a) { |
|
return a._id == e; |
|
}); |
|
}), d.get(c.localStorage.GAME_INFO), d.get(c.localStorage.TRANSACTIONS), d.get(c.localStorage.ROOMS_FLAGS) ]).then(function(b) { |
|
var c = {}; |
|
b[5].forEach(function(a) { |
|
for (var b, d = new Uint8Array(2500), e = 0; 2500 > e; e++) b = a.terrain.charAt(e), |
|
d[e] = Number(b); |
|
c[a.room] = d; |
|
}), b[9].forEach(function(a) { |
|
return a.room = "sim"; |
|
}); |
|
var b = new Object({ |
|
user: a.find(b[0], function(a) { |
|
return a._id == e; |
|
}), |
|
users: exports.mapById(b[0]), |
|
userCode: b[1] && b[1].modules, |
|
userCodeTimestamp: b[1] && b[1].timestamp || 0, |
|
userObjects: exports.mapById(a.filter(b[2], function(a) { |
|
return a.user == e; |
|
})), |
|
roomObjects: exports.mapById(b[2]), |
|
flags: a.filter(b[9], function(a) { |
|
return a.user == e; |
|
}), |
|
rooms: exports.mapById(b[3]), |
|
time: b[4], |
|
consoleCommands: h[e], |
|
userMemory: b[6].memory, |
|
cpu: 1 / 0, |
|
games: { |
|
sim: b[7] |
|
}, |
|
transactions: { |
|
incoming: b[8], |
|
outgoing: b[8] |
|
}, |
|
staticTerrainData: c, |
|
sim: !0 |
|
}); |
|
return h[e] = [], b; |
|
}); |
|
}, exports.getAllUsers = function() { |
|
return d.get(c.localStorage.USERS); |
|
}, exports.makeRuntime = function(a, c) { |
|
return exports.getRuntimeData(a, c).then(function(c) { |
|
var d = f.create("runtime"), e = b.defer(), h = !1, i = { |
|
type: "timeout", |
|
timeout: 5e3 |
|
}; |
|
return g.sendMessage(i).then(function() { |
|
h || (d.terminate(), e.reject("Script execution has been terminated")); |
|
}), d.onmessage = function(b) { |
|
"done" == b.data.type && (h = !0, g.sendMessage({ |
|
type: "clearTimeout", |
|
timeoutTransactionId: i.transactionId |
|
}), b.data.intents && (b.data.intents = k.storeIntents(a, b.data.intents, c)), e.resolve(b.data)), |
|
"error" == b.data.type && (h = !0, g.sendMessage({ |
|
type: "clearTimeout", |
|
timeoutTransactionId: i.transactionId |
|
}), b.data.intents && (b.data.intents = k.storeIntents(a, b.data.intents, c)), e.reject(b.data)); |
|
}, d.postMessage(c), e.promise; |
|
})["catch"](function(a) { |
|
return "error" == a.type ? b.reject(a) : b.reject({ |
|
type: "reject" |
|
}); |
|
}); |
|
}, exports.saveUserMemory = function(b, e) { |
|
return d.get(c.localStorage.USERS_MEMORY).then(function(f) { |
|
var g = a.find(f, function(a) { |
|
return a._id == b; |
|
}); |
|
return g.memory = e, d.put(c.localStorage.USERS_MEMORY, f); |
|
}); |
|
}, exports.saveUserIntents = function(b, e) { |
|
return d.get(c.localStorage.ROOMS_INTENTS).then(function(f) { |
|
for (var g in e) if ("notify" != g) { |
|
var h = a.find(f, { |
|
room: g |
|
}); |
|
h || f.push(h = { |
|
room: g |
|
}), h.users = h.users || {}, h.users[b] = h.users[b] || { |
|
objects: {} |
|
}, a.merge(h.users[b].objects, e[g]); |
|
} |
|
return d.put(c.localStorage.ROOMS_INTENTS, f); |
|
}); |
|
}, exports.getAllRooms = function() { |
|
return d.get(c.localStorage.ROOMS); |
|
}, exports.getRoomIntents = function(b) { |
|
return d.get(c.localStorage.ROOMS_INTENTS).then(function(c) { |
|
return a.find(c, { |
|
room: b |
|
}); |
|
}); |
|
}, exports.getRoomObjects = function(a) { |
|
return d.get(c.localStorage.ROOMS_OBJECTS).then(function(a) { |
|
return exports.mapById(a); |
|
}); |
|
}, exports.getRoomFlags = function(a) { |
|
return d.get(c.localStorage.ROOMS_FLAGS); |
|
}, exports.getRoomTerrain = function(a) { |
|
return d.get(c.localStorage.ROOMS_TERRAIN).then(function(a) { |
|
return exports.mapById(a); |
|
}); |
|
}, exports.bulkObjectsWrite = function() { |
|
return e(c.localStorage.ROOMS_OBJECTS); |
|
}, exports.bulkFlagsWrite = function() { |
|
return e(c.localStorage.ROOMS_FLAGS); |
|
}, exports.bulkUsersWrite = function() { |
|
return e(c.localStorage.USERS); |
|
}, exports.bulkTransactionsWrite = function() { |
|
return e(c.localStorage.TRANSACTIONS); |
|
}, exports.clearRoomIntents = function(b) { |
|
return d.get(c.localStorage.ROOMS_INTENTS).then(function(e) { |
|
return a.remove(e, { |
|
room: b |
|
}), d.put(c.localStorage.ROOMS_INTENTS, e); |
|
}); |
|
}, exports.mapById = function(b) { |
|
return a.reduce(b, function(a, b) { |
|
return a[b._id.toString()] = b, a; |
|
}, {}); |
|
}, exports.notifyRoomsDone = function() { |
|
return g.sendMessage({ |
|
type: "roomsDone" |
|
}); |
|
}, exports.sendConsoleMessages = function(a, b) { |
|
self.postMessage({ |
|
type: "console", |
|
userId: a, |
|
messages: b |
|
}); |
|
}, exports.sendConsoleError = function(a, b) { |
|
"undefined" != typeof self, self.postMessage({ |
|
type: "console", |
|
userId: a, |
|
error: "" + b |
|
}); |
|
}, exports.getGameTime = function() { |
|
return d.get(c.localStorage.GAME_TIME); |
|
}, exports.incrementGameTime = function() { |
|
return d.get(c.localStorage.GAME_TIME).then(function(a) { |
|
return a++, d.put(c.localStorage.GAME_TIME, a); |
|
}); |
|
}, exports.getGameInfo = function() { |
|
return d.get(c.localStorage.GAME_INFO); |
|
}, exports.saveGameInfo = function(a, b) { |
|
return d.get(c.localStorage.REPLAY).then(function(e) { |
|
return e.log[a.score] = k.getDiff(e.current, b), e.current = b, d.put(c.localStorage.REPLAY, e); |
|
}).then(function() { |
|
return d.put(c.localStorage.GAME_INFO, a); |
|
}); |
|
}, exports.finishGame = function(a) {}, exports.sendUsageMetrics = function(a) {}, |
|
exports.getInterRoom = function() { |
|
return b.when([]); |
|
}, exports.deactivateRoom = function(a) { |
|
return b.when(null); |
|
}, exports.saveAccessibleRoomsList = function() { |
|
return b.when(null); |
|
}, exports.sendNotification = function() { |
|
return b.when(null); |
|
}, exports.getRoomStatsUpdater = function() { |
|
return { |
|
inc: function() {}, |
|
save: function() { |
|
return b.when(null); |
|
} |
|
}; |
|
}, exports.roomsStatsSave = function() { |
|
return b.when(null); |
|
}, exports.saveIdleTime = function() { |
|
return b.when(null); |
|
}, exports.commitDbBulk = function() { |
|
return b.when(null); |
|
}, exports.notifyTickStarted = function() { |
|
return b.when(null); |
|
}, exports.flushTimelineStats = function() { |
|
return b.when(null); |
|
}, exports.cleanTimelineStats = function() { |
|
return b.when(null); |
|
}, exports.getMapGridData = function() { |
|
return {}; |
|
}, exports.mapViewSave = function() { |
|
return b.when(null); |
|
}, exports.getRoomInfo = function() { |
|
return b.when({}); |
|
}, exports.history = require("./history"), exports.pathFinder = require("./path-finder"); |
|
}(), exports.evalCode = function(module, globals, returnValue) { |
|
var window, self, process, exports = module.exports, scopeInject = ""; |
|
for (var i in globals) scopeInject += i + " = __globals." + i + ", "; |
|
module.name = module.name.replace(/[^a-zA-Z0-9_]+/g, ""); |
|
try { |
|
if (returnValue) return eval("(function __run_" + module.name + "(__globals){ var " + scopeInject + "globals = undefined, __result = " + module.code + ";\n return __result; \n}).call(global, globals);"); |
|
"__mainLoop" != module.name && (module.code = "module.__initGlobals = function() { " + scopeInject.replace(/,/g, ";") + " }; " + module.code), |
|
eval("(function __run_" + module.name + "(__globals){ var " + scopeInject + "globals = undefined; " + module.code + " \n}).call(global, globals);"); |
|
} catch (e) { |
|
if (e instanceof EvalCodeError) throw e; |
|
var message = ""; |
|
if (/at Object\.exports\.evalCode /.test(e.stack)) { |
|
message = e.stack, message = message.replace(/at __run_([^ ]+) /g, "at $1 "), message = message.replace(/</g, "<"); |
|
var strip = [ "Object\\.eval", "Object\\.exports\\.evalCode", "Object\\.exports\\.runCode", "requireFn" ]; |
|
strip.forEach(function(a) { |
|
var b = new RegExp(" *at " + a + " [^\n]*?\n", "g"); |
|
message = message.replace(b, ""); |
|
}), message = message.replace(/ *at .*?$/, ""), message = message.replace(/ \([^\n]*\:(\d+)\:(\d+)\)\n/g, ":$1:$2\n"), |
|
message = message.replace(/_console\d+:\d+/g, "console"); |
|
} else message = e.message; |
|
throw new EvalCodeError(message); |
|
} |
|
}; |
|
}, { |
|
"../utils": 140, |
|
"./bulk": 26, |
|
"./config": 27, |
|
"./history": 29, |
|
"./local-storage": 30, |
|
"./message-mux": 31, |
|
"./path-finder": 34, |
|
"./queue": 35, |
|
"./workers": 38, |
|
lodash: 32, |
|
q: 33 |
|
} ], |
|
29: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("q"); |
|
c.saveTick = function(a, b, c) { |
|
return d.when(); |
|
}, c.get = function(a) { |
|
return d.when(); |
|
}, c.upload = function(a, b, c) { |
|
return d.when(); |
|
}, c.del = function(a) { |
|
return d.when(); |
|
}; |
|
}, { |
|
q: 33 |
|
} ], |
|
30: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("q"), a("./message-mux")); |
|
c.put = function(a, b) { |
|
return d.sendMessage({ |
|
type: "localStorage", |
|
put: { |
|
key: a, |
|
value: b |
|
} |
|
}).then(function(a) { |
|
return a.put.value; |
|
}); |
|
}, c.get = function(a) { |
|
return d.sendMessage({ |
|
type: "localStorage", |
|
get: { |
|
key: a |
|
} |
|
}).then(function(a) { |
|
return a.get.value; |
|
}); |
|
}, c.initArray = function(a, b) { |
|
return c.get(a).then(function(d) { |
|
return d ? void 0 : c.put(a, b || []); |
|
}); |
|
}; |
|
}, { |
|
"./message-mux": 31, |
|
q: 33 |
|
} ], |
|
31: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("q"), e = {}, f = 0; |
|
c.sendMessage = function(a) { |
|
return f++, e[f] = d.defer(), a.transactionId = f, self.postMessage(a), e[f].promise; |
|
}, c.handleMessage = function(a) { |
|
e[a.transactionId] && (a.reject ? e[a.transactionId].reject(a) : e[a.transactionId].resolve(a), |
|
delete e[a.transactionId]); |
|
}; |
|
}, { |
|
q: 33 |
|
} ], |
|
32: [ function(a, b, c) { |
|
(function(a) { |
|
(function() { |
|
function d(a, b) { |
|
if (a !== b) { |
|
var c = null === a, d = a === z, e = a === a, f = null === b, g = b === z, h = b === b; |
|
if (a > b && !f || !e || c && !g && h || d && h) return 1; |
|
if (b > a && !c || !h || f && !d && e || g && e) return -1; |
|
} |
|
return 0; |
|
} |
|
function e(a, b, c) { |
|
for (var d = a.length, e = c ? d : -1; c ? e-- : ++e < d; ) if (b(a[e], e, a)) return e; |
|
return -1; |
|
} |
|
function f(a, b, c) { |
|
if (b !== b) return q(a, c); |
|
for (var d = c - 1, e = a.length; ++d < e; ) if (a[d] === b) return d; |
|
return -1; |
|
} |
|
function g(a) { |
|
return "function" == typeof a || !1; |
|
} |
|
function h(a) { |
|
return null == a ? "" : a + ""; |
|
} |
|
function i(a, b) { |
|
for (var c = -1, d = a.length; ++c < d && b.indexOf(a.charAt(c)) > -1; ) ; |
|
return c; |
|
} |
|
function j(a, b) { |
|
for (var c = a.length; c-- && b.indexOf(a.charAt(c)) > -1; ) ; |
|
return c; |
|
} |
|
function k(a, b) { |
|
return d(a.criteria, b.criteria) || a.index - b.index; |
|
} |
|
function l(a, b, c) { |
|
for (var e = -1, f = a.criteria, g = b.criteria, h = f.length, i = c.length; ++e < h; ) { |
|
var j = d(f[e], g[e]); |
|
if (j) { |
|
if (e >= i) return j; |
|
var k = c[e]; |
|
return j * ("asc" === k || k === !0 ? 1 : -1); |
|
} |
|
} |
|
return a.index - b.index; |
|
} |
|
function m(a) { |
|
return Sa[a]; |
|
} |
|
function n(a) { |
|
return Ta[a]; |
|
} |
|
function o(a, b, c) { |
|
return b ? a = Wa[a] : c && (a = Xa[a]), "\\" + a; |
|
} |
|
function p(a) { |
|
return "\\" + Xa[a]; |
|
} |
|
function q(a, b, c) { |
|
for (var d = a.length, e = b + (c ? 0 : -1); c ? e-- : ++e < d; ) { |
|
var f = a[e]; |
|
if (f !== f) return e; |
|
} |
|
return -1; |
|
} |
|
function r(a) { |
|
return !!a && "object" == typeof a; |
|
} |
|
function s(a) { |
|
return 160 >= a && a >= 9 && 13 >= a || 32 == a || 160 == a || 5760 == a || 6158 == a || a >= 8192 && (8202 >= a || 8232 == a || 8233 == a || 8239 == a || 8287 == a || 12288 == a || 65279 == a); |
|
} |
|
function t(a, b) { |
|
for (var c = -1, d = a.length, e = -1, f = []; ++c < d; ) a[c] === b && (a[c] = S, |
|
f[++e] = c); |
|
return f; |
|
} |
|
function u(a, b) { |
|
for (var c, d = -1, e = a.length, f = -1, g = []; ++d < e; ) { |
|
var h = a[d], i = b ? b(h, d, a) : h; |
|
d && c === i || (c = i, g[++f] = h); |
|
} |
|
return g; |
|
} |
|
function v(a) { |
|
for (var b = -1, c = a.length; ++b < c && s(a.charCodeAt(b)); ) ; |
|
return b; |
|
} |
|
function w(a) { |
|
for (var b = a.length; b-- && s(a.charCodeAt(b)); ) ; |
|
return b; |
|
} |
|
function x(a) { |
|
return Ua[a]; |
|
} |
|
function y(a) { |
|
function b(a) { |
|
if (r(a) && !Ch(a) && !(a instanceof Z)) { |
|
if (a instanceof s) return a; |
|
if (ag.call(a, "__chain__") && ag.call(a, "__wrapped__")) return md(a); |
|
} |
|
return new s(a); |
|
} |
|
function c() {} |
|
function s(a, b, c) { |
|
this.__wrapped__ = a, this.__actions__ = c || [], this.__chain__ = !!b; |
|
} |
|
function Z(a) { |
|
this.__wrapped__ = a, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, |
|
this.__iteratees__ = [], this.__takeCount__ = Bg, this.__views__ = []; |
|
} |
|
function ba() { |
|
var a = new Z(this.__wrapped__); |
|
return a.__actions__ = ab(this.__actions__), a.__dir__ = this.__dir__, a.__filtered__ = this.__filtered__, |
|
a.__iteratees__ = ab(this.__iteratees__), a.__takeCount__ = this.__takeCount__, |
|
a.__views__ = ab(this.__views__), a; |
|
} |
|
function da() { |
|
if (this.__filtered__) { |
|
var a = new Z(this); |
|
a.__dir__ = -1, a.__filtered__ = !0; |
|
} else a = this.clone(), a.__dir__ *= -1; |
|
return a; |
|
} |
|
function Sa() { |
|
var a = this.__wrapped__.value(), b = this.__dir__, c = Ch(a), d = 0 > b, e = c ? a.length : 0, f = Tc(0, e, this.__views__), g = f.start, h = f.end, i = h - g, j = d ? h : g - 1, k = this.__iteratees__, l = k.length, m = 0, n = wg(i, this.__takeCount__); |
|
if (!c || O > e || e == i && n == i) return cc(d && c ? a.reverse() : a, this.__actions__); |
|
var o = []; |
|
a: for (;i-- && n > m; ) { |
|
j += b; |
|
for (var p = -1, q = a[j]; ++p < l; ) { |
|
var r = k[p], s = r.iteratee, t = r.type, u = s(q); |
|
if (t == Q) q = u; else if (!u) { |
|
if (t == P) continue a; |
|
break a; |
|
} |
|
} |
|
o[m++] = q; |
|
} |
|
return o; |
|
} |
|
function Ta() { |
|
this.__data__ = {}; |
|
} |
|
function Ua(a) { |
|
return this.has(a) && delete this.__data__[a]; |
|
} |
|
function Va(a) { |
|
return "__proto__" == a ? z : this.__data__[a]; |
|
} |
|
function Wa(a) { |
|
return "__proto__" != a && ag.call(this.__data__, a); |
|
} |
|
function Xa(a, b) { |
|
return "__proto__" != a && (this.__data__[a] = b), this; |
|
} |
|
function Ya(a) { |
|
var b = a ? a.length : 0; |
|
for (this.data = { |
|
hash: qg(null), |
|
set: new kg() |
|
}; b--; ) this.push(a[b]); |
|
} |
|
function Za(a, b) { |
|
var c = a.data, d = "string" == typeof b || He(b) ? c.set.has(b) : c.hash[b]; |
|
return d ? 0 : -1; |
|
} |
|
function $a(a) { |
|
var b = this.data; |
|
"string" == typeof a || He(a) ? b.set.add(a) : b.hash[a] = !0; |
|
} |
|
function _a(a, b) { |
|
for (var c = -1, d = a.length, e = -1, f = b.length, g = Of(d + f); ++c < d; ) g[c] = a[c]; |
|
for (;++e < f; ) g[c++] = b[e]; |
|
return g; |
|
} |
|
function ab(a, b) { |
|
var c = -1, d = a.length; |
|
for (b || (b = Of(d)); ++c < d; ) b[c] = a[c]; |
|
return b; |
|
} |
|
function bb(a, b) { |
|
for (var c = -1, d = a.length; ++c < d && b(a[c], c, a) !== !1; ) ; |
|
return a; |
|
} |
|
function eb(a, b) { |
|
for (var c = a.length; c-- && b(a[c], c, a) !== !1; ) ; |
|
return a; |
|
} |
|
function fb(a, b) { |
|
for (var c = -1, d = a.length; ++c < d; ) if (!b(a[c], c, a)) return !1; |
|
return !0; |
|
} |
|
function gb(a, b, c, d) { |
|
for (var e = -1, f = a.length, g = d, h = g; ++e < f; ) { |
|
var i = a[e], j = +b(i); |
|
c(j, g) && (g = j, h = i); |
|
} |
|
return h; |
|
} |
|
function hb(a, b) { |
|
for (var c = -1, d = a.length, e = -1, f = []; ++c < d; ) { |
|
var g = a[c]; |
|
b(g, c, a) && (f[++e] = g); |
|
} |
|
return f; |
|
} |
|
function ib(a, b) { |
|
for (var c = -1, d = a.length, e = Of(d); ++c < d; ) e[c] = b(a[c], c, a); |
|
return e; |
|
} |
|
function jb(a, b) { |
|
for (var c = -1, d = b.length, e = a.length; ++c < d; ) a[e + c] = b[c]; |
|
return a; |
|
} |
|
function kb(a, b, c, d) { |
|
var e = -1, f = a.length; |
|
for (d && f && (c = a[++e]); ++e < f; ) c = b(c, a[e], e, a); |
|
return c; |
|
} |
|
function lb(a, b, c, d) { |
|
var e = a.length; |
|
for (d && e && (c = a[--e]); e--; ) c = b(c, a[e], e, a); |
|
return c; |
|
} |
|
function mb(a, b) { |
|
for (var c = -1, d = a.length; ++c < d; ) if (b(a[c], c, a)) return !0; |
|
return !1; |
|
} |
|
function nb(a, b) { |
|
for (var c = a.length, d = 0; c--; ) d += +b(a[c]) || 0; |
|
return d; |
|
} |
|
function ob(a, b) { |
|
return a === z ? b : a; |
|
} |
|
function pb(a, b, c, d) { |
|
return a !== z && ag.call(d, c) ? a : b; |
|
} |
|
function qb(a, b, c) { |
|
for (var d = -1, e = Nh(b), f = e.length; ++d < f; ) { |
|
var g = e[d], h = a[g], i = c(h, b[g], g, a, b); |
|
(i === i ? i === h : h !== h) && (h !== z || g in a) || (a[g] = i); |
|
} |
|
return a; |
|
} |
|
function rb(a, b) { |
|
return null == b ? a : tb(b, Nh(b), a); |
|
} |
|
function sb(a, b) { |
|
for (var c = -1, d = null == a, e = !d && Yc(a), f = e ? a.length : 0, g = b.length, h = Of(g); ++c < g; ) { |
|
var i = b[c]; |
|
e ? h[c] = Zc(i, f) ? a[i] : z : h[c] = d ? z : a[i]; |
|
} |
|
return h; |
|
} |
|
function tb(a, b, c) { |
|
c || (c = {}); |
|
for (var d = -1, e = b.length; ++d < e; ) { |
|
var f = b[d]; |
|
c[f] = a[f]; |
|
} |
|
return c; |
|
} |
|
function ub(a, b, c) { |
|
var d = typeof a; |
|
return "function" == d ? b === z ? a : fc(a, b, c) : null == a ? Bf : "object" == d ? Nb(a) : b === z ? Hf(a) : Ob(a, b); |
|
} |
|
function vb(a, b, c, d, e, f, g) { |
|
var h; |
|
if (c && (h = e ? c(a, d, e) : c(a)), h !== z) return h; |
|
if (!He(a)) return a; |
|
var i = Ch(a); |
|
if (i) { |
|
if (h = Uc(a), !b) return ab(a, h); |
|
} else { |
|
var j = cg.call(a), k = j == Y; |
|
if (j != _ && j != T && (!k || e)) return Ra[j] ? Wc(a, j, b) : e ? a : {}; |
|
if (h = Vc(k ? {} : a), !b) return rb(h, a); |
|
} |
|
f || (f = []), g || (g = []); |
|
for (var l = f.length; l--; ) if (f[l] == a) return g[l]; |
|
return f.push(a), g.push(h), (i ? bb : Fb)(a, function(d, e) { |
|
h[e] = vb(d, b, c, e, a, f, g); |
|
}), h; |
|
} |
|
function wb(a, b, c) { |
|
if ("function" != typeof a) throw new Xf(R); |
|
return lg(function() { |
|
a.apply(z, c); |
|
}, b); |
|
} |
|
function xb(a, b) { |
|
var c = a ? a.length : 0, d = []; |
|
if (!c) return d; |
|
var e = -1, g = Qc(), h = g == f, i = h && b.length >= O ? oc(b) : null, j = b.length; |
|
i && (g = Za, h = !1, b = i); |
|
a: for (;++e < c; ) { |
|
var k = a[e]; |
|
if (h && k === k) { |
|
for (var l = j; l--; ) if (b[l] === k) continue a; |
|
d.push(k); |
|
} else g(b, k, 0) < 0 && d.push(k); |
|
} |
|
return d; |
|
} |
|
function yb(a, b) { |
|
var c = !0; |
|
return Jg(a, function(a, d, e) { |
|
return c = !!b(a, d, e); |
|
}), c; |
|
} |
|
function zb(a, b, c, d) { |
|
var e = d, f = e; |
|
return Jg(a, function(a, g, h) { |
|
var i = +b(a, g, h); |
|
(c(i, e) || i === d && i === f) && (e = i, f = a); |
|
}), f; |
|
} |
|
function Ab(a, b, c, d) { |
|
var e = a.length; |
|
for (c = null == c ? 0 : +c || 0, 0 > c && (c = -c > e ? 0 : e + c), d = d === z || d > e ? e : +d || 0, |
|
0 > d && (d += e), e = c > d ? 0 : d >>> 0, c >>>= 0; e > c; ) a[c++] = b; |
|
return a; |
|
} |
|
function Bb(a, b) { |
|
var c = []; |
|
return Jg(a, function(a, d, e) { |
|
b(a, d, e) && c.push(a); |
|
}), c; |
|
} |
|
function Cb(a, b, c, d) { |
|
var e; |
|
return c(a, function(a, c, f) { |
|
return b(a, c, f) ? (e = d ? c : a, !1) : void 0; |
|
}), e; |
|
} |
|
function Db(a, b, c, d) { |
|
d || (d = []); |
|
for (var e = -1, f = a.length; ++e < f; ) { |
|
var g = a[e]; |
|
r(g) && Yc(g) && (c || Ch(g) || ye(g)) ? b ? Db(g, b, c, d) : jb(d, g) : c || (d[d.length] = g); |
|
} |
|
return d; |
|
} |
|
function Eb(a, b) { |
|
return Lg(a, b, _e); |
|
} |
|
function Fb(a, b) { |
|
return Lg(a, b, Nh); |
|
} |
|
function Gb(a, b) { |
|
return Mg(a, b, Nh); |
|
} |
|
function Hb(a, b) { |
|
for (var c = -1, d = b.length, e = -1, f = []; ++c < d; ) { |
|
var g = b[c]; |
|
Ge(a[g]) && (f[++e] = g); |
|
} |
|
return f; |
|
} |
|
function Ib(a, b, c) { |
|
if (null != a) { |
|
c !== z && c in kd(a) && (b = [ c ]); |
|
for (var d = 0, e = b.length; null != a && e > d; ) a = a[b[d++]]; |
|
return d && d == e ? a : z; |
|
} |
|
} |
|
function Jb(a, b, c, d, e, f) { |
|
return a === b ? !0 : null == a || null == b || !He(a) && !r(b) ? a !== a && b !== b : Kb(a, b, Jb, c, d, e, f); |
|
} |
|
function Kb(a, b, c, d, e, f, g) { |
|
var h = Ch(a), i = Ch(b), j = U, k = U; |
|
h || (j = cg.call(a), j == T ? j = _ : j != _ && (h = Qe(a))), i || (k = cg.call(b), |
|
k == T ? k = _ : k != _ && (i = Qe(b))); |
|
var l = j == _, m = k == _, n = j == k; |
|
if (n && !h && !l) return Mc(a, b, j); |
|
if (!e) { |
|
var o = l && ag.call(a, "__wrapped__"), p = m && ag.call(b, "__wrapped__"); |
|
if (o || p) return c(o ? a.value() : a, p ? b.value() : b, d, e, f, g); |
|
} |
|
if (!n) return !1; |
|
f || (f = []), g || (g = []); |
|
for (var q = f.length; q--; ) if (f[q] == a) return g[q] == b; |
|
f.push(a), g.push(b); |
|
var r = (h ? Lc : Nc)(a, b, c, d, e, f, g); |
|
return f.pop(), g.pop(), r; |
|
} |
|
function Lb(a, b, c) { |
|
var d = b.length, e = d, f = !c; |
|
if (null == a) return !e; |
|
for (a = kd(a); d--; ) { |
|
var g = b[d]; |
|
if (f && g[2] ? g[1] !== a[g[0]] : !(g[0] in a)) return !1; |
|
} |
|
for (;++d < e; ) { |
|
g = b[d]; |
|
var h = g[0], i = a[h], j = g[1]; |
|
if (f && g[2]) { |
|
if (i === z && !(h in a)) return !1; |
|
} else { |
|
var k = c ? c(i, j, h) : z; |
|
if (!(k === z ? Jb(j, i, c, !0) : k)) return !1; |
|
} |
|
} |
|
return !0; |
|
} |
|
function Mb(a, b) { |
|
var c = -1, d = Yc(a) ? Of(a.length) : []; |
|
return Jg(a, function(a, e, f) { |
|
d[++c] = b(a, e, f); |
|
}), d; |
|
} |
|
function Nb(a) { |
|
var b = Rc(a); |
|
if (1 == b.length && b[0][2]) { |
|
var c = b[0][0], d = b[0][1]; |
|
return function(a) { |
|
return null == a ? !1 : a[c] === d && (d !== z || c in kd(a)); |
|
}; |
|
} |
|
return function(a) { |
|
return Lb(a, b); |
|
}; |
|
} |
|
function Ob(a, b) { |
|
var c = Ch(a), d = _c(a) && cd(b), e = a + ""; |
|
return a = ld(a), function(f) { |
|
if (null == f) return !1; |
|
var g = e; |
|
if (f = kd(f), (c || !d) && !(g in f)) { |
|
if (f = 1 == a.length ? f : Ib(f, Wb(a, 0, -1)), null == f) return !1; |
|
g = zd(a), f = kd(f); |
|
} |
|
return f[g] === b ? b !== z || g in f : Jb(b, f[g], z, !0); |
|
}; |
|
} |
|
function Pb(a, b, c, d, e) { |
|
if (!He(a)) return a; |
|
var f = Yc(b) && (Ch(b) || Qe(b)), g = f ? z : Nh(b); |
|
return bb(g || b, function(h, i) { |
|
if (g && (i = h, h = b[i]), r(h)) d || (d = []), e || (e = []), Qb(a, b, i, Pb, c, d, e); else { |
|
var j = a[i], k = c ? c(j, h, i, a, b) : z, l = k === z; |
|
l && (k = h), k === z && (!f || i in a) || !l && (k === k ? k === j : j !== j) || (a[i] = k); |
|
} |
|
}), a; |
|
} |
|
function Qb(a, b, c, d, e, f, g) { |
|
for (var h = f.length, i = b[c]; h--; ) if (f[h] == i) return void (a[c] = g[h]); |
|
var j = a[c], k = e ? e(j, i, c, a, b) : z, l = k === z; |
|
l && (k = i, Yc(i) && (Ch(i) || Qe(i)) ? k = Ch(j) ? j : Yc(j) ? ab(j) : [] : Ne(i) || ye(i) ? k = ye(j) ? Ve(j) : Ne(j) ? j : {} : l = !1), |
|
f.push(i), g.push(k), l ? a[c] = d(k, i, e, f, g) : (k === k ? k !== j : j === j) && (a[c] = k); |
|
} |
|
function Rb(a) { |
|
return function(b) { |
|
return null == b ? z : b[a]; |
|
}; |
|
} |
|
function Sb(a) { |
|
var b = a + ""; |
|
return a = ld(a), function(c) { |
|
return Ib(c, a, b); |
|
}; |
|
} |
|
function Tb(a, b) { |
|
for (var c = a ? b.length : 0; c--; ) { |
|
var d = b[c]; |
|
if (d != e && Zc(d)) { |
|
var e = d; |
|
mg.call(a, d, 1); |
|
} |
|
} |
|
return a; |
|
} |
|
function Ub(a, b) { |
|
return a + rg(zg() * (b - a + 1)); |
|
} |
|
function Vb(a, b, c, d, e) { |
|
return e(a, function(a, e, f) { |
|
c = d ? (d = !1, a) : b(c, a, e, f); |
|
}), c; |
|
} |
|
function Wb(a, b, c) { |
|
var d = -1, e = a.length; |
|
b = null == b ? 0 : +b || 0, 0 > b && (b = -b > e ? 0 : e + b), c = c === z || c > e ? e : +c || 0, |
|
0 > c && (c += e), e = b > c ? 0 : c - b >>> 0, b >>>= 0; |
|
for (var f = Of(e); ++d < e; ) f[d] = a[d + b]; |
|
return f; |
|
} |
|
function Xb(a, b) { |
|
var c; |
|
return Jg(a, function(a, d, e) { |
|
return c = b(a, d, e), !c; |
|
}), !!c; |
|
} |
|
function Yb(a, b) { |
|
var c = a.length; |
|
for (a.sort(b); c--; ) a[c] = a[c].value; |
|
return a; |
|
} |
|
function Zb(a, b, c) { |
|
var d = Oc(), e = -1; |
|
b = ib(b, function(a) { |
|
return d(a); |
|
}); |
|
var f = Mb(a, function(a) { |
|
var c = ib(b, function(b) { |
|
return b(a); |
|
}); |
|
return { |
|
criteria: c, |
|
index: ++e, |
|
value: a |
|
}; |
|
}); |
|
return Yb(f, function(a, b) { |
|
return l(a, b, c); |
|
}); |
|
} |
|
function $b(a, b) { |
|
var c = 0; |
|
return Jg(a, function(a, d, e) { |
|
c += +b(a, d, e) || 0; |
|
}), c; |
|
} |
|
function _b(a, b) { |
|
var c = -1, d = Qc(), e = a.length, g = d == f, h = g && e >= O, i = h ? oc() : null, j = []; |
|
i ? (d = Za, g = !1) : (h = !1, i = b ? [] : j); |
|
a: for (;++c < e; ) { |
|
var k = a[c], l = b ? b(k, c, a) : k; |
|
if (g && k === k) { |
|
for (var m = i.length; m--; ) if (i[m] === l) continue a; |
|
b && i.push(l), j.push(k); |
|
} else d(i, l, 0) < 0 && ((b || h) && i.push(l), j.push(k)); |
|
} |
|
return j; |
|
} |
|
function ac(a, b) { |
|
for (var c = -1, d = b.length, e = Of(d); ++c < d; ) e[c] = a[b[c]]; |
|
return e; |
|
} |
|
function bc(a, b, c, d) { |
|
for (var e = a.length, f = d ? e : -1; (d ? f-- : ++f < e) && b(a[f], f, a); ) ; |
|
return c ? Wb(a, d ? 0 : f, d ? f + 1 : e) : Wb(a, d ? f + 1 : 0, d ? e : f); |
|
} |
|
function cc(a, b) { |
|
var c = a; |
|
c instanceof Z && (c = c.value()); |
|
for (var d = -1, e = b.length; ++d < e; ) { |
|
var f = b[d]; |
|
c = f.func.apply(f.thisArg, jb([ c ], f.args)); |
|
} |
|
return c; |
|
} |
|
function dc(a, b, c) { |
|
var d = 0, e = a ? a.length : d; |
|
if ("number" == typeof b && b === b && Eg >= e) { |
|
for (;e > d; ) { |
|
var f = d + e >>> 1, g = a[f]; |
|
(c ? b >= g : b > g) && null !== g ? d = f + 1 : e = f; |
|
} |
|
return e; |
|
} |
|
return ec(a, b, Bf, c); |
|
} |
|
function ec(a, b, c, d) { |
|
b = c(b); |
|
for (var e = 0, f = a ? a.length : 0, g = b !== b, h = null === b, i = b === z; f > e; ) { |
|
var j = rg((e + f) / 2), k = c(a[j]), l = k !== z, m = k === k; |
|
if (g) var n = m || d; else n = h ? m && l && (d || null != k) : i ? m && (d || l) : null == k ? !1 : d ? b >= k : b > k; |
|
n ? e = j + 1 : f = j; |
|
} |
|
return wg(f, Dg); |
|
} |
|
function fc(a, b, c) { |
|
if ("function" != typeof a) return Bf; |
|
if (b === z) return a; |
|
switch (c) { |
|
case 1: |
|
return function(c) { |
|
return a.call(b, c); |
|
}; |
|
|
|
case 3: |
|
return function(c, d, e) { |
|
return a.call(b, c, d, e); |
|
}; |
|
|
|
case 4: |
|
return function(c, d, e, f) { |
|
return a.call(b, c, d, e, f); |
|
}; |
|
|
|
case 5: |
|
return function(c, d, e, f, g) { |
|
return a.call(b, c, d, e, f, g); |
|
}; |
|
} |
|
return function() { |
|
return a.apply(b, arguments); |
|
}; |
|
} |
|
function gc(a) { |
|
var b = new fg(a.byteLength), c = new ng(b); |
|
return c.set(new ng(a)), b; |
|
} |
|
function hc(a, b, c) { |
|
for (var d = c.length, e = -1, f = vg(a.length - d, 0), g = -1, h = b.length, i = Of(h + f); ++g < h; ) i[g] = b[g]; |
|
for (;++e < d; ) i[c[e]] = a[e]; |
|
for (;f--; ) i[g++] = a[e++]; |
|
return i; |
|
} |
|
function ic(a, b, c) { |
|
for (var d = -1, e = c.length, f = -1, g = vg(a.length - e, 0), h = -1, i = b.length, j = Of(g + i); ++f < g; ) j[f] = a[f]; |
|
for (var k = f; ++h < i; ) j[k + h] = b[h]; |
|
for (;++d < e; ) j[k + c[d]] = a[f++]; |
|
return j; |
|
} |
|
function jc(a, b) { |
|
return function(c, d, e) { |
|
var f = b ? b() : {}; |
|
if (d = Oc(d, e, 3), Ch(c)) for (var g = -1, h = c.length; ++g < h; ) { |
|
var i = c[g]; |
|
a(f, i, d(i, g, c), c); |
|
} else Jg(c, function(b, c, e) { |
|
a(f, b, d(b, c, e), e); |
|
}); |
|
return f; |
|
}; |
|
} |
|
function kc(a) { |
|
return qe(function(b, c) { |
|
var d = -1, e = null == b ? 0 : c.length, f = e > 2 ? c[e - 2] : z, g = e > 2 ? c[2] : z, h = e > 1 ? c[e - 1] : z; |
|
for ("function" == typeof f ? (f = fc(f, h, 5), e -= 2) : (f = "function" == typeof h ? h : z, |
|
e -= f ? 1 : 0), g && $c(c[0], c[1], g) && (f = 3 > e ? z : f, e = 1); ++d < e; ) { |
|
var i = c[d]; |
|
i && a(b, i, f); |
|
} |
|
return b; |
|
}); |
|
} |
|
function lc(a, b) { |
|
return function(c, d) { |
|
var e = c ? Pg(c) : 0; |
|
if (!bd(e)) return a(c, d); |
|
for (var f = b ? e : -1, g = kd(c); (b ? f-- : ++f < e) && d(g[f], f, g) !== !1; ) ; |
|
return c; |
|
}; |
|
} |
|
function mc(a) { |
|
return function(b, c, d) { |
|
for (var e = kd(b), f = d(b), g = f.length, h = a ? g : -1; a ? h-- : ++h < g; ) { |
|
var i = f[h]; |
|
if (c(e[i], i, e) === !1) break; |
|
} |
|
return b; |
|
}; |
|
} |
|
function nc(a, b) { |
|
function c() { |
|
var e = this && this !== cb && this instanceof c ? d : a; |
|
return e.apply(b, arguments); |
|
} |
|
var d = qc(a); |
|
return c; |
|
} |
|
function oc(a) { |
|
return qg && kg ? new Ya(a) : null; |
|
} |
|
function pc(a) { |
|
return function(b) { |
|
for (var c = -1, d = yf(kf(b)), e = d.length, f = ""; ++c < e; ) f = a(f, d[c], c); |
|
return f; |
|
}; |
|
} |
|
function qc(a) { |
|
return function() { |
|
var b = arguments; |
|
switch (b.length) { |
|
case 0: |
|
return new a(); |
|
|
|
case 1: |
|
return new a(b[0]); |
|
|
|
case 2: |
|
return new a(b[0], b[1]); |
|
|
|
case 3: |
|
return new a(b[0], b[1], b[2]); |
|
|
|
case 4: |
|
return new a(b[0], b[1], b[2], b[3]); |
|
|
|
case 5: |
|
return new a(b[0], b[1], b[2], b[3], b[4]); |
|
|
|
case 6: |
|
return new a(b[0], b[1], b[2], b[3], b[4], b[5]); |
|
|
|
case 7: |
|
return new a(b[0], b[1], b[2], b[3], b[4], b[5], b[6]); |
|
} |
|
var c = Ig(a.prototype), d = a.apply(c, b); |
|
return He(d) ? d : c; |
|
}; |
|
} |
|
function rc(a) { |
|
function b(c, d, e) { |
|
e && $c(c, d, e) && (d = z); |
|
var f = Kc(c, a, z, z, z, z, z, d); |
|
return f.placeholder = b.placeholder, f; |
|
} |
|
return b; |
|
} |
|
function sc(a, b) { |
|
return qe(function(c) { |
|
var d = c[0]; |
|
return null == d ? d : (c.push(b), a.apply(z, c)); |
|
}); |
|
} |
|
function tc(a, b) { |
|
return function(c, d, e) { |
|
if (e && $c(c, d, e) && (d = z), d = Oc(d, e, 3), 1 == d.length) { |
|
c = Ch(c) ? c : jd(c); |
|
var f = gb(c, d, a, b); |
|
if (!c.length || f !== b) return f; |
|
} |
|
return zb(c, d, a, b); |
|
}; |
|
} |
|
function uc(a, b) { |
|
return function(c, d, f) { |
|
if (d = Oc(d, f, 3), Ch(c)) { |
|
var g = e(c, d, b); |
|
return g > -1 ? c[g] : z; |
|
} |
|
return Cb(c, d, a); |
|
}; |
|
} |
|
function vc(a) { |
|
return function(b, c, d) { |
|
return b && b.length ? (c = Oc(c, d, 3), e(b, c, a)) : -1; |
|
}; |
|
} |
|
function wc(a) { |
|
return function(b, c, d) { |
|
return c = Oc(c, d, 3), Cb(b, c, a, !0); |
|
}; |
|
} |
|
function xc(a) { |
|
return function() { |
|
for (var b, c = arguments.length, d = a ? c : -1, e = 0, f = Of(c); a ? d-- : ++d < c; ) { |
|
var g = f[e++] = arguments[d]; |
|
if ("function" != typeof g) throw new Xf(R); |
|
!b && s.prototype.thru && "wrapper" == Pc(g) && (b = new s([], !0)); |
|
} |
|
for (d = b ? -1 : c; ++d < c; ) { |
|
g = f[d]; |
|
var h = Pc(g), i = "wrapper" == h ? Og(g) : z; |
|
b = i && ad(i[0]) && i[1] == (I | E | G | J) && !i[4].length && 1 == i[9] ? b[Pc(i[0])].apply(b, i[3]) : 1 == g.length && ad(g) ? b[h]() : b.thru(g); |
|
} |
|
return function() { |
|
var a = arguments, d = a[0]; |
|
if (b && 1 == a.length && Ch(d) && d.length >= O) return b.plant(d).value(); |
|
for (var e = 0, g = c ? f[e].apply(this, a) : d; ++e < c; ) g = f[e].call(this, g); |
|
return g; |
|
}; |
|
}; |
|
} |
|
function yc(a, b) { |
|
return function(c, d, e) { |
|
return "function" == typeof d && e === z && Ch(c) ? a(c, d) : b(c, fc(d, e, 3)); |
|
}; |
|
} |
|
function zc(a) { |
|
return function(b, c, d) { |
|
return ("function" != typeof c || d !== z) && (c = fc(c, d, 3)), a(b, c, _e); |
|
}; |
|
} |
|
function Ac(a) { |
|
return function(b, c, d) { |
|
return ("function" != typeof c || d !== z) && (c = fc(c, d, 3)), a(b, c); |
|
}; |
|
} |
|
function Bc(a) { |
|
return function(b, c, d) { |
|
var e = {}; |
|
return c = Oc(c, d, 3), Fb(b, function(b, d, f) { |
|
var g = c(b, d, f); |
|
d = a ? g : d, b = a ? b : g, e[d] = b; |
|
}), e; |
|
}; |
|
} |
|
function Cc(a) { |
|
return function(b, c, d) { |
|
return b = h(b), (a ? b : "") + Gc(b, c, d) + (a ? "" : b); |
|
}; |
|
} |
|
function Dc(a) { |
|
var b = qe(function(c, d) { |
|
var e = t(d, b.placeholder); |
|
return Kc(c, a, z, d, e); |
|
}); |
|
return b; |
|
} |
|
function Ec(a, b) { |
|
return function(c, d, e, f) { |
|
var g = arguments.length < 3; |
|
return "function" == typeof d && f === z && Ch(c) ? a(c, d, e, g) : Vb(c, Oc(d, f, 4), e, g, b); |
|
}; |
|
} |
|
function Fc(a, b, c, d, e, f, g, h, i, j) { |
|
function k() { |
|
for (var s = arguments.length, u = s, v = Of(s); u--; ) v[u] = arguments[u]; |
|
if (d && (v = hc(v, d, e)), f && (v = ic(v, f, g)), o || q) { |
|
var w = k.placeholder, x = t(v, w); |
|
if (s -= x.length, j > s) { |
|
var y = h ? ab(h) : z, A = vg(j - s, 0), D = o ? x : z, E = o ? z : x, F = o ? v : z, I = o ? z : v; |
|
b |= o ? G : H, b &= ~(o ? H : G), p || (b &= ~(B | C)); |
|
var J = [ a, b, c, F, D, I, E, y, i, A ], K = Fc.apply(z, J); |
|
return ad(a) && Qg(K, J), K.placeholder = w, K; |
|
} |
|
} |
|
var L = m ? c : this, M = n ? L[a] : a; |
|
return h && (v = hd(v, h)), l && i < v.length && (v.length = i), this && this !== cb && this instanceof k && (M = r || qc(a)), |
|
M.apply(L, v); |
|
} |
|
var l = b & I, m = b & B, n = b & C, o = b & E, p = b & D, q = b & F, r = n ? z : qc(a); |
|
return k; |
|
} |
|
function Gc(a, b, c) { |
|
var d = a.length; |
|
if (b = +b, d >= b || !tg(b)) return ""; |
|
var e = b - d; |
|
return c = null == c ? " " : c + "", qf(c, pg(e / c.length)).slice(0, e); |
|
} |
|
function Hc(a, b, c, d) { |
|
function e() { |
|
for (var b = -1, h = arguments.length, i = -1, j = d.length, k = Of(j + h); ++i < j; ) k[i] = d[i]; |
|
for (;h--; ) k[i++] = arguments[++b]; |
|
var l = this && this !== cb && this instanceof e ? g : a; |
|
return l.apply(f ? c : this, k); |
|
} |
|
var f = b & B, g = qc(a); |
|
return e; |
|
} |
|
function Ic(a) { |
|
var b = Sf[a]; |
|
return function(a, c) { |
|
return c = c === z ? 0 : +c || 0, c ? (c = ig(10, c), b(a * c) / c) : b(a); |
|
}; |
|
} |
|
function Jc(a) { |
|
return function(b, c, d, e) { |
|
var f = Oc(d); |
|
return null == d && f === ub ? dc(b, c, a) : ec(b, c, f(d, e, 1), a); |
|
}; |
|
} |
|
function Kc(a, b, c, d, e, f, g, h) { |
|
var i = b & C; |
|
if (!i && "function" != typeof a) throw new Xf(R); |
|
var j = d ? d.length : 0; |
|
if (j || (b &= ~(G | H), d = e = z), j -= e ? e.length : 0, b & H) { |
|
var k = d, l = e; |
|
d = e = z; |
|
} |
|
var m = i ? z : Og(a), n = [ a, b, c, d, e, k, l, f, g, h ]; |
|
if (m && (dd(n, m), b = n[1], h = n[9]), n[9] = null == h ? i ? 0 : a.length : vg(h - j, 0) || 0, |
|
b == B) var o = nc(n[0], n[2]); else o = b != G && b != (B | G) || n[4].length ? Fc.apply(z, n) : Hc.apply(z, n); |
|
var p = m ? Ng : Qg; |
|
return p(o, n); |
|
} |
|
function Lc(a, b, c, d, e, f, g) { |
|
var h = -1, i = a.length, j = b.length; |
|
if (i != j && !(e && j > i)) return !1; |
|
for (;++h < i; ) { |
|
var k = a[h], l = b[h], m = d ? d(e ? l : k, e ? k : l, h) : z; |
|
if (m !== z) { |
|
if (m) continue; |
|
return !1; |
|
} |
|
if (e) { |
|
if (!mb(b, function(a) { |
|
return k === a || c(k, a, d, e, f, g); |
|
})) return !1; |
|
} else if (k !== l && !c(k, l, d, e, f, g)) return !1; |
|
} |
|
return !0; |
|
} |
|
function Mc(a, b, c) { |
|
switch (c) { |
|
case V: |
|
case W: |
|
return +a == +b; |
|
|
|
case X: |
|
return a.name == b.name && a.message == b.message; |
|
|
|
case $: |
|
return a != +a ? b != +b : a == +b; |
|
|
|
case aa: |
|
case ca: |
|
return a == b + ""; |
|
} |
|
return !1; |
|
} |
|
function Nc(a, b, c, d, e, f, g) { |
|
var h = Nh(a), i = h.length, j = Nh(b), k = j.length; |
|
if (i != k && !e) return !1; |
|
for (var l = i; l--; ) { |
|
var m = h[l]; |
|
if (!(e ? m in b : ag.call(b, m))) return !1; |
|
} |
|
for (var n = e; ++l < i; ) { |
|
m = h[l]; |
|
var o = a[m], p = b[m], q = d ? d(e ? p : o, e ? o : p, m) : z; |
|
if (!(q === z ? c(o, p, d, e, f, g) : q)) return !1; |
|
n || (n = "constructor" == m); |
|
} |
|
if (!n) { |
|
var r = a.constructor, s = b.constructor; |
|
if (r != s && "constructor" in a && "constructor" in b && !("function" == typeof r && r instanceof r && "function" == typeof s && s instanceof s)) return !1; |
|
} |
|
return !0; |
|
} |
|
function Oc(a, c, d) { |
|
var e = b.callback || zf; |
|
return e = e === zf ? ub : e, d ? e(a, c, d) : e; |
|
} |
|
function Pc(a) { |
|
for (var b = a.name, c = Hg[b], d = c ? c.length : 0; d--; ) { |
|
var e = c[d], f = e.func; |
|
if (null == f || f == a) return e.name; |
|
} |
|
return b; |
|
} |
|
function Qc(a, c, d) { |
|
var e = b.indexOf || xd; |
|
return e = e === xd ? f : e, a ? e(a, c, d) : e; |
|
} |
|
function Rc(a) { |
|
for (var b = af(a), c = b.length; c--; ) b[c][2] = cd(b[c][1]); |
|
return b; |
|
} |
|
function Sc(a, b) { |
|
var c = null == a ? z : a[b]; |
|
return Ke(c) ? c : z; |
|
} |
|
function Tc(a, b, c) { |
|
for (var d = -1, e = c.length; ++d < e; ) { |
|
var f = c[d], g = f.size; |
|
switch (f.type) { |
|
case "drop": |
|
a += g; |
|
break; |
|
|
|
case "dropRight": |
|
b -= g; |
|
break; |
|
|
|
case "take": |
|
b = wg(b, a + g); |
|
break; |
|
|
|
case "takeRight": |
|
a = vg(a, b - g); |
|
} |
|
} |
|
return { |
|
start: a, |
|
end: b |
|
}; |
|
} |
|
function Uc(a) { |
|
var b = a.length, c = new a.constructor(b); |
|
return b && "string" == typeof a[0] && ag.call(a, "index") && (c.index = a.index, |
|
c.input = a.input), c; |
|
} |
|
function Vc(a) { |
|
var b = a.constructor; |
|
return "function" == typeof b && b instanceof b || (b = Uf), new b(); |
|
} |
|
function Wc(a, b, c) { |
|
var d = a.constructor; |
|
switch (b) { |
|
case ea: |
|
return gc(a); |
|
|
|
case V: |
|
case W: |
|
return new d(+a); |
|
|
|
case fa: |
|
case ga: |
|
case ha: |
|
case ia: |
|
case ja: |
|
case ka: |
|
case la: |
|
case ma: |
|
case na: |
|
var e = a.buffer; |
|
return new d(c ? gc(e) : e, a.byteOffset, a.length); |
|
|
|
case $: |
|
case ca: |
|
return new d(a); |
|
|
|
case aa: |
|
var f = new d(a.source, Ga.exec(a)); |
|
f.lastIndex = a.lastIndex; |
|
} |
|
return f; |
|
} |
|
function Xc(a, b, c) { |
|
null == a || _c(b, a) || (b = ld(b), a = 1 == b.length ? a : Ib(a, Wb(b, 0, -1)), |
|
b = zd(b)); |
|
var d = null == a ? a : a[b]; |
|
return null == d ? z : d.apply(a, c); |
|
} |
|
function Yc(a) { |
|
return null != a && bd(Pg(a)); |
|
} |
|
function Zc(a, b) { |
|
return a = "number" == typeof a || Ja.test(a) ? +a : -1, b = null == b ? Fg : b, |
|
a > -1 && a % 1 == 0 && b > a; |
|
} |
|
function $c(a, b, c) { |
|
if (!He(c)) return !1; |
|
var d = typeof b; |
|
if ("number" == d ? Yc(c) && Zc(b, c.length) : "string" == d && b in c) { |
|
var e = c[b]; |
|
return a === a ? a === e : e !== e; |
|
} |
|
return !1; |
|
} |
|
function _c(a, b) { |
|
var c = typeof a; |
|
if ("string" == c && za.test(a) || "number" == c) return !0; |
|
if (Ch(a)) return !1; |
|
var d = !ya.test(a); |
|
return d || null != b && a in kd(b); |
|
} |
|
function ad(a) { |
|
var c = Pc(a); |
|
if (!(c in Z.prototype)) return !1; |
|
var d = b[c]; |
|
if (a === d) return !0; |
|
var e = Og(d); |
|
return !!e && a === e[0]; |
|
} |
|
function bd(a) { |
|
return "number" == typeof a && a > -1 && a % 1 == 0 && Fg >= a; |
|
} |
|
function cd(a) { |
|
return a === a && !He(a); |
|
} |
|
function dd(a, b) { |
|
var c = a[1], d = b[1], e = c | d, f = I > e, g = d == I && c == E || d == I && c == J && a[7].length <= b[8] || d == (I | J) && c == E; |
|
if (!f && !g) return a; |
|
d & B && (a[2] = b[2], e |= c & B ? 0 : D); |
|
var h = b[3]; |
|
if (h) { |
|
var i = a[3]; |
|
a[3] = i ? hc(i, h, b[4]) : ab(h), a[4] = i ? t(a[3], S) : ab(b[4]); |
|
} |
|
return h = b[5], h && (i = a[5], a[5] = i ? ic(i, h, b[6]) : ab(h), a[6] = i ? t(a[5], S) : ab(b[6])), |
|
h = b[7], h && (a[7] = ab(h)), d & I && (a[8] = null == a[8] ? b[8] : wg(a[8], b[8])), |
|
null == a[9] && (a[9] = b[9]), a[0] = b[0], a[1] = e, a; |
|
} |
|
function ed(a, b) { |
|
return a === z ? b : Dh(a, b, ed); |
|
} |
|
function fd(a, b) { |
|
a = kd(a); |
|
for (var c = -1, d = b.length, e = {}; ++c < d; ) { |
|
var f = b[c]; |
|
f in a && (e[f] = a[f]); |
|
} |
|
return e; |
|
} |
|
function gd(a, b) { |
|
var c = {}; |
|
return Eb(a, function(a, d, e) { |
|
b(a, d, e) && (c[d] = a); |
|
}), c; |
|
} |
|
function hd(a, b) { |
|
for (var c = a.length, d = wg(b.length, c), e = ab(a); d--; ) { |
|
var f = b[d]; |
|
a[d] = Zc(f, c) ? e[f] : z; |
|
} |
|
return a; |
|
} |
|
function id(a) { |
|
for (var b = _e(a), c = b.length, d = c && a.length, e = !!d && bd(d) && (Ch(a) || ye(a)), f = -1, g = []; ++f < c; ) { |
|
var h = b[f]; |
|
(e && Zc(h, d) || ag.call(a, h)) && g.push(h); |
|
} |
|
return g; |
|
} |
|
function jd(a) { |
|
return null == a ? [] : Yc(a) ? He(a) ? a : Uf(a) : ef(a); |
|
} |
|
function kd(a) { |
|
return He(a) ? a : Uf(a); |
|
} |
|
function ld(a) { |
|
if (Ch(a)) return a; |
|
var b = []; |
|
return h(a).replace(Aa, function(a, c, d, e) { |
|
b.push(d ? e.replace(Ea, "$1") : c || a); |
|
}), b; |
|
} |
|
function md(a) { |
|
return a instanceof Z ? a.clone() : new s(a.__wrapped__, a.__chain__, ab(a.__actions__)); |
|
} |
|
function nd(a, b, c) { |
|
b = (c ? $c(a, b, c) : null == b) ? 1 : vg(rg(b) || 1, 1); |
|
for (var d = 0, e = a ? a.length : 0, f = -1, g = Of(pg(e / b)); e > d; ) g[++f] = Wb(a, d, d += b); |
|
return g; |
|
} |
|
function od(a) { |
|
for (var b = -1, c = a ? a.length : 0, d = -1, e = []; ++b < c; ) { |
|
var f = a[b]; |
|
f && (e[++d] = f); |
|
} |
|
return e; |
|
} |
|
function pd(a, b, c) { |
|
var d = a ? a.length : 0; |
|
return d ? ((c ? $c(a, b, c) : null == b) && (b = 1), Wb(a, 0 > b ? 0 : b)) : []; |
|
} |
|
function qd(a, b, c) { |
|
var d = a ? a.length : 0; |
|
return d ? ((c ? $c(a, b, c) : null == b) && (b = 1), b = d - (+b || 0), Wb(a, 0, 0 > b ? 0 : b)) : []; |
|
} |
|
function rd(a, b, c) { |
|
return a && a.length ? bc(a, Oc(b, c, 3), !0, !0) : []; |
|
} |
|
function sd(a, b, c) { |
|
return a && a.length ? bc(a, Oc(b, c, 3), !0) : []; |
|
} |
|
function td(a, b, c, d) { |
|
var e = a ? a.length : 0; |
|
return e ? (c && "number" != typeof c && $c(a, b, c) && (c = 0, d = e), Ab(a, b, c, d)) : []; |
|
} |
|
function ud(a) { |
|
return a ? a[0] : z; |
|
} |
|
function vd(a, b, c) { |
|
var d = a ? a.length : 0; |
|
return c && $c(a, b, c) && (b = !1), d ? Db(a, b) : []; |
|
} |
|
function wd(a) { |
|
var b = a ? a.length : 0; |
|
return b ? Db(a, !0) : []; |
|
} |
|
function xd(a, b, c) { |
|
var d = a ? a.length : 0; |
|
if (!d) return -1; |
|
if ("number" == typeof c) c = 0 > c ? vg(d + c, 0) : c; else if (c) { |
|
var e = dc(a, b); |
|
return d > e && (b === b ? b === a[e] : a[e] !== a[e]) ? e : -1; |
|
} |
|
return f(a, b, c || 0); |
|
} |
|
function yd(a) { |
|
return qd(a, 1); |
|
} |
|
function zd(a) { |
|
var b = a ? a.length : 0; |
|
return b ? a[b - 1] : z; |
|
} |
|
function Ad(a, b, c) { |
|
var d = a ? a.length : 0; |
|
if (!d) return -1; |
|
var e = d; |
|
if ("number" == typeof c) e = (0 > c ? vg(d + c, 0) : wg(c || 0, d - 1)) + 1; else if (c) { |
|
e = dc(a, b, !0) - 1; |
|
var f = a[e]; |
|
return (b === b ? b === f : f !== f) ? e : -1; |
|
} |
|
if (b !== b) return q(a, e, !0); |
|
for (;e--; ) if (a[e] === b) return e; |
|
return -1; |
|
} |
|
function Bd() { |
|
var a = arguments, b = a[0]; |
|
if (!b || !b.length) return b; |
|
for (var c = 0, d = Qc(), e = a.length; ++c < e; ) for (var f = 0, g = a[c]; (f = d(b, g, f)) > -1; ) mg.call(b, f, 1); |
|
return b; |
|
} |
|
function Cd(a, b, c) { |
|
var d = []; |
|
if (!a || !a.length) return d; |
|
var e = -1, f = [], g = a.length; |
|
for (b = Oc(b, c, 3); ++e < g; ) { |
|
var h = a[e]; |
|
b(h, e, a) && (d.push(h), f.push(e)); |
|
} |
|
return Tb(a, f), d; |
|
} |
|
function Dd(a) { |
|
return pd(a, 1); |
|
} |
|
function Ed(a, b, c) { |
|
var d = a ? a.length : 0; |
|
return d ? (c && "number" != typeof c && $c(a, b, c) && (b = 0, c = d), Wb(a, b, c)) : []; |
|
} |
|
function Fd(a, b, c) { |
|
var d = a ? a.length : 0; |
|
return d ? ((c ? $c(a, b, c) : null == b) && (b = 1), Wb(a, 0, 0 > b ? 0 : b)) : []; |
|
} |
|
function Gd(a, b, c) { |
|
var d = a ? a.length : 0; |
|
return d ? ((c ? $c(a, b, c) : null == b) && (b = 1), b = d - (+b || 0), Wb(a, 0 > b ? 0 : b)) : []; |
|
} |
|
function Hd(a, b, c) { |
|
return a && a.length ? bc(a, Oc(b, c, 3), !1, !0) : []; |
|
} |
|
function Id(a, b, c) { |
|
return a && a.length ? bc(a, Oc(b, c, 3)) : []; |
|
} |
|
function Jd(a, b, c, d) { |
|
var e = a ? a.length : 0; |
|
if (!e) return []; |
|
null != b && "boolean" != typeof b && (d = c, c = $c(a, b, d) ? z : b, b = !1); |
|
var g = Oc(); |
|
return (null != c || g !== ub) && (c = g(c, d, 3)), b && Qc() == f ? u(a, c) : _b(a, c); |
|
} |
|
function Kd(a) { |
|
if (!a || !a.length) return []; |
|
var b = -1, c = 0; |
|
a = hb(a, function(a) { |
|
return Yc(a) ? (c = vg(a.length, c), !0) : void 0; |
|
}); |
|
for (var d = Of(c); ++b < c; ) d[b] = ib(a, Rb(b)); |
|
return d; |
|
} |
|
function Ld(a, b, c) { |
|
var d = a ? a.length : 0; |
|
if (!d) return []; |
|
var e = Kd(a); |
|
return null == b ? e : (b = fc(b, c, 4), ib(e, function(a) { |
|
return kb(a, b, z, !0); |
|
})); |
|
} |
|
function Md() { |
|
for (var a = -1, b = arguments.length; ++a < b; ) { |
|
var c = arguments[a]; |
|
if (Yc(c)) var d = d ? jb(xb(d, c), xb(c, d)) : c; |
|
} |
|
return d ? _b(d) : []; |
|
} |
|
function Nd(a, b) { |
|
var c = -1, d = a ? a.length : 0, e = {}; |
|
for (!d || b || Ch(a[0]) || (b = []); ++c < d; ) { |
|
var f = a[c]; |
|
b ? e[f] = b[c] : f && (e[f[0]] = f[1]); |
|
} |
|
return e; |
|
} |
|
function Od(a) { |
|
var c = b(a); |
|
return c.__chain__ = !0, c; |
|
} |
|
function Pd(a, b, c) { |
|
return b.call(c, a), a; |
|
} |
|
function Qd(a, b, c) { |
|
return b.call(c, a); |
|
} |
|
function Rd() { |
|
return Od(this); |
|
} |
|
function Sd() { |
|
return new s(this.value(), this.__chain__); |
|
} |
|
function Td(a) { |
|
for (var b, d = this; d instanceof c; ) { |
|
var e = md(d); |
|
b ? f.__wrapped__ = e : b = e; |
|
var f = e; |
|
d = d.__wrapped__; |
|
} |
|
return f.__wrapped__ = a, b; |
|
} |
|
function Ud() { |
|
var a = this.__wrapped__, b = function(a) { |
|
return c && c.__dir__ < 0 ? a : a.reverse(); |
|
}; |
|
if (a instanceof Z) { |
|
var c = a; |
|
return this.__actions__.length && (c = new Z(this)), c = c.reverse(), c.__actions__.push({ |
|
func: Qd, |
|
args: [ b ], |
|
thisArg: z |
|
}), new s(c, this.__chain__); |
|
} |
|
return this.thru(b); |
|
} |
|
function Vd() { |
|
return this.value() + ""; |
|
} |
|
function Wd() { |
|
return cc(this.__wrapped__, this.__actions__); |
|
} |
|
function Xd(a, b, c) { |
|
var d = Ch(a) ? fb : yb; |
|
return c && $c(a, b, c) && (b = z), ("function" != typeof b || c !== z) && (b = Oc(b, c, 3)), |
|
d(a, b); |
|
} |
|
function Yd(a, b, c) { |
|
var d = Ch(a) ? hb : Bb; |
|
return b = Oc(b, c, 3), d(a, b); |
|
} |
|
function Zd(a, b) { |
|
return dh(a, Nb(b)); |
|
} |
|
function $d(a, b, c, d) { |
|
var e = a ? Pg(a) : 0; |
|
return bd(e) || (a = ef(a), e = a.length), c = "number" != typeof c || d && $c(b, c, d) ? 0 : 0 > c ? vg(e + c, 0) : c || 0, |
|
"string" == typeof a || !Ch(a) && Pe(a) ? e >= c && a.indexOf(b, c) > -1 : !!e && Qc(a, b, c) > -1; |
|
} |
|
function _d(a, b, c) { |
|
var d = Ch(a) ? ib : Mb; |
|
return b = Oc(b, c, 3), d(a, b); |
|
} |
|
function ae(a, b) { |
|
return _d(a, Hf(b)); |
|
} |
|
function be(a, b, c) { |
|
var d = Ch(a) ? hb : Bb; |
|
return b = Oc(b, c, 3), d(a, function(a, c, d) { |
|
return !b(a, c, d); |
|
}); |
|
} |
|
function ce(a, b, c) { |
|
if (c ? $c(a, b, c) : null == b) { |
|
a = jd(a); |
|
var d = a.length; |
|
return d > 0 ? a[Ub(0, d - 1)] : z; |
|
} |
|
var e = -1, f = Ue(a), d = f.length, g = d - 1; |
|
for (b = wg(0 > b ? 0 : +b || 0, d); ++e < b; ) { |
|
var h = Ub(e, g), i = f[h]; |
|
f[h] = f[e], f[e] = i; |
|
} |
|
return f.length = b, f; |
|
} |
|
function de(a) { |
|
return ce(a, Bg); |
|
} |
|
function ee(a) { |
|
var b = a ? Pg(a) : 0; |
|
return bd(b) ? b : Nh(a).length; |
|
} |
|
function fe(a, b, c) { |
|
var d = Ch(a) ? mb : Xb; |
|
return c && $c(a, b, c) && (b = z), ("function" != typeof b || c !== z) && (b = Oc(b, c, 3)), |
|
d(a, b); |
|
} |
|
function ge(a, b, c) { |
|
if (null == a) return []; |
|
c && $c(a, b, c) && (b = z); |
|
var d = -1; |
|
b = Oc(b, c, 3); |
|
var e = Mb(a, function(a, c, e) { |
|
return { |
|
criteria: b(a, c, e), |
|
index: ++d, |
|
value: a |
|
}; |
|
}); |
|
return Yb(e, k); |
|
} |
|
function he(a, b, c, d) { |
|
return null == a ? [] : (d && $c(b, c, d) && (c = z), Ch(b) || (b = null == b ? [] : [ b ]), |
|
Ch(c) || (c = null == c ? [] : [ c ]), Zb(a, b, c)); |
|
} |
|
function ie(a, b) { |
|
return Yd(a, Nb(b)); |
|
} |
|
function je(a, b) { |
|
if ("function" != typeof b) { |
|
if ("function" != typeof a) throw new Xf(R); |
|
var c = a; |
|
a = b, b = c; |
|
} |
|
return a = tg(a = +a) ? a : 0, function() { |
|
return --a < 1 ? b.apply(this, arguments) : void 0; |
|
}; |
|
} |
|
function ke(a, b, c) { |
|
return c && $c(a, b, c) && (b = z), b = a && null == b ? a.length : vg(+b || 0, 0), |
|
Kc(a, I, z, z, z, z, b); |
|
} |
|
function le(a, b) { |
|
var c; |
|
if ("function" != typeof b) { |
|
if ("function" != typeof a) throw new Xf(R); |
|
var d = a; |
|
a = b, b = d; |
|
} |
|
return function() { |
|
return --a > 0 && (c = b.apply(this, arguments)), 1 >= a && (b = z), c; |
|
}; |
|
} |
|
function me(a, b, c) { |
|
function d() { |
|
n && gg(n), j && gg(j), p = 0, j = n = o = z; |
|
} |
|
function e(b, c) { |
|
c && gg(c), j = n = o = z, b && (p = oh(), k = a.apply(m, i), n || j || (i = m = z)); |
|
} |
|
function f() { |
|
var a = b - (oh() - l); |
|
0 >= a || a > b ? e(o, j) : n = lg(f, a); |
|
} |
|
function g() { |
|
e(r, n); |
|
} |
|
function h() { |
|
if (i = arguments, l = oh(), m = this, o = r && (n || !s), q === !1) var c = s && !n; else { |
|
j || s || (p = l); |
|
var d = q - (l - p), e = 0 >= d || d > q; |
|
e ? (j && (j = gg(j)), p = l, k = a.apply(m, i)) : j || (j = lg(g, d)); |
|
} |
|
return e && n ? n = gg(n) : n || b === q || (n = lg(f, b)), c && (e = !0, k = a.apply(m, i)), |
|
!e || n || j || (i = m = z), k; |
|
} |
|
var i, j, k, l, m, n, o, p = 0, q = !1, r = !0; |
|
if ("function" != typeof a) throw new Xf(R); |
|
if (b = 0 > b ? 0 : +b || 0, c === !0) { |
|
var s = !0; |
|
r = !1; |
|
} else He(c) && (s = !!c.leading, q = "maxWait" in c && vg(+c.maxWait || 0, b), |
|
r = "trailing" in c ? !!c.trailing : r); |
|
return h.cancel = d, h; |
|
} |
|
function ne(a, b) { |
|
if ("function" != typeof a || b && "function" != typeof b) throw new Xf(R); |
|
var c = function() { |
|
var d = arguments, e = b ? b.apply(this, d) : d[0], f = c.cache; |
|
if (f.has(e)) return f.get(e); |
|
var g = a.apply(this, d); |
|
return c.cache = f.set(e, g), g; |
|
}; |
|
return c.cache = new ne.Cache(), c; |
|
} |
|
function oe(a) { |
|
if ("function" != typeof a) throw new Xf(R); |
|
return function() { |
|
return !a.apply(this, arguments); |
|
}; |
|
} |
|
function pe(a) { |
|
return le(2, a); |
|
} |
|
function qe(a, b) { |
|
if ("function" != typeof a) throw new Xf(R); |
|
return b = vg(b === z ? a.length - 1 : +b || 0, 0), function() { |
|
for (var c = arguments, d = -1, e = vg(c.length - b, 0), f = Of(e); ++d < e; ) f[d] = c[b + d]; |
|
switch (b) { |
|
case 0: |
|
return a.call(this, f); |
|
|
|
case 1: |
|
return a.call(this, c[0], f); |
|
|
|
case 2: |
|
return a.call(this, c[0], c[1], f); |
|
} |
|
var g = Of(b + 1); |
|
for (d = -1; ++d < b; ) g[d] = c[d]; |
|
return g[b] = f, a.apply(this, g); |
|
}; |
|
} |
|
function re(a) { |
|
if ("function" != typeof a) throw new Xf(R); |
|
return function(b) { |
|
return a.apply(this, b); |
|
}; |
|
} |
|
function se(a, b, c) { |
|
var d = !0, e = !0; |
|
if ("function" != typeof a) throw new Xf(R); |
|
return c === !1 ? d = !1 : He(c) && (d = "leading" in c ? !!c.leading : d, e = "trailing" in c ? !!c.trailing : e), |
|
me(a, b, { |
|
leading: d, |
|
maxWait: +b, |
|
trailing: e |
|
}); |
|
} |
|
function te(a, b) { |
|
return b = null == b ? Bf : b, Kc(b, G, z, [ a ], []); |
|
} |
|
function ue(a, b, c, d) { |
|
return b && "boolean" != typeof b && $c(a, b, c) ? b = !1 : "function" == typeof b && (d = c, |
|
c = b, b = !1), "function" == typeof c ? vb(a, b, fc(c, d, 1)) : vb(a, b); |
|
} |
|
function ve(a, b, c) { |
|
return "function" == typeof b ? vb(a, !0, fc(b, c, 1)) : vb(a, !0); |
|
} |
|
function we(a, b) { |
|
return a > b; |
|
} |
|
function xe(a, b) { |
|
return a >= b; |
|
} |
|
function ye(a) { |
|
return r(a) && Yc(a) && ag.call(a, "callee") && !jg.call(a, "callee"); |
|
} |
|
function ze(a) { |
|
return a === !0 || a === !1 || r(a) && cg.call(a) == V; |
|
} |
|
function Ae(a) { |
|
return r(a) && cg.call(a) == W; |
|
} |
|
function Be(a) { |
|
return !!a && 1 === a.nodeType && r(a) && !Ne(a); |
|
} |
|
function Ce(a) { |
|
return null == a ? !0 : Yc(a) && (Ch(a) || Pe(a) || ye(a) || r(a) && Ge(a.splice)) ? !a.length : !Nh(a).length; |
|
} |
|
function De(a, b, c, d) { |
|
c = "function" == typeof c ? fc(c, d, 3) : z; |
|
var e = c ? c(a, b) : z; |
|
return e === z ? Jb(a, b, c) : !!e; |
|
} |
|
function Ee(a) { |
|
return r(a) && "string" == typeof a.message && cg.call(a) == X; |
|
} |
|
function Fe(a) { |
|
return "number" == typeof a && tg(a); |
|
} |
|
function Ge(a) { |
|
return He(a) && cg.call(a) == Y; |
|
} |
|
function He(a) { |
|
var b = typeof a; |
|
return !!a && ("object" == b || "function" == b); |
|
} |
|
function Ie(a, b, c, d) { |
|
return c = "function" == typeof c ? fc(c, d, 3) : z, Lb(a, Rc(b), c); |
|
} |
|
function Je(a) { |
|
return Me(a) && a != +a; |
|
} |
|
function Ke(a) { |
|
return null == a ? !1 : Ge(a) ? eg.test(_f.call(a)) : r(a) && Ia.test(a); |
|
} |
|
function Le(a) { |
|
return null === a; |
|
} |
|
function Me(a) { |
|
return "number" == typeof a || r(a) && cg.call(a) == $; |
|
} |
|
function Ne(a) { |
|
var b; |
|
if (!r(a) || cg.call(a) != _ || ye(a) || !ag.call(a, "constructor") && (b = a.constructor, |
|
"function" == typeof b && !(b instanceof b))) return !1; |
|
var c; |
|
return Eb(a, function(a, b) { |
|
c = b; |
|
}), c === z || ag.call(a, c); |
|
} |
|
function Oe(a) { |
|
return He(a) && cg.call(a) == aa; |
|
} |
|
function Pe(a) { |
|
return "string" == typeof a || r(a) && cg.call(a) == ca; |
|
} |
|
function Qe(a) { |
|
return r(a) && bd(a.length) && !!Qa[cg.call(a)]; |
|
} |
|
function Re(a) { |
|
return a === z; |
|
} |
|
function Se(a, b) { |
|
return b > a; |
|
} |
|
function Te(a, b) { |
|
return b >= a; |
|
} |
|
function Ue(a) { |
|
var b = a ? Pg(a) : 0; |
|
return bd(b) ? b ? ab(a) : [] : ef(a); |
|
} |
|
function Ve(a) { |
|
return tb(a, _e(a)); |
|
} |
|
function We(a, b, c) { |
|
var d = Ig(a); |
|
return c && $c(a, b, c) && (b = z), b ? rb(d, b) : d; |
|
} |
|
function Xe(a) { |
|
return Hb(a, _e(a)); |
|
} |
|
function Ye(a, b, c) { |
|
var d = null == a ? z : Ib(a, ld(b), b + ""); |
|
return d === z ? c : d; |
|
} |
|
function Ze(a, b) { |
|
if (null == a) return !1; |
|
var c = ag.call(a, b); |
|
if (!c && !_c(b)) { |
|
if (b = ld(b), a = 1 == b.length ? a : Ib(a, Wb(b, 0, -1)), null == a) return !1; |
|
b = zd(b), c = ag.call(a, b); |
|
} |
|
return c || bd(a.length) && Zc(b, a.length) && (Ch(a) || ye(a)); |
|
} |
|
function $e(a, b, c) { |
|
c && $c(a, b, c) && (b = z); |
|
for (var d = -1, e = Nh(a), f = e.length, g = {}; ++d < f; ) { |
|
var h = e[d], i = a[h]; |
|
b ? ag.call(g, i) ? g[i].push(h) : g[i] = [ h ] : g[i] = h; |
|
} |
|
return g; |
|
} |
|
function _e(a) { |
|
if (null == a) return []; |
|
He(a) || (a = Uf(a)); |
|
var b = a.length; |
|
b = b && bd(b) && (Ch(a) || ye(a)) && b || 0; |
|
for (var c = a.constructor, d = -1, e = "function" == typeof c && c.prototype === a, f = Of(b), g = b > 0; ++d < b; ) f[d] = d + ""; |
|
for (var h in a) g && Zc(h, b) || "constructor" == h && (e || !ag.call(a, h)) || f.push(h); |
|
return f; |
|
} |
|
function af(a) { |
|
a = kd(a); |
|
for (var b = -1, c = Nh(a), d = c.length, e = Of(d); ++b < d; ) { |
|
var f = c[b]; |
|
e[b] = [ f, a[f] ]; |
|
} |
|
return e; |
|
} |
|
function bf(a, b, c) { |
|
var d = null == a ? z : a[b]; |
|
return d === z && (null == a || _c(b, a) || (b = ld(b), a = 1 == b.length ? a : Ib(a, Wb(b, 0, -1)), |
|
d = null == a ? z : a[zd(b)]), d = d === z ? c : d), Ge(d) ? d.call(a) : d; |
|
} |
|
function cf(a, b, c) { |
|
if (null == a) return a; |
|
var d = b + ""; |
|
b = null != a[d] || _c(b, a) ? [ d ] : ld(b); |
|
for (var e = -1, f = b.length, g = f - 1, h = a; null != h && ++e < f; ) { |
|
var i = b[e]; |
|
He(h) && (e == g ? h[i] = c : null == h[i] && (h[i] = Zc(b[e + 1]) ? [] : {})), |
|
h = h[i]; |
|
} |
|
return a; |
|
} |
|
function df(a, b, c, d) { |
|
var e = Ch(a) || Qe(a); |
|
if (b = Oc(b, d, 4), null == c) if (e || He(a)) { |
|
var f = a.constructor; |
|
c = e ? Ch(a) ? new f() : [] : Ig(Ge(f) ? f.prototype : z); |
|
} else c = {}; |
|
return (e ? bb : Fb)(a, function(a, d, e) { |
|
return b(c, a, d, e); |
|
}), c; |
|
} |
|
function ef(a) { |
|
return ac(a, Nh(a)); |
|
} |
|
function ff(a) { |
|
return ac(a, _e(a)); |
|
} |
|
function gf(a, b, c) { |
|
return b = +b || 0, c === z ? (c = b, b = 0) : c = +c || 0, a >= wg(b, c) && a < vg(b, c); |
|
} |
|
function hf(a, b, c) { |
|
c && $c(a, b, c) && (b = c = z); |
|
var d = null == a, e = null == b; |
|
if (null == c && (e && "boolean" == typeof a ? (c = a, a = 1) : "boolean" == typeof b && (c = b, |
|
e = !0)), d && e && (b = 1, e = !1), a = +a || 0, e ? (b = a, a = 0) : b = +b || 0, |
|
c || a % 1 || b % 1) { |
|
var f = zg(); |
|
return wg(a + f * (b - a + hg("1e-" + ((f + "").length - 1))), b); |
|
} |
|
return Ub(a, b); |
|
} |
|
function jf(a) { |
|
return a = h(a), a && a.charAt(0).toUpperCase() + a.slice(1); |
|
} |
|
function kf(a) { |
|
return a = h(a), a && a.replace(Ka, m).replace(Da, ""); |
|
} |
|
function lf(a, b, c) { |
|
a = h(a), b += ""; |
|
var d = a.length; |
|
return c = c === z ? d : wg(0 > c ? 0 : +c || 0, d), c -= b.length, c >= 0 && a.indexOf(b, c) == c; |
|
} |
|
function mf(a) { |
|
return a = h(a), a && ua.test(a) ? a.replace(sa, n) : a; |
|
} |
|
function nf(a) { |
|
return a = h(a), a && Ca.test(a) ? a.replace(Ba, o) : a || "(?:)"; |
|
} |
|
function of(a, b, c) { |
|
a = h(a), b = +b; |
|
var d = a.length; |
|
if (d >= b || !tg(b)) return a; |
|
var e = (b - d) / 2, f = rg(e), g = pg(e); |
|
return c = Gc("", g, c), c.slice(0, f) + a + c; |
|
} |
|
function pf(a, b, c) { |
|
return (c ? $c(a, b, c) : null == b) ? b = 0 : b && (b = +b), a = tf(a), yg(a, b || (Ha.test(a) ? 16 : 10)); |
|
} |
|
function qf(a, b) { |
|
var c = ""; |
|
if (a = h(a), b = +b, 1 > b || !a || !tg(b)) return c; |
|
do b % 2 && (c += a), b = rg(b / 2), a += a; while (b); |
|
return c; |
|
} |
|
function rf(a, b, c) { |
|
return a = h(a), c = null == c ? 0 : wg(0 > c ? 0 : +c || 0, a.length), a.lastIndexOf(b, c) == c; |
|
} |
|
function sf(a, c, d) { |
|
var e = b.templateSettings; |
|
d && $c(a, c, d) && (c = d = z), a = h(a), c = qb(rb({}, d || c), e, pb); |
|
var f, g, i = qb(rb({}, c.imports), e.imports, pb), j = Nh(i), k = ac(i, j), l = 0, m = c.interpolate || La, n = "__p += '", o = Vf((c.escape || La).source + "|" + m.source + "|" + (m === xa ? Fa : La).source + "|" + (c.evaluate || La).source + "|$", "g"), q = "//# sourceURL=" + ("sourceURL" in c ? c.sourceURL : "lodash.templateSources[" + ++Pa + "]") + "\n"; |
|
a.replace(o, function(b, c, d, e, h, i) { |
|
return d || (d = e), n += a.slice(l, i).replace(Ma, p), c && (f = !0, n += "' +\n__e(" + c + ") +\n'"), |
|
h && (g = !0, n += "';\n" + h + ";\n__p += '"), d && (n += "' +\n((__t = (" + d + ")) == null ? '' : __t) +\n'"), |
|
l = i + b.length, b; |
|
}), n += "';\n"; |
|
var r = c.variable; |
|
r || (n = "with (obj) {\n" + n + "\n}\n"), n = (g ? n.replace(oa, "") : n).replace(pa, "$1").replace(qa, "$1;"), |
|
n = "function(" + (r || "obj") + ") {\n" + (r ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (f ? ", __e = _.escape" : "") + (g ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + n + "return __p\n}"; |
|
var s = Yh(function() { |
|
return Rf(j, q + "return " + n).apply(z, k); |
|
}); |
|
if (s.source = n, Ee(s)) throw s; |
|
return s; |
|
} |
|
function tf(a, b, c) { |
|
var d = a; |
|
return (a = h(a)) ? (c ? $c(d, b, c) : null == b) ? a.slice(v(a), w(a) + 1) : (b += "", |
|
a.slice(i(a, b), j(a, b) + 1)) : a; |
|
} |
|
function uf(a, b, c) { |
|
var d = a; |
|
return a = h(a), a ? (c ? $c(d, b, c) : null == b) ? a.slice(v(a)) : a.slice(i(a, b + "")) : a; |
|
} |
|
function vf(a, b, c) { |
|
var d = a; |
|
return a = h(a), a ? (c ? $c(d, b, c) : null == b) ? a.slice(0, w(a) + 1) : a.slice(0, j(a, b + "") + 1) : a; |
|
} |
|
function wf(a, b, c) { |
|
c && $c(a, b, c) && (b = z); |
|
var d = K, e = L; |
|
if (null != b) if (He(b)) { |
|
var f = "separator" in b ? b.separator : f; |
|
d = "length" in b ? +b.length || 0 : d, e = "omission" in b ? h(b.omission) : e; |
|
} else d = +b || 0; |
|
if (a = h(a), d >= a.length) return a; |
|
var g = d - e.length; |
|
if (1 > g) return e; |
|
var i = a.slice(0, g); |
|
if (null == f) return i + e; |
|
if (Oe(f)) { |
|
if (a.slice(g).search(f)) { |
|
var j, k, l = a.slice(0, g); |
|
for (f.global || (f = Vf(f.source, (Ga.exec(f) || "") + "g")), f.lastIndex = 0; j = f.exec(l); ) k = j.index; |
|
i = i.slice(0, null == k ? g : k); |
|
} |
|
} else if (a.indexOf(f, g) != g) { |
|
var m = i.lastIndexOf(f); |
|
m > -1 && (i = i.slice(0, m)); |
|
} |
|
return i + e; |
|
} |
|
function xf(a) { |
|
return a = h(a), a && ta.test(a) ? a.replace(ra, x) : a; |
|
} |
|
function yf(a, b, c) { |
|
return c && $c(a, b, c) && (b = z), a = h(a), a.match(b || Na) || []; |
|
} |
|
function zf(a, b, c) { |
|
return c && $c(a, b, c) && (b = z), r(a) ? Cf(a) : ub(a, b); |
|
} |
|
function Af(a) { |
|
return function() { |
|
return a; |
|
}; |
|
} |
|
function Bf(a) { |
|
return a; |
|
} |
|
function Cf(a) { |
|
return Nb(vb(a, !0)); |
|
} |
|
function Df(a, b) { |
|
return Ob(a, vb(b, !0)); |
|
} |
|
function Ef(a, b, c) { |
|
if (null == c) { |
|
var d = He(b), e = d ? Nh(b) : z, f = e && e.length ? Hb(b, e) : z; |
|
(f ? f.length : d) || (f = !1, c = b, b = a, a = this); |
|
} |
|
f || (f = Hb(b, Nh(b))); |
|
var g = !0, h = -1, i = Ge(a), j = f.length; |
|
c === !1 ? g = !1 : He(c) && "chain" in c && (g = c.chain); |
|
for (;++h < j; ) { |
|
var k = f[h], l = b[k]; |
|
a[k] = l, i && (a.prototype[k] = function(b) { |
|
return function() { |
|
var c = this.__chain__; |
|
if (g || c) { |
|
var d = a(this.__wrapped__), e = d.__actions__ = ab(this.__actions__); |
|
return e.push({ |
|
func: b, |
|
args: arguments, |
|
thisArg: a |
|
}), d.__chain__ = c, d; |
|
} |
|
return b.apply(a, jb([ this.value() ], arguments)); |
|
}; |
|
}(l)); |
|
} |
|
return a; |
|
} |
|
function Ff() { |
|
return cb._ = dg, this; |
|
} |
|
function Gf() {} |
|
function Hf(a) { |
|
return _c(a) ? Rb(a) : Sb(a); |
|
} |
|
function If(a) { |
|
return function(b) { |
|
return Ib(a, ld(b), b + ""); |
|
}; |
|
} |
|
function Jf(a, b, c) { |
|
c && $c(a, b, c) && (b = c = z), a = +a || 0, c = null == c ? 1 : +c || 0, null == b ? (b = a, |
|
a = 0) : b = +b || 0; |
|
for (var d = -1, e = vg(pg((b - a) / (c || 1)), 0), f = Of(e); ++d < e; ) f[d] = a, |
|
a += c; |
|
return f; |
|
} |
|
function Kf(a, b, c) { |
|
if (a = rg(a), 1 > a || !tg(a)) return []; |
|
var d = -1, e = Of(wg(a, Cg)); |
|
for (b = fc(b, c, 1); ++d < a; ) Cg > d ? e[d] = b(d) : b(d); |
|
return e; |
|
} |
|
function Lf(a) { |
|
var b = ++bg; |
|
return h(a) + b; |
|
} |
|
function Mf(a, b) { |
|
return (+a || 0) + (+b || 0); |
|
} |
|
function Nf(a, b, c) { |
|
return c && $c(a, b, c) && (b = z), b = Oc(b, c, 3), 1 == b.length ? nb(Ch(a) ? a : jd(a), b) : $b(a, b); |
|
} |
|
a = a ? db.defaults(cb.Object(), a, db.pick(cb, Oa)) : cb; |
|
var Of = a.Array, Pf = a.Date, Qf = a.Error, Rf = a.Function, Sf = a.Math, Tf = a.Number, Uf = a.Object, Vf = a.RegExp, Wf = a.String, Xf = a.TypeError, Yf = Of.prototype, Zf = Uf.prototype, $f = Wf.prototype, _f = Rf.prototype.toString, ag = Zf.hasOwnProperty, bg = 0, cg = Zf.toString, dg = cb._, eg = Vf("^" + _f.call(ag).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), fg = a.ArrayBuffer, gg = a.clearTimeout, hg = a.parseFloat, ig = Sf.pow, jg = Zf.propertyIsEnumerable, kg = Sc(a, "Set"), lg = a.setTimeout, mg = Yf.splice, ng = a.Uint8Array, og = Sc(a, "WeakMap"), pg = Sf.ceil, qg = Sc(Uf, "create"), rg = Sf.floor, sg = Sc(Of, "isArray"), tg = a.isFinite, ug = Sc(Uf, "keys"), vg = Sf.max, wg = Sf.min, xg = Sc(Pf, "now"), yg = a.parseInt, zg = Sf.random, Ag = Tf.NEGATIVE_INFINITY, Bg = Tf.POSITIVE_INFINITY, Cg = 4294967295, Dg = Cg - 1, Eg = Cg >>> 1, Fg = 9007199254740991, Gg = og && new og(), Hg = {}; |
|
b.support = {}; |
|
b.templateSettings = { |
|
escape: va, |
|
evaluate: wa, |
|
interpolate: xa, |
|
variable: "", |
|
imports: { |
|
_: b |
|
} |
|
}; |
|
var Ig = function() { |
|
function a() {} |
|
return function(b) { |
|
if (He(b)) { |
|
a.prototype = b; |
|
var c = new a(); |
|
a.prototype = z; |
|
} |
|
return c || {}; |
|
}; |
|
}(), Jg = lc(Fb), Kg = lc(Gb, !0), Lg = mc(), Mg = mc(!0), Ng = Gg ? function(a, b) { |
|
return Gg.set(a, b), a; |
|
} : Bf, Og = Gg ? function(a) { |
|
return Gg.get(a); |
|
} : Gf, Pg = Rb("length"), Qg = function() { |
|
var a = 0, b = 0; |
|
return function(c, d) { |
|
var e = oh(), f = N - (e - b); |
|
if (b = e, f > 0) { |
|
if (++a >= M) return c; |
|
} else a = 0; |
|
return Ng(c, d); |
|
}; |
|
}(), Rg = qe(function(a, b) { |
|
return r(a) && Yc(a) ? xb(a, Db(b, !1, !0)) : []; |
|
}), Sg = vc(), Tg = vc(!0), Ug = qe(function(a) { |
|
for (var b = a.length, c = b, d = Of(l), e = Qc(), g = e == f, h = []; c--; ) { |
|
var i = a[c] = Yc(i = a[c]) ? i : []; |
|
d[c] = g && i.length >= 120 ? oc(c && i) : null; |
|
} |
|
var j = a[0], k = -1, l = j ? j.length : 0, m = d[0]; |
|
a: for (;++k < l; ) if (i = j[k], (m ? Za(m, i) : e(h, i, 0)) < 0) { |
|
for (var c = b; --c; ) { |
|
var n = d[c]; |
|
if ((n ? Za(n, i) : e(a[c], i, 0)) < 0) continue a; |
|
} |
|
m && m.push(i), h.push(i); |
|
} |
|
return h; |
|
}), Vg = qe(function(a, b) { |
|
b = Db(b); |
|
var c = sb(a, b); |
|
return Tb(a, b.sort(d)), c; |
|
}), Wg = Jc(), Xg = Jc(!0), Yg = qe(function(a) { |
|
return _b(Db(a, !1, !0)); |
|
}), Zg = qe(function(a, b) { |
|
return Yc(a) ? xb(a, b) : []; |
|
}), $g = qe(Kd), _g = qe(function(a) { |
|
var b = a.length, c = b > 2 ? a[b - 2] : z, d = b > 1 ? a[b - 1] : z; |
|
return b > 2 && "function" == typeof c ? b -= 2 : (c = b > 1 && "function" == typeof d ? (--b, |
|
d) : z, d = z), a.length = b, Ld(a, c, d); |
|
}), ah = qe(function(a) { |
|
return a = Db(a), this.thru(function(b) { |
|
return _a(Ch(b) ? b : [ kd(b) ], a); |
|
}); |
|
}), bh = qe(function(a, b) { |
|
return sb(a, Db(b)); |
|
}), ch = jc(function(a, b, c) { |
|
ag.call(a, c) ? ++a[c] : a[c] = 1; |
|
}), dh = uc(Jg), eh = uc(Kg, !0), fh = yc(bb, Jg), gh = yc(eb, Kg), hh = jc(function(a, b, c) { |
|
ag.call(a, c) ? a[c].push(b) : a[c] = [ b ]; |
|
}), ih = jc(function(a, b, c) { |
|
a[c] = b; |
|
}), jh = qe(function(a, b, c) { |
|
var d = -1, e = "function" == typeof b, f = _c(b), g = Yc(a) ? Of(a.length) : []; |
|
return Jg(a, function(a) { |
|
var h = e ? b : f && null != a ? a[b] : z; |
|
g[++d] = h ? h.apply(a, c) : Xc(a, b, c); |
|
}), g; |
|
}), kh = jc(function(a, b, c) { |
|
a[c ? 0 : 1].push(b); |
|
}, function() { |
|
return [ [], [] ]; |
|
}), lh = Ec(kb, Jg), mh = Ec(lb, Kg), nh = qe(function(a, b) { |
|
if (null == a) return []; |
|
var c = b[2]; |
|
return c && $c(b[0], b[1], c) && (b.length = 1), Zb(a, Db(b), []); |
|
}), oh = xg || function() { |
|
return new Pf().getTime(); |
|
}, ph = qe(function(a, b, c) { |
|
var d = B; |
|
if (c.length) { |
|
var e = t(c, ph.placeholder); |
|
d |= G; |
|
} |
|
return Kc(a, d, b, c, e); |
|
}), qh = qe(function(a, b) { |
|
b = b.length ? Db(b) : Xe(a); |
|
for (var c = -1, d = b.length; ++c < d; ) { |
|
var e = b[c]; |
|
a[e] = Kc(a[e], B, a); |
|
} |
|
return a; |
|
}), rh = qe(function(a, b, c) { |
|
var d = B | C; |
|
if (c.length) { |
|
var e = t(c, rh.placeholder); |
|
d |= G; |
|
} |
|
return Kc(b, d, a, c, e); |
|
}), sh = rc(E), th = rc(F), uh = qe(function(a, b) { |
|
return wb(a, 1, b); |
|
}), vh = qe(function(a, b, c) { |
|
return wb(a, b, c); |
|
}), wh = xc(), xh = xc(!0), yh = qe(function(a, b) { |
|
if (b = Db(b), "function" != typeof a || !fb(b, g)) throw new Xf(R); |
|
var c = b.length; |
|
return qe(function(d) { |
|
for (var e = wg(d.length, c); e--; ) d[e] = b[e](d[e]); |
|
return a.apply(this, d); |
|
}); |
|
}), zh = Dc(G), Ah = Dc(H), Bh = qe(function(a, b) { |
|
return Kc(a, J, z, z, z, Db(b)); |
|
}), Ch = sg || function(a) { |
|
return r(a) && bd(a.length) && cg.call(a) == U; |
|
}, Dh = kc(Pb), Eh = kc(function(a, b, c) { |
|
return c ? qb(a, b, c) : rb(a, b); |
|
}), Fh = sc(Eh, ob), Gh = sc(Dh, ed), Hh = wc(Fb), Ih = wc(Gb), Jh = zc(Lg), Kh = zc(Mg), Lh = Ac(Fb), Mh = Ac(Gb), Nh = ug ? function(a) { |
|
var b = null == a ? z : a.constructor; |
|
return "function" == typeof b && b.prototype === a || "function" != typeof a && Yc(a) ? id(a) : He(a) ? ug(a) : []; |
|
} : id, Oh = Bc(!0), Ph = Bc(), Qh = qe(function(a, b) { |
|
if (null == a) return {}; |
|
if ("function" != typeof b[0]) { |
|
var b = ib(Db(b), Wf); |
|
return fd(a, xb(_e(a), b)); |
|
} |
|
var c = fc(b[0], b[1], 3); |
|
return gd(a, function(a, b, d) { |
|
return !c(a, b, d); |
|
}); |
|
}), Rh = qe(function(a, b) { |
|
return null == a ? {} : "function" == typeof b[0] ? gd(a, fc(b[0], b[1], 3)) : fd(a, Db(b)); |
|
}), Sh = pc(function(a, b, c) { |
|
return b = b.toLowerCase(), a + (c ? b.charAt(0).toUpperCase() + b.slice(1) : b); |
|
}), Th = pc(function(a, b, c) { |
|
return a + (c ? "-" : "") + b.toLowerCase(); |
|
}), Uh = Cc(), Vh = Cc(!0), Wh = pc(function(a, b, c) { |
|
return a + (c ? "_" : "") + b.toLowerCase(); |
|
}), Xh = pc(function(a, b, c) { |
|
return a + (c ? " " : "") + (b.charAt(0).toUpperCase() + b.slice(1)); |
|
}), Yh = qe(function(a, b) { |
|
try { |
|
return a.apply(z, b); |
|
} catch (c) { |
|
return Ee(c) ? c : new Qf(c); |
|
} |
|
}), Zh = qe(function(a, b) { |
|
return function(c) { |
|
return Xc(c, a, b); |
|
}; |
|
}), $h = qe(function(a, b) { |
|
return function(c) { |
|
return Xc(a, c, b); |
|
}; |
|
}), _h = Ic("ceil"), ai = Ic("floor"), bi = tc(we, Ag), ci = tc(Se, Bg), di = Ic("round"); |
|
return b.prototype = c.prototype, s.prototype = Ig(c.prototype), s.prototype.constructor = s, |
|
Z.prototype = Ig(c.prototype), Z.prototype.constructor = Z, Ta.prototype["delete"] = Ua, |
|
Ta.prototype.get = Va, Ta.prototype.has = Wa, Ta.prototype.set = Xa, Ya.prototype.push = $a, |
|
ne.Cache = Ta, b.after = je, b.ary = ke, b.assign = Eh, b.at = bh, b.before = le, |
|
b.bind = ph, b.bindAll = qh, b.bindKey = rh, b.callback = zf, b.chain = Od, b.chunk = nd, |
|
b.compact = od, b.constant = Af, b.countBy = ch, b.create = We, b.curry = sh, b.curryRight = th, |
|
b.debounce = me, b.defaults = Fh, b.defaultsDeep = Gh, b.defer = uh, b.delay = vh, |
|
b.difference = Rg, b.drop = pd, b.dropRight = qd, b.dropRightWhile = rd, b.dropWhile = sd, |
|
b.fill = td, b.filter = Yd, b.flatten = vd, b.flattenDeep = wd, b.flow = wh, b.flowRight = xh, |
|
b.forEach = fh, b.forEachRight = gh, b.forIn = Jh, b.forInRight = Kh, b.forOwn = Lh, |
|
b.forOwnRight = Mh, b.functions = Xe, b.groupBy = hh, b.indexBy = ih, b.initial = yd, |
|
b.intersection = Ug, b.invert = $e, b.invoke = jh, b.keys = Nh, b.keysIn = _e, b.map = _d, |
|
b.mapKeys = Oh, b.mapValues = Ph, b.matches = Cf, b.matchesProperty = Df, b.memoize = ne, |
|
b.merge = Dh, b.method = Zh, b.methodOf = $h, b.mixin = Ef, b.modArgs = yh, b.negate = oe, |
|
b.omit = Qh, b.once = pe, b.pairs = af, b.partial = zh, b.partialRight = Ah, b.partition = kh, |
|
b.pick = Rh, b.pluck = ae, b.property = Hf, b.propertyOf = If, b.pull = Bd, b.pullAt = Vg, |
|
b.range = Jf, b.rearg = Bh, b.reject = be, b.remove = Cd, b.rest = Dd, b.restParam = qe, |
|
b.set = cf, b.shuffle = de, b.slice = Ed, b.sortBy = ge, b.sortByAll = nh, b.sortByOrder = he, |
|
b.spread = re, b.take = Fd, b.takeRight = Gd, b.takeRightWhile = Hd, b.takeWhile = Id, |
|
b.tap = Pd, b.throttle = se, b.thru = Qd, b.times = Kf, b.toArray = Ue, b.toPlainObject = Ve, |
|
b.transform = df, b.union = Yg, b.uniq = Jd, b.unzip = Kd, b.unzipWith = Ld, b.values = ef, |
|
b.valuesIn = ff, b.where = ie, b.without = Zg, b.wrap = te, b.xor = Md, b.zip = $g, |
|
b.zipObject = Nd, b.zipWith = _g, b.backflow = xh, b.collect = _d, b.compose = xh, |
|
b.each = fh, b.eachRight = gh, b.extend = Eh, b.iteratee = zf, b.methods = Xe, b.object = Nd, |
|
b.select = Yd, b.tail = Dd, b.unique = Jd, Ef(b, b), b.add = Mf, b.attempt = Yh, |
|
b.camelCase = Sh, b.capitalize = jf, b.ceil = _h, b.clone = ue, b.cloneDeep = ve, |
|
b.deburr = kf, b.endsWith = lf, b.escape = mf, b.escapeRegExp = nf, b.every = Xd, |
|
b.find = dh, b.findIndex = Sg, b.findKey = Hh, b.findLast = eh, b.findLastIndex = Tg, |
|
b.findLastKey = Ih, b.findWhere = Zd, b.first = ud, b.floor = ai, b.get = Ye, b.gt = we, |
|
b.gte = xe, b.has = Ze, b.identity = Bf, b.includes = $d, b.indexOf = xd, b.inRange = gf, |
|
b.isArguments = ye, b.isArray = Ch, b.isBoolean = ze, b.isDate = Ae, b.isElement = Be, |
|
b.isEmpty = Ce, b.isEqual = De, b.isError = Ee, b.isFinite = Fe, b.isFunction = Ge, |
|
b.isMatch = Ie, b.isNaN = Je, b.isNative = Ke, b.isNull = Le, b.isNumber = Me, b.isObject = He, |
|
b.isPlainObject = Ne, b.isRegExp = Oe, b.isString = Pe, b.isTypedArray = Qe, b.isUndefined = Re, |
|
b.kebabCase = Th, b.last = zd, b.lastIndexOf = Ad, b.lt = Se, b.lte = Te, b.max = bi, |
|
b.min = ci, b.noConflict = Ff, b.noop = Gf, b.now = oh, b.pad = of, b.padLeft = Uh, |
|
b.padRight = Vh, b.parseInt = pf, b.random = hf, b.reduce = lh, b.reduceRight = mh, |
|
b.repeat = qf, b.result = bf, b.round = di, b.runInContext = y, b.size = ee, b.snakeCase = Wh, |
|
b.some = fe, b.sortedIndex = Wg, b.sortedLastIndex = Xg, b.startCase = Xh, b.startsWith = rf, |
|
b.sum = Nf, b.template = sf, b.trim = tf, b.trimLeft = uf, b.trimRight = vf, b.trunc = wf, |
|
b.unescape = xf, b.uniqueId = Lf, b.words = yf, b.all = Xd, b.any = fe, b.contains = $d, |
|
b.eq = De, b.detect = dh, b.foldl = lh, b.foldr = mh, b.head = ud, b.include = $d, |
|
b.inject = lh, Ef(b, function() { |
|
var a = {}; |
|
return Fb(b, function(c, d) { |
|
b.prototype[d] || (a[d] = c); |
|
}), a; |
|
}(), !1), b.sample = ce, b.prototype.sample = function(a) { |
|
return this.__chain__ || null != a ? this.thru(function(b) { |
|
return ce(b, a); |
|
}) : ce(this.value()); |
|
}, b.VERSION = A, bb([ "bind", "bindKey", "curry", "curryRight", "partial", "partialRight" ], function(a) { |
|
b[a].placeholder = b; |
|
}), bb([ "drop", "take" ], function(a, b) { |
|
Z.prototype[a] = function(c) { |
|
var d = this.__filtered__; |
|
if (d && !b) return new Z(this); |
|
c = null == c ? 1 : vg(rg(c) || 0, 0); |
|
var e = this.clone(); |
|
return d ? e.__takeCount__ = wg(e.__takeCount__, c) : e.__views__.push({ |
|
size: c, |
|
type: a + (e.__dir__ < 0 ? "Right" : "") |
|
}), e; |
|
}, Z.prototype[a + "Right"] = function(b) { |
|
return this.reverse()[a](b).reverse(); |
|
}; |
|
}), bb([ "filter", "map", "takeWhile" ], function(a, b) { |
|
var c = b + 1, d = c != Q; |
|
Z.prototype[a] = function(a, b) { |
|
var e = this.clone(); |
|
return e.__iteratees__.push({ |
|
iteratee: Oc(a, b, 1), |
|
type: c |
|
}), e.__filtered__ = e.__filtered__ || d, e; |
|
}; |
|
}), bb([ "first", "last" ], function(a, b) { |
|
var c = "take" + (b ? "Right" : ""); |
|
Z.prototype[a] = function() { |
|
return this[c](1).value()[0]; |
|
}; |
|
}), bb([ "initial", "rest" ], function(a, b) { |
|
var c = "drop" + (b ? "" : "Right"); |
|
Z.prototype[a] = function() { |
|
return this.__filtered__ ? new Z(this) : this[c](1); |
|
}; |
|
}), bb([ "pluck", "where" ], function(a, b) { |
|
var c = b ? "filter" : "map", d = b ? Nb : Hf; |
|
Z.prototype[a] = function(a) { |
|
return this[c](d(a)); |
|
}; |
|
}), Z.prototype.compact = function() { |
|
return this.filter(Bf); |
|
}, Z.prototype.reject = function(a, b) { |
|
return a = Oc(a, b, 1), this.filter(function(b) { |
|
return !a(b); |
|
}); |
|
}, Z.prototype.slice = function(a, b) { |
|
a = null == a ? 0 : +a || 0; |
|
var c = this; |
|
return c.__filtered__ && (a > 0 || 0 > b) ? new Z(c) : (0 > a ? c = c.takeRight(-a) : a && (c = c.drop(a)), |
|
b !== z && (b = +b || 0, c = 0 > b ? c.dropRight(-b) : c.take(b - a)), c); |
|
}, Z.prototype.takeRightWhile = function(a, b) { |
|
return this.reverse().takeWhile(a, b).reverse(); |
|
}, Z.prototype.toArray = function() { |
|
return this.take(Bg); |
|
}, Fb(Z.prototype, function(a, c) { |
|
var d = /^(?:filter|map|reject)|While$/.test(c), e = /^(?:first|last)$/.test(c), f = b[e ? "take" + ("last" == c ? "Right" : "") : c]; |
|
f && (b.prototype[c] = function() { |
|
var b = e ? [ 1 ] : arguments, c = this.__chain__, g = this.__wrapped__, h = !!this.__actions__.length, i = g instanceof Z, j = b[0], k = i || Ch(g); |
|
k && d && "function" == typeof j && 1 != j.length && (i = k = !1); |
|
var l = function(a) { |
|
return e && c ? f(a, 1)[0] : f.apply(z, jb([ a ], b)); |
|
}, m = { |
|
func: Qd, |
|
args: [ l ], |
|
thisArg: z |
|
}, n = i && !h; |
|
if (e && !c) return n ? (g = g.clone(), g.__actions__.push(m), a.call(g)) : f.call(z, this.value())[0]; |
|
if (!e && k) { |
|
g = n ? g : new Z(this); |
|
var o = a.apply(g, b); |
|
return o.__actions__.push(m), new s(o, c); |
|
} |
|
return this.thru(l); |
|
}); |
|
}), bb([ "join", "pop", "push", "replace", "shift", "sort", "splice", "split", "unshift" ], function(a) { |
|
var c = (/^(?:replace|split)$/.test(a) ? $f : Yf)[a], d = /^(?:push|sort|unshift)$/.test(a) ? "tap" : "thru", e = /^(?:join|pop|replace|shift)$/.test(a); |
|
b.prototype[a] = function() { |
|
var a = arguments; |
|
return e && !this.__chain__ ? c.apply(this.value(), a) : this[d](function(b) { |
|
return c.apply(b, a); |
|
}); |
|
}; |
|
}), Fb(Z.prototype, function(a, c) { |
|
var d = b[c]; |
|
if (d) { |
|
var e = d.name, f = Hg[e] || (Hg[e] = []); |
|
f.push({ |
|
name: c, |
|
func: d |
|
}); |
|
} |
|
}), Hg[Fc(z, C).name] = [ { |
|
name: "wrapper", |
|
func: z |
|
} ], Z.prototype.clone = ba, Z.prototype.reverse = da, Z.prototype.value = Sa, b.prototype.chain = Rd, |
|
b.prototype.commit = Sd, b.prototype.concat = ah, b.prototype.plant = Td, b.prototype.reverse = Ud, |
|
b.prototype.toString = Vd, b.prototype.run = b.prototype.toJSON = b.prototype.valueOf = b.prototype.value = Wd, |
|
b.prototype.collect = b.prototype.map, b.prototype.head = b.prototype.first, b.prototype.select = b.prototype.filter, |
|
b.prototype.tail = b.prototype.rest, b; |
|
} |
|
var z, A = "3.10.1", B = 1, C = 2, D = 4, E = 8, F = 16, G = 32, H = 64, I = 128, J = 256, K = 30, L = "...", M = 150, N = 16, O = 200, P = 1, Q = 2, R = "Expected a function", S = "__lodash_placeholder__", T = "[object Arguments]", U = "[object Array]", V = "[object Boolean]", W = "[object Date]", X = "[object Error]", Y = "[object Function]", Z = "[object Map]", $ = "[object Number]", _ = "[object Object]", aa = "[object RegExp]", ba = "[object Set]", ca = "[object String]", da = "[object WeakMap]", ea = "[object ArrayBuffer]", fa = "[object Float32Array]", ga = "[object Float64Array]", ha = "[object Int8Array]", ia = "[object Int16Array]", ja = "[object Int32Array]", ka = "[object Uint8Array]", la = "[object Uint8ClampedArray]", ma = "[object Uint16Array]", na = "[object Uint32Array]", oa = /\b__p \+= '';/g, pa = /\b(__p \+=) '' \+/g, qa = /(__e\(.*?\)|\b__t\)) \+\n'';/g, ra = /&(?:amp|lt|gt|quot|#39|#96);/g, sa = /[&<>"'`]/g, ta = RegExp(ra.source), ua = RegExp(sa.source), va = /<%-([\s\S]+?)%>/g, wa = /<%([\s\S]+?)%>/g, xa = /<%=([\s\S]+?)%>/g, ya = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, za = /^\w*$/, Aa = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g, Ba = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g, Ca = RegExp(Ba.source), Da = /[\u0300-\u036f\ufe20-\ufe23]/g, Ea = /\\(\\)?/g, Fa = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Ga = /\w*$/, Ha = /^0[xX]/, Ia = /^\[object .+?Constructor\]$/, Ja = /^\d+$/, Ka = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g, La = /($^)/, Ma = /['\n\r\u2028\u2029\\]/g, Na = function() { |
|
var a = "[A-Z\\xc0-\\xd6\\xd8-\\xde]", b = "[a-z\\xdf-\\xf6\\xf8-\\xff]+"; |
|
return RegExp(a + "+(?=" + a + b + ")|" + a + "?" + b + "|" + a + "+|[0-9]+", "g"); |
|
}(), Oa = [ "Array", "ArrayBuffer", "Date", "Error", "Float32Array", "Float64Array", "Function", "Int8Array", "Int16Array", "Int32Array", "Math", "Number", "Object", "RegExp", "Set", "String", "_", "clearTimeout", "isFinite", "parseFloat", "parseInt", "setTimeout", "TypeError", "Uint8Array", "Uint8ClampedArray", "Uint16Array", "Uint32Array", "WeakMap" ], Pa = -1, Qa = {}; |
|
Qa[fa] = Qa[ga] = Qa[ha] = Qa[ia] = Qa[ja] = Qa[ka] = Qa[la] = Qa[ma] = Qa[na] = !0, |
|
Qa[T] = Qa[U] = Qa[ea] = Qa[V] = Qa[W] = Qa[X] = Qa[Y] = Qa[Z] = Qa[$] = Qa[_] = Qa[aa] = Qa[ba] = Qa[ca] = Qa[da] = !1; |
|
var Ra = {}; |
|
Ra[T] = Ra[U] = Ra[ea] = Ra[V] = Ra[W] = Ra[fa] = Ra[ga] = Ra[ha] = Ra[ia] = Ra[ja] = Ra[$] = Ra[_] = Ra[aa] = Ra[ca] = Ra[ka] = Ra[la] = Ra[ma] = Ra[na] = !0, |
|
Ra[X] = Ra[Y] = Ra[Z] = Ra[ba] = Ra[da] = !1; |
|
var Sa = { |
|
"À": "A", |
|
"Á": "A", |
|
"Â": "A", |
|
"Ã": "A", |
|
"Ä": "A", |
|
"Å": "A", |
|
"à": "a", |
|
"á": "a", |
|
"â": "a", |
|
"ã": "a", |
|
"ä": "a", |
|
"å": "a", |
|
"Ç": "C", |
|
"ç": "c", |
|
"Ð": "D", |
|
"ð": "d", |
|
"È": "E", |
|
"É": "E", |
|
"Ê": "E", |
|
"Ë": "E", |
|
"è": "e", |
|
"é": "e", |
|
"ê": "e", |
|
"ë": "e", |
|
"Ì": "I", |
|
"Í": "I", |
|
"Î": "I", |
|
"Ï": "I", |
|
"ì": "i", |
|
"í": "i", |
|
"î": "i", |
|
"ï": "i", |
|
"Ñ": "N", |
|
"ñ": "n", |
|
"Ò": "O", |
|
"Ó": "O", |
|
"Ô": "O", |
|
"Õ": "O", |
|
"Ö": "O", |
|
"Ø": "O", |
|
"ò": "o", |
|
"ó": "o", |
|
"ô": "o", |
|
"õ": "o", |
|
"ö": "o", |
|
"ø": "o", |
|
"Ù": "U", |
|
"Ú": "U", |
|
"Û": "U", |
|
"Ü": "U", |
|
"ù": "u", |
|
"ú": "u", |
|
"û": "u", |
|
"ü": "u", |
|
"Ý": "Y", |
|
"ý": "y", |
|
"ÿ": "y", |
|
"Æ": "Ae", |
|
"æ": "ae", |
|
"Þ": "Th", |
|
"þ": "th", |
|
"ß": "ss" |
|
}, Ta = { |
|
"&": "&", |
|
"<": "<", |
|
">": ">", |
|
'"': """, |
|
"'": "'", |
|
"`": "`" |
|
}, Ua = { |
|
"&": "&", |
|
"<": "<", |
|
">": ">", |
|
""": '"', |
|
"'": "'", |
|
"`": "`" |
|
}, Va = { |
|
"function": !0, |
|
object: !0 |
|
}, Wa = { |
|
0: "x30", |
|
1: "x31", |
|
2: "x32", |
|
3: "x33", |
|
4: "x34", |
|
5: "x35", |
|
6: "x36", |
|
7: "x37", |
|
8: "x38", |
|
9: "x39", |
|
A: "x41", |
|
B: "x42", |
|
C: "x43", |
|
D: "x44", |
|
E: "x45", |
|
F: "x46", |
|
a: "x61", |
|
b: "x62", |
|
c: "x63", |
|
d: "x64", |
|
e: "x65", |
|
f: "x66", |
|
n: "x6e", |
|
r: "x72", |
|
t: "x74", |
|
u: "x75", |
|
v: "x76", |
|
x: "x78" |
|
}, Xa = { |
|
"\\": "\\", |
|
"'": "'", |
|
"\n": "n", |
|
"\r": "r", |
|
"\u2028": "u2028", |
|
"\u2029": "u2029" |
|
}, Ya = Va[typeof c] && c && !c.nodeType && c, Za = Va[typeof b] && b && !b.nodeType && b, $a = Ya && Za && "object" == typeof a && a && a.Object && a, _a = Va[typeof self] && self && self.Object && self, ab = Va[typeof window] && window && window.Object && window, bb = Za && Za.exports === Ya && Ya, cb = $a || ab !== (this && this.window) && ab || _a || this, db = y(); |
|
"function" == typeof define && "object" == typeof define.amd && define.amd ? (cb._ = db, |
|
define(function() { |
|
return db; |
|
})) : Ya && Za ? bb ? (Za.exports = db)._ = db : Ya._ = db : cb._ = db; |
|
}).call(this); |
|
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); |
|
}, {} ], |
|
33: [ function(a, b, c) { |
|
(function(a) { |
|
!function(a) { |
|
"use strict"; |
|
if ("function" == typeof bootstrap) bootstrap("promise", a); else if ("object" == typeof c && "object" == typeof b) b.exports = a(); else if ("function" == typeof define && define.amd) define(a); else if ("undefined" != typeof ses) { |
|
if (!ses.ok()) return; |
|
ses.makeQ = a; |
|
} else { |
|
if ("undefined" == typeof window && "undefined" == typeof self) throw new Error("This environment was not anticipated by Q. Please file a bug."); |
|
var d = "undefined" != typeof window ? window : self, e = d.Q; |
|
d.Q = a(), d.Q.noConflict = function() { |
|
return d.Q = e, this; |
|
}; |
|
} |
|
}(function() { |
|
"use strict"; |
|
function b(a) { |
|
return function() { |
|
return X.apply(a, arguments); |
|
}; |
|
} |
|
function c(a) { |
|
return a === Object(a); |
|
} |
|
function d(a) { |
|
return "[object StopIteration]" === da(a) || a instanceof T; |
|
} |
|
function e(a, b) { |
|
if (Q && b.stack && "object" == typeof a && null !== a && a.stack && -1 === a.stack.indexOf(ea)) { |
|
for (var c = [], d = b; d; d = d.source) d.stack && c.unshift(d.stack); |
|
c.unshift(a.stack); |
|
var e = c.join("\n" + ea + "\n"); |
|
a.stack = f(e); |
|
} |
|
} |
|
function f(a) { |
|
for (var b = a.split("\n"), c = [], d = 0; d < b.length; ++d) { |
|
var e = b[d]; |
|
i(e) || g(e) || !e || c.push(e); |
|
} |
|
return c.join("\n"); |
|
} |
|
function g(a) { |
|
return -1 !== a.indexOf("(module.js:") || -1 !== a.indexOf("(node.js:"); |
|
} |
|
function h(a) { |
|
var b = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a); |
|
if (b) return [ b[1], Number(b[2]) ]; |
|
var c = /at ([^ ]+):(\d+):(?:\d+)$/.exec(a); |
|
if (c) return [ c[1], Number(c[2]) ]; |
|
var d = /.*@(.+):(\d+)$/.exec(a); |
|
return d ? [ d[1], Number(d[2]) ] : void 0; |
|
} |
|
function i(a) { |
|
var b = h(a); |
|
if (!b) return !1; |
|
var c = b[0], d = b[1]; |
|
return c === S && d >= U && ja >= d; |
|
} |
|
function j() { |
|
if (Q) try { |
|
throw new Error(); |
|
} catch (a) { |
|
var b = a.stack.split("\n"), c = b[0].indexOf("@") > 0 ? b[1] : b[2], d = h(c); |
|
if (!d) return; |
|
return S = d[0], d[1]; |
|
} |
|
} |
|
function k(a, b, c) { |
|
return function() { |
|
return "undefined" != typeof console && "function" == typeof console.warn, a.apply(a, arguments); |
|
}; |
|
} |
|
function l(a) { |
|
return a instanceof p ? a : t(a) ? C(a) : B(a); |
|
} |
|
function m() { |
|
function a(a) { |
|
b = a, f.source = a, Z(c, function(b, c) { |
|
l.nextTick(function() { |
|
a.promiseDispatch.apply(a, c); |
|
}); |
|
}, void 0), c = void 0, d = void 0; |
|
} |
|
var b, c = [], d = [], e = aa(m.prototype), f = aa(p.prototype); |
|
if (f.promiseDispatch = function(a, e, f) { |
|
var g = Y(arguments); |
|
c ? (c.push(g), "when" === e && f[1] && d.push(f[1])) : l.nextTick(function() { |
|
b.promiseDispatch.apply(b, g); |
|
}); |
|
}, f.valueOf = function() { |
|
if (c) return f; |
|
var a = r(b); |
|
return s(a) && (b = a), a; |
|
}, f.inspect = function() { |
|
return b ? b.inspect() : { |
|
state: "pending" |
|
}; |
|
}, l.longStackSupport && Q) try { |
|
throw new Error(); |
|
} catch (g) { |
|
f.stack = g.stack.substring(g.stack.indexOf("\n") + 1); |
|
} |
|
return e.promise = f, e.resolve = function(c) { |
|
b || a(l(c)); |
|
}, e.fulfill = function(c) { |
|
b || a(B(c)); |
|
}, e.reject = function(c) { |
|
b || a(A(c)); |
|
}, e.notify = function(a) { |
|
b || Z(d, function(b, c) { |
|
l.nextTick(function() { |
|
c(a); |
|
}); |
|
}, void 0); |
|
}, e; |
|
} |
|
function n(a) { |
|
if ("function" != typeof a) throw new TypeError("resolver must be a function."); |
|
var b = m(); |
|
try { |
|
a(b.resolve, b.reject, b.notify); |
|
} catch (c) { |
|
b.reject(c); |
|
} |
|
return b.promise; |
|
} |
|
function o(a) { |
|
return n(function(b, c) { |
|
for (var d = 0, e = a.length; e > d; d++) l(a[d]).then(b, c); |
|
}); |
|
} |
|
function p(a, b, c) { |
|
void 0 === b && (b = function(a) { |
|
return A(new Error("Promise does not support operation: " + a)); |
|
}), void 0 === c && (c = function() { |
|
return { |
|
state: "unknown" |
|
}; |
|
}); |
|
var d = aa(p.prototype); |
|
if (d.promiseDispatch = function(c, e, f) { |
|
var g; |
|
try { |
|
g = a[e] ? a[e].apply(d, f) : b.call(d, e, f); |
|
} catch (h) { |
|
g = A(h); |
|
} |
|
c && c(g); |
|
}, d.inspect = c, c) { |
|
var e = c(); |
|
"rejected" === e.state && (d.exception = e.reason), d.valueOf = function() { |
|
var a = c(); |
|
return "pending" === a.state || "rejected" === a.state ? d : a.value; |
|
}; |
|
} |
|
return d; |
|
} |
|
function q(a, b, c, d) { |
|
return l(a).then(b, c, d); |
|
} |
|
function r(a) { |
|
if (s(a)) { |
|
var b = a.inspect(); |
|
if ("fulfilled" === b.state) return b.value; |
|
} |
|
return a; |
|
} |
|
function s(a) { |
|
return a instanceof p; |
|
} |
|
function t(a) { |
|
return c(a) && "function" == typeof a.then; |
|
} |
|
function u(a) { |
|
return s(a) && "pending" === a.inspect().state; |
|
} |
|
function v(a) { |
|
return !s(a) || "fulfilled" === a.inspect().state; |
|
} |
|
function w(a) { |
|
return s(a) && "rejected" === a.inspect().state; |
|
} |
|
function x() { |
|
fa.length = 0, ga.length = 0, ia || (ia = !0); |
|
} |
|
function y(b, c) { |
|
ia && ("object" == typeof a && "function" == typeof a.emit && l.nextTick.runAfter(function() { |
|
-1 !== $(ga, b) && (a.emit("unhandledRejection", c, b), ha.push(b)); |
|
}), ga.push(b), c && "undefined" != typeof c.stack ? fa.push(c.stack) : fa.push("(no stack) " + c)); |
|
} |
|
function z(b) { |
|
if (ia) { |
|
var c = $(ga, b); |
|
-1 !== c && ("object" == typeof a && "function" == typeof a.emit && l.nextTick.runAfter(function() { |
|
var d = $(ha, b); |
|
-1 !== d && (a.emit("rejectionHandled", fa[c], b), ha.splice(d, 1)); |
|
}), ga.splice(c, 1), fa.splice(c, 1)); |
|
} |
|
} |
|
function A(a) { |
|
var b = p({ |
|
when: function(b) { |
|
return b && z(this), b ? b(a) : this; |
|
} |
|
}, function() { |
|
return this; |
|
}, function() { |
|
return { |
|
state: "rejected", |
|
reason: a |
|
}; |
|
}); |
|
return y(b, a), b; |
|
} |
|
function B(a) { |
|
return p({ |
|
when: function() { |
|
return a; |
|
}, |
|
get: function(b) { |
|
return a[b]; |
|
}, |
|
set: function(b, c) { |
|
a[b] = c; |
|
}, |
|
"delete": function(b) { |
|
delete a[b]; |
|
}, |
|
post: function(b, c) { |
|
return null === b || void 0 === b ? a.apply(void 0, c) : a[b].apply(a, c); |
|
}, |
|
apply: function(b, c) { |
|
return a.apply(b, c); |
|
}, |
|
keys: function() { |
|
return ca(a); |
|
} |
|
}, void 0, function() { |
|
return { |
|
state: "fulfilled", |
|
value: a |
|
}; |
|
}); |
|
} |
|
function C(a) { |
|
var b = m(); |
|
return l.nextTick(function() { |
|
try { |
|
a.then(b.resolve, b.reject, b.notify); |
|
} catch (c) { |
|
b.reject(c); |
|
} |
|
}), b.promise; |
|
} |
|
function D(a) { |
|
return p({ |
|
isDef: function() {} |
|
}, function(b, c) { |
|
return J(a, b, c); |
|
}, function() { |
|
return l(a).inspect(); |
|
}); |
|
} |
|
function E(a, b, c) { |
|
return l(a).spread(b, c); |
|
} |
|
function F(a) { |
|
return function() { |
|
function b(a, b) { |
|
var g; |
|
if ("undefined" == typeof StopIteration) { |
|
try { |
|
g = c[a](b); |
|
} catch (h) { |
|
return A(h); |
|
} |
|
return g.done ? l(g.value) : q(g.value, e, f); |
|
} |
|
try { |
|
g = c[a](b); |
|
} catch (h) { |
|
return d(h) ? l(h.value) : A(h); |
|
} |
|
return q(g, e, f); |
|
} |
|
var c = a.apply(this, arguments), e = b.bind(b, "next"), f = b.bind(b, "throw"); |
|
return e(); |
|
}; |
|
} |
|
function G(a) { |
|
l.done(l.async(a)()); |
|
} |
|
function H(a) { |
|
throw new T(a); |
|
} |
|
function I(a) { |
|
return function() { |
|
return E([ this, K(arguments) ], function(b, c) { |
|
return a.apply(b, c); |
|
}); |
|
}; |
|
} |
|
function J(a, b, c) { |
|
return l(a).dispatch(b, c); |
|
} |
|
function K(a) { |
|
return q(a, function(a) { |
|
var b = 0, c = m(); |
|
return Z(a, function(d, e, f) { |
|
var g; |
|
s(e) && "fulfilled" === (g = e.inspect()).state ? a[f] = g.value : (++b, q(e, function(d) { |
|
a[f] = d, 0 === --b && c.resolve(a); |
|
}, c.reject, function(a) { |
|
c.notify({ |
|
index: f, |
|
value: a |
|
}); |
|
})); |
|
}, void 0), 0 === b && c.resolve(a), c.promise; |
|
}); |
|
} |
|
function L(a) { |
|
if (0 === a.length) return l.resolve(); |
|
var b = l.defer(), c = 0; |
|
return Z(a, function(d, e, f) { |
|
function g(a) { |
|
b.resolve(a); |
|
} |
|
function h() { |
|
c--, 0 === c && b.reject(new Error("Can't get fulfillment value from any promise, all promises were rejected.")); |
|
} |
|
function i(a) { |
|
b.notify({ |
|
index: f, |
|
value: a |
|
}); |
|
} |
|
var j = a[f]; |
|
c++, q(j, g, h, i); |
|
}, void 0), b.promise; |
|
} |
|
function M(a) { |
|
return q(a, function(a) { |
|
return a = _(a, l), q(K(_(a, function(a) { |
|
return q(a, V, V); |
|
})), function() { |
|
return a; |
|
}); |
|
}); |
|
} |
|
function N(a) { |
|
return l(a).allSettled(); |
|
} |
|
function O(a, b) { |
|
return l(a).then(void 0, void 0, b); |
|
} |
|
function P(a, b) { |
|
return l(a).nodeify(b); |
|
} |
|
var Q = !1; |
|
try { |
|
throw new Error(); |
|
} catch (R) { |
|
Q = !!R.stack; |
|
} |
|
var S, T, U = j(), V = function() {}, W = function() { |
|
function b() { |
|
for (var a, b; d.next; ) d = d.next, a = d.task, d.task = void 0, b = d.domain, |
|
b && (d.domain = void 0, b.enter()), c(a, b); |
|
for (;i.length; ) a = i.pop(), c(a); |
|
f = !1; |
|
} |
|
function c(a, c) { |
|
try { |
|
a(); |
|
} catch (d) { |
|
if (h) throw c && c.exit(), setTimeout(b, 0), c && c.enter(), d; |
|
setTimeout(function() { |
|
throw d; |
|
}, 0); |
|
} |
|
c && c.exit(); |
|
} |
|
var d = { |
|
task: void 0, |
|
next: null |
|
}, e = d, f = !1, g = void 0, h = !1, i = []; |
|
if (W = function(b) { |
|
e = e.next = { |
|
task: b, |
|
domain: h && a.domain, |
|
next: null |
|
}, f || (f = !0, g()); |
|
}, "object" == typeof a && "[object process]" === a.toString() && a.nextTick) h = !0, |
|
g = function() { |
|
a.nextTick(b); |
|
}; else if ("function" == typeof setImmediate) g = "undefined" != typeof window ? setImmediate.bind(window, b) : function() { |
|
setImmediate(b); |
|
}; else if ("undefined" != typeof MessageChannel) { |
|
var j = new MessageChannel(); |
|
j.port1.onmessage = function() { |
|
g = k, j.port1.onmessage = b, b(); |
|
}; |
|
var k = function() { |
|
j.port2.postMessage(0); |
|
}; |
|
g = function() { |
|
setTimeout(b, 0), k(); |
|
}; |
|
} else g = function() { |
|
setTimeout(b, 0); |
|
}; |
|
return W.runAfter = function(a) { |
|
i.push(a), f || (f = !0, g()); |
|
}, W; |
|
}(), X = Function.call, Y = b(Array.prototype.slice), Z = b(Array.prototype.reduce || function(a, b) { |
|
var c = 0, d = this.length; |
|
if (1 === arguments.length) for (;;) { |
|
if (c in this) { |
|
b = this[c++]; |
|
break; |
|
} |
|
if (++c >= d) throw new TypeError(); |
|
} |
|
for (;d > c; c++) c in this && (b = a(b, this[c], c)); |
|
return b; |
|
}), $ = b(Array.prototype.indexOf || function(a) { |
|
for (var b = 0; b < this.length; b++) if (this[b] === a) return b; |
|
return -1; |
|
}), _ = b(Array.prototype.map || function(a, b) { |
|
var c = this, d = []; |
|
return Z(c, function(e, f, g) { |
|
d.push(a.call(b, f, g, c)); |
|
}, void 0), d; |
|
}), aa = Object.create || function(a) { |
|
function b() {} |
|
return b.prototype = a, new b(); |
|
}, ba = b(Object.prototype.hasOwnProperty), ca = Object.keys || function(a) { |
|
var b = []; |
|
for (var c in a) ba(a, c) && b.push(c); |
|
return b; |
|
}, da = b(Object.prototype.toString); |
|
T = "undefined" != typeof ReturnValue ? ReturnValue : function(a) { |
|
this.value = a; |
|
}; |
|
var ea = "From previous event:"; |
|
l.resolve = l, l.nextTick = W, l.longStackSupport = !1, "object" == typeof a && a && a.env && a.env.Q_DEBUG && (l.longStackSupport = !0), |
|
l.defer = m, m.prototype.makeNodeResolver = function() { |
|
var a = this; |
|
return function(b, c) { |
|
b ? a.reject(b) : arguments.length > 2 ? a.resolve(Y(arguments, 1)) : a.resolve(c); |
|
}; |
|
}, l.Promise = n, l.promise = n, n.race = o, n.all = K, n.reject = A, n.resolve = l, |
|
l.passByCopy = function(a) { |
|
return a; |
|
}, p.prototype.passByCopy = function() { |
|
return this; |
|
}, l.join = function(a, b) { |
|
return l(a).join(b); |
|
}, p.prototype.join = function(a) { |
|
return l([ this, a ]).spread(function(a, b) { |
|
if (a === b) return a; |
|
throw new Error("Can't join: not the same: " + a + " " + b); |
|
}); |
|
}, l.race = o, p.prototype.race = function() { |
|
return this.then(l.race); |
|
}, l.makePromise = p, p.prototype.toString = function() { |
|
return "[object Promise]"; |
|
}, p.prototype.then = function(a, b, c) { |
|
function d(b) { |
|
try { |
|
return "function" == typeof a ? a(b) : b; |
|
} catch (c) { |
|
return A(c); |
|
} |
|
} |
|
function f(a) { |
|
if ("function" == typeof b) { |
|
e(a, h); |
|
try { |
|
return b(a); |
|
} catch (c) { |
|
return A(c); |
|
} |
|
} |
|
return A(a); |
|
} |
|
function g(a) { |
|
return "function" == typeof c ? c(a) : a; |
|
} |
|
var h = this, i = m(), j = !1; |
|
return l.nextTick(function() { |
|
h.promiseDispatch(function(a) { |
|
j || (j = !0, i.resolve(d(a))); |
|
}, "when", [ function(a) { |
|
j || (j = !0, i.resolve(f(a))); |
|
} ]); |
|
}), h.promiseDispatch(void 0, "when", [ void 0, function(a) { |
|
var b, c = !1; |
|
try { |
|
b = g(a); |
|
} catch (d) { |
|
if (c = !0, !l.onerror) throw d; |
|
l.onerror(d); |
|
} |
|
c || i.notify(b); |
|
} ]), i.promise; |
|
}, l.tap = function(a, b) { |
|
return l(a).tap(b); |
|
}, p.prototype.tap = function(a) { |
|
return a = l(a), this.then(function(b) { |
|
return a.fcall(b).thenResolve(b); |
|
}); |
|
}, l.when = q, p.prototype.thenResolve = function(a) { |
|
return this.then(function() { |
|
return a; |
|
}); |
|
}, l.thenResolve = function(a, b) { |
|
return l(a).thenResolve(b); |
|
}, p.prototype.thenReject = function(a) { |
|
return this.then(function() { |
|
throw a; |
|
}); |
|
}, l.thenReject = function(a, b) { |
|
return l(a).thenReject(b); |
|
}, l.nearer = r, l.isPromise = s, l.isPromiseAlike = t, l.isPending = u, p.prototype.isPending = function() { |
|
return "pending" === this.inspect().state; |
|
}, l.isFulfilled = v, p.prototype.isFulfilled = function() { |
|
return "fulfilled" === this.inspect().state; |
|
}, l.isRejected = w, p.prototype.isRejected = function() { |
|
return "rejected" === this.inspect().state; |
|
}; |
|
var fa = [], ga = [], ha = [], ia = !0; |
|
l.resetUnhandledRejections = x, l.getUnhandledReasons = function() { |
|
return fa.slice(); |
|
}, l.stopUnhandledRejectionTracking = function() { |
|
x(), ia = !1; |
|
}, x(), l.reject = A, l.fulfill = B, l.master = D, l.spread = E, p.prototype.spread = function(a, b) { |
|
return this.all().then(function(b) { |
|
return a.apply(void 0, b); |
|
}, b); |
|
}, l.async = F, l.spawn = G, l["return"] = H, l.promised = I, l.dispatch = J, p.prototype.dispatch = function(a, b) { |
|
var c = this, d = m(); |
|
return l.nextTick(function() { |
|
c.promiseDispatch(d.resolve, a, b); |
|
}), d.promise; |
|
}, l.get = function(a, b) { |
|
return l(a).dispatch("get", [ b ]); |
|
}, p.prototype.get = function(a) { |
|
return this.dispatch("get", [ a ]); |
|
}, l.set = function(a, b, c) { |
|
return l(a).dispatch("set", [ b, c ]); |
|
}, p.prototype.set = function(a, b) { |
|
return this.dispatch("set", [ a, b ]); |
|
}, l.del = l["delete"] = function(a, b) { |
|
return l(a).dispatch("delete", [ b ]); |
|
}, p.prototype.del = p.prototype["delete"] = function(a) { |
|
return this.dispatch("delete", [ a ]); |
|
}, l.mapply = l.post = function(a, b, c) { |
|
return l(a).dispatch("post", [ b, c ]); |
|
}, p.prototype.mapply = p.prototype.post = function(a, b) { |
|
return this.dispatch("post", [ a, b ]); |
|
}, l.send = l.mcall = l.invoke = function(a, b) { |
|
return l(a).dispatch("post", [ b, Y(arguments, 2) ]); |
|
}, p.prototype.send = p.prototype.mcall = p.prototype.invoke = function(a) { |
|
return this.dispatch("post", [ a, Y(arguments, 1) ]); |
|
}, l.fapply = function(a, b) { |
|
return l(a).dispatch("apply", [ void 0, b ]); |
|
}, p.prototype.fapply = function(a) { |
|
return this.dispatch("apply", [ void 0, a ]); |
|
}, l["try"] = l.fcall = function(a) { |
|
return l(a).dispatch("apply", [ void 0, Y(arguments, 1) ]); |
|
}, p.prototype.fcall = function() { |
|
return this.dispatch("apply", [ void 0, Y(arguments) ]); |
|
}, l.fbind = function(a) { |
|
var b = l(a), c = Y(arguments, 1); |
|
return function() { |
|
return b.dispatch("apply", [ this, c.concat(Y(arguments)) ]); |
|
}; |
|
}, p.prototype.fbind = function() { |
|
var a = this, b = Y(arguments); |
|
return function() { |
|
return a.dispatch("apply", [ this, b.concat(Y(arguments)) ]); |
|
}; |
|
}, l.keys = function(a) { |
|
return l(a).dispatch("keys", []); |
|
}, p.prototype.keys = function() { |
|
return this.dispatch("keys", []); |
|
}, l.all = K, p.prototype.all = function() { |
|
return K(this); |
|
}, l.any = L, p.prototype.any = function() { |
|
return L(this); |
|
}, l.allResolved = k(M, "allResolved", "allSettled"), p.prototype.allResolved = function() { |
|
return M(this); |
|
}, l.allSettled = N, p.prototype.allSettled = function() { |
|
return this.then(function(a) { |
|
return K(_(a, function(a) { |
|
function b() { |
|
return a.inspect(); |
|
} |
|
return a = l(a), a.then(b, b); |
|
})); |
|
}); |
|
}, l.fail = l["catch"] = function(a, b) { |
|
return l(a).then(void 0, b); |
|
}, p.prototype.fail = p.prototype["catch"] = function(a) { |
|
return this.then(void 0, a); |
|
}, l.progress = O, p.prototype.progress = function(a) { |
|
return this.then(void 0, void 0, a); |
|
}, l.fin = l["finally"] = function(a, b) { |
|
return l(a)["finally"](b); |
|
}, p.prototype.fin = p.prototype["finally"] = function(a) { |
|
return a = l(a), this.then(function(b) { |
|
return a.fcall().then(function() { |
|
return b; |
|
}); |
|
}, function(b) { |
|
return a.fcall().then(function() { |
|
throw b; |
|
}); |
|
}); |
|
}, l.done = function(a, b, c, d) { |
|
return l(a).done(b, c, d); |
|
}, p.prototype.done = function(b, c, d) { |
|
var f = function(a) { |
|
l.nextTick(function() { |
|
if (e(a, g), !l.onerror) throw a; |
|
l.onerror(a); |
|
}); |
|
}, g = b || c || d ? this.then(b, c, d) : this; |
|
"object" == typeof a && a && a.domain && (f = a.domain.bind(f)), g.then(void 0, f); |
|
}, l.timeout = function(a, b, c) { |
|
return l(a).timeout(b, c); |
|
}, p.prototype.timeout = function(a, b) { |
|
var c = m(), d = setTimeout(function() { |
|
b && "string" != typeof b || (b = new Error(b || "Timed out after " + a + " ms"), |
|
b.code = "ETIMEDOUT"), c.reject(b); |
|
}, a); |
|
return this.then(function(a) { |
|
clearTimeout(d), c.resolve(a); |
|
}, function(a) { |
|
clearTimeout(d), c.reject(a); |
|
}, c.notify), c.promise; |
|
}, l.delay = function(a, b) { |
|
return void 0 === b && (b = a, a = void 0), l(a).delay(b); |
|
}, p.prototype.delay = function(a) { |
|
return this.then(function(b) { |
|
var c = m(); |
|
return setTimeout(function() { |
|
c.resolve(b); |
|
}, a), c.promise; |
|
}); |
|
}, l.nfapply = function(a, b) { |
|
return l(a).nfapply(b); |
|
}, p.prototype.nfapply = function(a) { |
|
var b = m(), c = Y(a); |
|
return c.push(b.makeNodeResolver()), this.fapply(c).fail(b.reject), b.promise; |
|
}, l.nfcall = function(a) { |
|
var b = Y(arguments, 1); |
|
return l(a).nfapply(b); |
|
}, p.prototype.nfcall = function() { |
|
var a = Y(arguments), b = m(); |
|
return a.push(b.makeNodeResolver()), this.fapply(a).fail(b.reject), b.promise; |
|
}, l.nfbind = l.denodeify = function(a) { |
|
var b = Y(arguments, 1); |
|
return function() { |
|
var c = b.concat(Y(arguments)), d = m(); |
|
return c.push(d.makeNodeResolver()), l(a).fapply(c).fail(d.reject), d.promise; |
|
}; |
|
}, p.prototype.nfbind = p.prototype.denodeify = function() { |
|
var a = Y(arguments); |
|
return a.unshift(this), l.denodeify.apply(void 0, a); |
|
}, l.nbind = function(a, b) { |
|
var c = Y(arguments, 2); |
|
return function() { |
|
function d() { |
|
return a.apply(b, arguments); |
|
} |
|
var e = c.concat(Y(arguments)), f = m(); |
|
return e.push(f.makeNodeResolver()), l(d).fapply(e).fail(f.reject), f.promise; |
|
}; |
|
}, p.prototype.nbind = function() { |
|
var a = Y(arguments, 0); |
|
return a.unshift(this), l.nbind.apply(void 0, a); |
|
}, l.nmapply = l.npost = function(a, b, c) { |
|
return l(a).npost(b, c); |
|
}, p.prototype.nmapply = p.prototype.npost = function(a, b) { |
|
var c = Y(b || []), d = m(); |
|
return c.push(d.makeNodeResolver()), this.dispatch("post", [ a, c ]).fail(d.reject), |
|
d.promise; |
|
}, l.nsend = l.nmcall = l.ninvoke = function(a, b) { |
|
var c = Y(arguments, 2), d = m(); |
|
return c.push(d.makeNodeResolver()), l(a).dispatch("post", [ b, c ]).fail(d.reject), |
|
d.promise; |
|
}, p.prototype.nsend = p.prototype.nmcall = p.prototype.ninvoke = function(a) { |
|
var b = Y(arguments, 1), c = m(); |
|
return b.push(c.makeNodeResolver()), this.dispatch("post", [ a, b ]).fail(c.reject), |
|
c.promise; |
|
}, l.nodeify = P, p.prototype.nodeify = function(a) { |
|
return a ? void this.then(function(b) { |
|
l.nextTick(function() { |
|
a(null, b); |
|
}); |
|
}, function(b) { |
|
l.nextTick(function() { |
|
a(b); |
|
}); |
|
}) : this; |
|
}, l.noConflict = function() { |
|
throw new Error("Q.noConflict only works when Q is used as a global"); |
|
}; |
|
var ja = j(); |
|
return l; |
|
}); |
|
}).call(this, a("_process")); |
|
}, { |
|
_process: 142 |
|
} ], |
|
34: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a) { |
|
return 50 * a.x + a.y; |
|
} |
|
function e(a) { |
|
return new J(Math.floor(a / 50), a % 50, C); |
|
} |
|
function f(a, b) { |
|
var c = new J(a.x, a.y, a.roomName); |
|
switch (b) { |
|
case q.TOP_LEFT: |
|
case q.TOP: |
|
case q.TOP_RIGHT: |
|
--c.y; |
|
break; |
|
|
|
case q.BOTTOM_LEFT: |
|
case q.BOTTOM: |
|
case q.BOTTOM_RIGHT: |
|
++c.y; |
|
} |
|
switch (b) { |
|
case q.TOP_LEFT: |
|
case q.LEFT: |
|
case q.BOTTOM_LEFT: |
|
--c.x; |
|
break; |
|
|
|
case q.TOP_RIGHT: |
|
case q.RIGHT: |
|
case q.BOTTOM_RIGHT: |
|
++c.x; |
|
} |
|
return c; |
|
} |
|
function g(a) { |
|
if (a.x < 0 || a.x > 49 || a.y < 0 || a.y > 49) return 1 / 0; |
|
if (B) { |
|
var b = B.get(a.x, a.y); |
|
if (b) return 255 === b ? 1 / 0 : b; |
|
} |
|
switch (A[50 * a.y + a.x]) { |
|
case 0: |
|
return D; |
|
|
|
case 1: |
|
case 3: |
|
return 1 / 0; |
|
|
|
case 2: |
|
return E; |
|
} |
|
} |
|
function h(a) { |
|
if (y) { |
|
for (var b = 0, c = 0; c < z.length; ++c) b = Math.max(b, z[c].range - a.getRangeTo(z[c].pos)); |
|
return b; |
|
} |
|
for (var b = 1 / 0, c = 0; c < z.length; ++c) b = Math.min(b, Math.max(0, a.getRangeTo(z[c].pos) - z[c].range)); |
|
return b; |
|
} |
|
function i(a, b, c) { |
|
for (var e = q.TOP; e <= q.TOP_LEFT; ++e) { |
|
var i = f(b, e); |
|
if ((0 !== b.x && 49 !== b.x || b.x !== i.x) && (0 !== b.y && 49 !== b.y || b.y !== i.y)) { |
|
var j = g(i); |
|
if (j !== 1 / 0) { |
|
var k = d(i); |
|
if (!H.isClosed(k)) { |
|
var l = Math.floor(h(i) * F), m = l + c + j; |
|
H.isOpen(k) ? G.priority(k) > m && (G.update(k, m), I[k] = a) : (G.push(k, m), H.open(k), |
|
I[k] = a); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
function j(a, b, c) { |
|
for (var d = g(new J(b.x, b.y - 1, b.roomName)), e = g(new J(b.x, b.y + 1, b.roomName)); ;) { |
|
if (0 == h(b)) return b; |
|
var f = g(new J(b.x + c, b.y - 1, b.roomName)), i = g(new J(b.x + c, b.y + 1, b.roomName)); |
|
if (f !== 1 / 0 && d != a || i !== 1 / 0 && e != a) return b; |
|
d = f, e = i, b.x += c; |
|
var j = g(b); |
|
if (j === 1 / 0) return; |
|
if (j !== a) return b; |
|
} |
|
} |
|
function k(a, b, c) { |
|
for (var d = g(new J(b.x - 1, b.y, b.roomName)), e = g(new J(b.x + 1, b.y, b.roomName)); ;) { |
|
if (0 == h(b)) return b; |
|
var f = g(new J(b.x - 1, b.y + c, b.roomName)), i = g(new J(b.x + 1, b.y + c, b.roomName)); |
|
if (f !== 1 / 0 && d !== a || i !== 1 / 0 && e !== a) return b; |
|
d = f, e = i, b.y += c; |
|
var j = g(b); |
|
if (j === 1 / 0) return; |
|
if (j !== a) return b; |
|
} |
|
} |
|
function l(a, b, c, d) { |
|
for (var e = g(new J(b.x - c, b.y, b.roomName)), f = g(new J(b.x, b.y - d, b.roomName)); ;) { |
|
if (0 == h(b)) return b; |
|
if (g(new J(b.x - c, b.y + d, b.roomName)) !== 1 / 0 && e !== a || g(new J(b.x + c, b.y - d, b.roomName)) !== 1 / 0 && f !== a) return b; |
|
if (e = g(new J(b.x, b.y + d, b.roomName)), f = g(new J(b.x + c, b.y, b.roomName)), |
|
f !== 1 / 0 && void 0 !== j(a, new J(b.x + c, b.y, b.roomName), c) || e !== 1 / 0 && void 0 !== k(a, new J(b.x, b.y + d, b.roomName), d)) return b; |
|
b.x += c, b.y += d; |
|
var i = g(b); |
|
if (i === 1 / 0) return; |
|
if (i !== a) return b; |
|
} |
|
} |
|
function m(a, b, c, d) { |
|
return 0 !== c ? 0 !== d ? l(a, b, c, d) : j(a, b, c) : k(a, b, d); |
|
} |
|
function n(a, b, c) { |
|
var f = e(I[a]), i = b.x > f.x ? 1 : b.x < f.x ? -1 : 0, j = b.y > f.y ? 1 : b.y < f.y ? -1 : 0, k = []; |
|
if (0 === b.x) { |
|
if (-1 === i) return; |
|
1 === i && (k.push(new J(b.x + 1, b.y - 1, b.roomName)), k.push(new J(b.x + 1, b.y, b.roomName)), |
|
k.push(new J(b.x + 1, b.y + 1, b.roomName))); |
|
} else if (49 == b.x) { |
|
if (1 === i) return; |
|
-1 === i && (k.push(new J(b.x - 1, b.y - 1, b.roomName)), k.push(new J(b.x - 1, b.y, b.roomName)), |
|
k.push(new J(b.x - 1, b.y + 1, b.roomName))); |
|
} else if (0 === b.y) { |
|
if (-1 === j) return; |
|
1 === j && (k.push(new J(b.x - 1, b.y + 1, b.roomName)), k.push(new J(b.x, b.y + 1, b.roomName)), |
|
k.push(new J(b.x + 1, b.y + 1, b.roomName))); |
|
} else if (49 === b.y) { |
|
if (1 === j) return; |
|
-1 === j && (k.push(new J(b.x - 1, b.y - 1, b.roomName)), k.push(new J(b.x, b.y - 1, b.roomName)), |
|
k.push(new J(b.x + 1, b.y - 1, b.roomName))); |
|
} |
|
if (0 === k.length) { |
|
var l = g(b); |
|
if (0 !== i) if (0 !== j) { |
|
var m = new J(b.x, b.y + j, b.roomName), n = g(m); |
|
n !== 1 / 0 && o(b, a, m, c, l, n), m = new J(b.x + i, b.y, b.roomName), n = g(m), |
|
n !== 1 / 0 && o(b, a, m, c, l, n), m = new J(b.x + i, b.y + j, b.roomName), n = g(m), |
|
n !== 1 / 0 && o(b, a, m, c, l, n), g(new J(b.x - i, b.y, b.roomName)) !== l && o(b, a, new J(b.x - i, b.y + j, b.roomName), c, l, g(new J(b.x - i, b.y + j, b.roomName))), |
|
g(new J(b.x, b.y - j, b.roomName)) !== l && o(b, a, new J(b.x + i, b.y - j, b.roomName), c, l, g(new J(b.x + i, b.y - j, b.roomName))); |
|
} else { |
|
var m = new J(b.x + i, b.y, b.roomName), n = g(m); |
|
n !== 1 / 0 && o(b, a, m, c, l, n), g(new J(b.x, b.y + 1, b.roomName)) !== l && o(b, a, new J(b.x + i, b.y + 1, b.roomName), c, l, g(new J(b.x + i, b.y + 1, b.roomName))), |
|
g(new J(b.x, b.y - 1, b.roomName)) !== l && o(b, a, new J(b.x + i, b.y - 1, b.roomName), c, l, g(new J(b.x + i, b.y - 1, b.roomName))); |
|
} else { |
|
var m = new J(b.x, b.y + j, b.roomName), n = g(m); |
|
n !== 1 / 0 && o(b, a, m, c, l, n), g(new J(b.x + 1, b.y, b.roomName)) !== l && o(b, a, new J(b.x + 1, b.y + j, b.roomName), c, l, g(new J(b.x + 1, b.y + j, b.roomName))), |
|
g(new J(b.x - 1, b.y, b.roomName)) !== l && o(b, a, new J(b.x - 1, b.y + j, b.roomName), c, l, g(new J(b.x - 1, b.y + j, b.roomName))); |
|
} |
|
} else for (var p = 0; p < k.length; ++p) { |
|
var n = g(k[p]); |
|
if (n !== 1 / 0) { |
|
var q = d(k[p]); |
|
if (!H.isClosed(q)) { |
|
var r = Math.floor(h(k[p]) * F), s = r + c + n; |
|
H.isOpen(q) ? G.priority(q) > s && (G.update(q, s), I[q] = a) : (G.push(q, s), H.open(q), |
|
I[q] = a); |
|
} |
|
} |
|
} |
|
} |
|
function o(a, b, c, e, f, i) { |
|
var j = void 0, k = void 0; |
|
if (i !== f) { |
|
if (i === 1 / 0) return; |
|
j = d(c), k = e + i + Math.floor(h(c) * F); |
|
} else { |
|
if (c = m(i, c, c.x - a.x, c.y - a.y), void 0 === c) return; |
|
j = d(c), k = e + i * (a.getRangeTo(c) - 1) + g(c) + Math.floor(h(c) * F); |
|
} |
|
H.isClosed(j) || (H.isOpen(j) ? G.priority(j) > k && (G.update(j, k), I[j] = b) : (G.push(j, k), |
|
H.open(j), I[j] = b)); |
|
} |
|
var p = a("lodash"), q = a("../game/constants"), r = a("../game/path-utils"), s = r.Heap, t = r.OpenClosed, u = void 0, v = void 0, w = void 0, x = void 0, y = void 0, z = void 0, A = void 0, B = void 0, C = void 0, D = void 0, E = void 0, F = void 0, G = void 0, H = void 0, I = void 0, J = void 0; |
|
c.make = function(a, b, c, d) { |
|
u = a, v = b, w = c, x = d, J = x.RoomPosition, H = new t(2500), G = new s(2500), |
|
I = new Uint16Array(2500); |
|
}, c.search = function(a, b, c) { |
|
c = c || {}, G.clear(), H.clear(), C = a.roomName, D = c.plainCost || 1, E = c.swampCost || 5, |
|
F = Math.min(9, Math.max(1, c.heuristicWeight || 1.2)), y = c.flee; |
|
var g = c.maxOps || 2e3, j = g; |
|
z = p.map(Array.isArray(b) ? b : [ b ], function(a) { |
|
return a instanceof J ? { |
|
range: 0, |
|
pos: a |
|
} : a; |
|
}), B = c.roomCallback ? c.roomCallback(a.roomName) : void 0, A = u.staticTerrainData[a.roomName]; |
|
var k = 1 / 0, l = 0; |
|
if (0 == h(a)) return { |
|
path: [], |
|
ops: 0 |
|
}; |
|
for (l = d(a), i(l, a, 0); G.size() && j > 0; ) { |
|
var m = G.min(), o = G.minPriority(); |
|
G.pop(), H.close(m); |
|
var q = e(m), r = Math.floor(h(q) * F), s = o - r; |
|
if (0 == r) { |
|
l = m, k = 0; |
|
break; |
|
} |
|
k > r && (l = m, k = r), n(m, q, s), --j; |
|
} |
|
for (var t = [], v = l, w = e(v); !w.isEqualTo(a); ) { |
|
t.push(w), v = I[v]; |
|
var x = e(v); |
|
if (x.getRangeTo(w) > 1) { |
|
var K = w.getDirectionTo(x); |
|
do w = f(w, K), t.push(w); while (w.getRangeTo(x) > 1); |
|
} |
|
w = x; |
|
} |
|
return { |
|
path: t.reverse(), |
|
ops: g - j |
|
}; |
|
}; |
|
}, { |
|
"../game/constants": 40, |
|
"../game/path-utils": 52, |
|
lodash: 32 |
|
} ], |
|
35: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("q"), e = a("./local-storage"), f = a("./config"); |
|
c.create = function(a) { |
|
return e.put(f.localStorage.PENDING_QUEUE + a, []), e.put(f.localStorage.PROCESSING_QUEUE + a, []), |
|
{ |
|
fetch: function() { |
|
function b() { |
|
var d; |
|
e.get(f.localStorage.PENDING_QUEUE + a).then(function(g) { |
|
return 0 == g.length ? void setTimeout(b, 50) : (d = g.pop(), void e.get(f.localStorage.PROCESSING_QUEUE + a).then(function(b) { |
|
return b.push(d), e.put(f.localStorage.PROCESSING_QUEUE + a, b); |
|
}).then(function() { |
|
return e.put(f.localStorage.PENDING_QUEUE + a, g); |
|
}).then(function() { |
|
return c.resolve(d); |
|
})); |
|
}); |
|
} |
|
var c = d.defer(); |
|
return b(), c.promise; |
|
}, |
|
markDone: function(b) { |
|
return e.get(f.localStorage.PROCESSING_QUEUE + a).then(function(c) { |
|
var d = c.indexOf(b); |
|
if (-1 != d) return c.splice(d, 1), e.put(f.localStorage.PROCESSING_QUEUE + a, c); |
|
}); |
|
}, |
|
add: function(b) { |
|
return e.get(f.localStorage.PENDING_QUEUE + a).then(function(c) { |
|
return c.push(b), e.put(f.localStorage.PENDING_QUEUE + a, c); |
|
}); |
|
}, |
|
addMulti: function(b) { |
|
return e.get(f.localStorage.PENDING_QUEUE + a).then(function(c) { |
|
return c = c.concat(b), e.put(f.localStorage.PENDING_QUEUE + a, c); |
|
}); |
|
}, |
|
whenAllDone: function() { |
|
var b = d.defer(), c = function g() { |
|
d.all([ e.get(f.localStorage.PROCESSING_QUEUE + a), e.get(f.localStorage.PENDING_QUEUE + a) ]).then(function(a) { |
|
a[0].length > 0 || a[1].length > 0 ? setTimeout(g, 10) : b.resolve(); |
|
}); |
|
}; |
|
return c(), b.promise; |
|
} |
|
}; |
|
}; |
|
}, { |
|
"./config": 27, |
|
"./local-storage": 30, |
|
q: 33 |
|
} ], |
|
36: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = {}, f = {}; |
|
c.init = function(a, b) { |
|
a = "" + a, e[a] ? d.extend(e[a], b) : e[a] = b || {}; |
|
}, c.get = function(a) { |
|
return a = "" + a, e[a]; |
|
}, c.checkObsolete = function(a, b) { |
|
(!f[a] || b > f[a]) && (delete e[a], e[a] = null), f[a] = b; |
|
}; |
|
}, { |
|
lodash: 32 |
|
} ], |
|
37: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("../game/game"), e = a("../game/console"), f = a("lodash"), g = a("./runtime-user-globals"); |
|
self.onmessage = function(a) { |
|
var b, c = a.data, h = { |
|
list: {}, |
|
set: function(a, b, c) { |
|
this.list[a] = this.list[a] || {}, this.list[a][b] = c; |
|
}, |
|
push: function(a, b, c) { |
|
return this.list[a] = this.list[a] || [], this.list[a].length >= c ? !1 : (this.list[a].push(b), |
|
!0); |
|
}, |
|
pushByName: function(a, b, c, d) { |
|
return this.list[a] = this.list[a] || {}, this.list[a][b] = this.list[a][b] || [], |
|
d && this.list[a][b].length >= d ? !1 : (this.list[a][b].push(c), !0); |
|
}, |
|
remove: function(a, b) { |
|
return this.list[a][b] ? (delete this.list[a][b], !0) : !1; |
|
} |
|
}; |
|
if (c.user) { |
|
g.checkObsolete(c.user._id, c.userCodeTimestamp), g.init(c.user._id); |
|
var i = { |
|
get: function() { |
|
return c.userMemory; |
|
}, |
|
set: function(a) { |
|
if (!f.isString(a)) throw new Error("Raw memory value is not a string"); |
|
this._parsed && delete this._parsed, c.userMemory = a; |
|
} |
|
}; |
|
try { |
|
d.runCode(g.get(c.user._id), c.userCode, c, h, i, e.makeConsole(c.user._id), c.consoleCommands, 1 / 0, function() { |
|
return 0; |
|
}, function() {}), b = { |
|
type: "done" |
|
}; |
|
} catch (a) { |
|
b = { |
|
type: "error", |
|
error: f.isObject(a) && a.stack || a.toString() |
|
}; |
|
} |
|
b.intents = h.list, i._parsed && (c.userMemory = JSON.stringify(i._parsed)), b.memory = c.userMemory, |
|
b.console = { |
|
log: e.getMessages(c.user._id), |
|
results: e.getCommandResults(c.user._id) |
|
}, self.postMessage(b); |
|
} |
|
}; |
|
}, { |
|
"../game/console": 39, |
|
"../game/game": 44, |
|
"./runtime-user-globals": 36, |
|
lodash: 32 |
|
} ], |
|
38: [ function(a, b, c) { |
|
"use strict"; |
|
var d = {}, e = 0; |
|
c.create = function(a) { |
|
return self.postMessage({ |
|
type: "worker", |
|
workerId: e, |
|
startSrc: a |
|
}), d[e] = { |
|
postMessage: function(a) { |
|
self.postMessage({ |
|
type: "worker", |
|
workerId: e, |
|
message: a |
|
}); |
|
}, |
|
terminate: function() { |
|
self.postMessage({ |
|
type: "worker", |
|
workerId: e, |
|
terminate: !0 |
|
}); |
|
} |
|
}; |
|
}, c.handleMessage = function(a) { |
|
d[a.workerId] && d[a.workerId].onmessage({ |
|
target: d[a.workerId], |
|
data: a.message |
|
}); |
|
}; |
|
}, {} ], |
|
39: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = {}, f = {}; |
|
c.makeConsole = function(a) { |
|
return e[a] = [], f[a] = [], { |
|
log: function() { |
|
"undefined" != typeof self && self.navigator.userAgent && self.console.log.apply(console, arguments), |
|
e[a].push(d.map(arguments, function(a) { |
|
return a && a.toString ? a.toString() : "undefined" == typeof a ? "undefined" : JSON.stringify(a); |
|
}).join(" ")); |
|
}, |
|
commandResult: function(b) { |
|
"undefined" != typeof self && self.navigator.userAgent && self.console.log.call(console, b), |
|
f[a].push(String(b)); |
|
} |
|
}; |
|
}, c.getMessages = function(a) { |
|
var b = e[a]; |
|
return e[a] = [], b; |
|
}, c.getCommandResults = function(a) { |
|
var b = f[a]; |
|
return f[a] = [], b; |
|
}; |
|
}, { |
|
lodash: 60 |
|
} ], |
|
40: [ function(a, b, c) { |
|
"use strict"; |
|
b.exports = { |
|
OK: 0, |
|
ERR_NOT_OWNER: -1, |
|
ERR_NO_PATH: -2, |
|
ERR_NAME_EXISTS: -3, |
|
ERR_BUSY: -4, |
|
ERR_NOT_FOUND: -5, |
|
ERR_NOT_ENOUGH_ENERGY: -6, |
|
ERR_NOT_ENOUGH_RESOURCES: -6, |
|
ERR_INVALID_TARGET: -7, |
|
ERR_FULL: -8, |
|
ERR_NOT_IN_RANGE: -9, |
|
ERR_INVALID_ARGS: -10, |
|
ERR_TIRED: -11, |
|
ERR_NO_BODYPART: -12, |
|
ERR_NOT_ENOUGH_EXTENSIONS: -6, |
|
ERR_RCL_NOT_ENOUGH: -14, |
|
ERR_GCL_NOT_ENOUGH: -15, |
|
FIND_EXIT_TOP: 1, |
|
FIND_EXIT_RIGHT: 3, |
|
FIND_EXIT_BOTTOM: 5, |
|
FIND_EXIT_LEFT: 7, |
|
FIND_EXIT: 10, |
|
FIND_CREEPS: 101, |
|
FIND_MY_CREEPS: 102, |
|
FIND_HOSTILE_CREEPS: 103, |
|
FIND_SOURCES_ACTIVE: 104, |
|
FIND_SOURCES: 105, |
|
FIND_DROPPED_ENERGY: 106, |
|
FIND_DROPPED_RESOURCES: 106, |
|
FIND_STRUCTURES: 107, |
|
FIND_MY_STRUCTURES: 108, |
|
FIND_HOSTILE_STRUCTURES: 109, |
|
FIND_FLAGS: 110, |
|
FIND_CONSTRUCTION_SITES: 111, |
|
FIND_MY_SPAWNS: 112, |
|
FIND_HOSTILE_SPAWNS: 113, |
|
FIND_MY_CONSTRUCTION_SITES: 114, |
|
FIND_HOSTILE_CONSTRUCTION_SITES: 115, |
|
FIND_MINERALS: 116, |
|
FIND_NUKES: 117, |
|
TOP: 1, |
|
TOP_RIGHT: 2, |
|
RIGHT: 3, |
|
BOTTOM_RIGHT: 4, |
|
BOTTOM: 5, |
|
BOTTOM_LEFT: 6, |
|
LEFT: 7, |
|
TOP_LEFT: 8, |
|
COLOR_RED: 1, |
|
COLOR_PURPLE: 2, |
|
COLOR_BLUE: 3, |
|
COLOR_CYAN: 4, |
|
COLOR_GREEN: 5, |
|
COLOR_YELLOW: 6, |
|
COLOR_ORANGE: 7, |
|
COLOR_BROWN: 8, |
|
COLOR_GREY: 9, |
|
COLOR_WHITE: 10, |
|
LOOK_CREEPS: "creep", |
|
LOOK_ENERGY: "energy", |
|
LOOK_RESOURCES: "resource", |
|
LOOK_SOURCES: "source", |
|
LOOK_MINERALS: "mineral", |
|
LOOK_STRUCTURES: "structure", |
|
LOOK_FLAGS: "flag", |
|
LOOK_CONSTRUCTION_SITES: "constructionSite", |
|
LOOK_NUKES: "nuke", |
|
LOOK_TERRAIN: "terrain", |
|
OBSTACLE_OBJECT_TYPES: [ "spawn", "creep", "wall", "source", "constructedWall", "extension", "link", "storage", "tower", "observer", "powerSpawn", "powerBank", "lab", "terminal", "nuker" ], |
|
MOVE: "move", |
|
WORK: "work", |
|
CARRY: "carry", |
|
ATTACK: "attack", |
|
RANGED_ATTACK: "ranged_attack", |
|
TOUGH: "tough", |
|
HEAL: "heal", |
|
CLAIM: "claim", |
|
BODYPART_COST: { |
|
move: 50, |
|
work: 100, |
|
attack: 80, |
|
carry: 50, |
|
heal: 250, |
|
ranged_attack: 150, |
|
tough: 10, |
|
claim: 600 |
|
}, |
|
CREEP_LIFE_TIME: 1500, |
|
CREEP_CLAIM_LIFE_TIME: 500, |
|
CREEP_CORPSE_RATE: .2, |
|
CARRY_CAPACITY: 50, |
|
HARVEST_POWER: 2, |
|
HARVEST_MINERAL_POWER: 1, |
|
REPAIR_POWER: 100, |
|
DISMANTLE_POWER: 50, |
|
BUILD_POWER: 5, |
|
ATTACK_POWER: 30, |
|
UPGRADE_CONTROLLER_POWER: 1, |
|
RANGED_ATTACK_POWER: 10, |
|
HEAL_POWER: 12, |
|
RANGED_HEAL_POWER: 4, |
|
REPAIR_COST: .01, |
|
DISMANTLE_COST: .005, |
|
RAMPART_DECAY_AMOUNT: 300, |
|
RAMPART_DECAY_TIME: 100, |
|
RAMPART_HITS: 1, |
|
RAMPART_HITS_MAX: { |
|
2: 3e5, |
|
3: 1e6, |
|
4: 3e6, |
|
5: 1e7, |
|
6: 3e7, |
|
7: 1e8, |
|
8: 3e8 |
|
}, |
|
ENERGY_REGEN_TIME: 300, |
|
ENERGY_DECAY: 1e3, |
|
SPAWN_HITS: 5e3, |
|
SPAWN_ENERGY_START: 300, |
|
SPAWN_ENERGY_CAPACITY: 300, |
|
CREEP_SPAWN_TIME: 3, |
|
SOURCE_ENERGY_CAPACITY: 3e3, |
|
SOURCE_ENERGY_NEUTRAL_CAPACITY: 1500, |
|
SOURCE_ENERGY_KEEPER_CAPACITY: 4500, |
|
WALL_HITS: 1, |
|
WALL_HITS_MAX: 3e8, |
|
EXTENSION_HITS: 1e3, |
|
EXTENSION_ENERGY_CAPACITY: { |
|
0: 50, |
|
1: 50, |
|
2: 50, |
|
3: 50, |
|
4: 50, |
|
5: 50, |
|
6: 50, |
|
7: 100, |
|
8: 200 |
|
}, |
|
ROAD_HITS: 5e3, |
|
ROAD_WEAROUT: 1, |
|
ROAD_DECAY_AMOUNT: 100, |
|
ROAD_DECAY_TIME: 1e3, |
|
LINK_HITS: 1e3, |
|
LINK_HITS_MAX: 1e3, |
|
LINK_CAPACITY: 800, |
|
LINK_COOLDOWN: 1, |
|
LINK_LOSS_RATIO: .03, |
|
STORAGE_CAPACITY: 1e6, |
|
STORAGE_HITS: 1e4, |
|
STRUCTURE_SPAWN: "spawn", |
|
STRUCTURE_EXTENSION: "extension", |
|
STRUCTURE_ROAD: "road", |
|
STRUCTURE_WALL: "constructedWall", |
|
STRUCTURE_RAMPART: "rampart", |
|
STRUCTURE_KEEPER_LAIR: "keeperLair", |
|
STRUCTURE_PORTAL: "portal", |
|
STRUCTURE_CONTROLLER: "controller", |
|
STRUCTURE_LINK: "link", |
|
STRUCTURE_STORAGE: "storage", |
|
STRUCTURE_TOWER: "tower", |
|
STRUCTURE_OBSERVER: "observer", |
|
STRUCTURE_POWER_BANK: "powerBank", |
|
STRUCTURE_POWER_SPAWN: "powerSpawn", |
|
STRUCTURE_EXTRACTOR: "extractor", |
|
STRUCTURE_LAB: "lab", |
|
STRUCTURE_TERMINAL: "terminal", |
|
STRUCTURE_CONTAINER: "container", |
|
STRUCTURE_NUKER: "nuker", |
|
CONSTRUCTION_COST: { |
|
spawn: 15e3, |
|
extension: 3e3, |
|
road: 300, |
|
constructedWall: 1, |
|
rampart: 1, |
|
link: 5e3, |
|
storage: 3e4, |
|
tower: 5e3, |
|
observer: 8e3, |
|
powerSpawn: 1e5, |
|
extractor: 5e3, |
|
lab: 5e4, |
|
terminal: 1e5, |
|
container: 5e3, |
|
nuker: 1e5 |
|
}, |
|
CONSTRUCTION_COST_ROAD_SWAMP_RATIO: 5, |
|
CONTROLLER_LEVELS: { |
|
1: 200, |
|
2: 45e3, |
|
3: 135e3, |
|
4: 405e3, |
|
5: 1215e3, |
|
6: 3645e3, |
|
7: 10935e3 |
|
}, |
|
CONTROLLER_STRUCTURES: { |
|
spawn: { |
|
0: 0, |
|
1: 1, |
|
2: 1, |
|
3: 1, |
|
4: 1, |
|
5: 1, |
|
6: 1, |
|
7: 2, |
|
8: 3 |
|
}, |
|
extension: { |
|
0: 0, |
|
1: 0, |
|
2: 5, |
|
3: 10, |
|
4: 20, |
|
5: 30, |
|
6: 40, |
|
7: 50, |
|
8: 60 |
|
}, |
|
link: { |
|
1: 0, |
|
2: 0, |
|
3: 0, |
|
4: 0, |
|
5: 2, |
|
6: 3, |
|
7: 4, |
|
8: 6 |
|
}, |
|
road: { |
|
0: 2500, |
|
1: 2500, |
|
2: 2500, |
|
3: 2500, |
|
4: 2500, |
|
5: 2500, |
|
6: 2500, |
|
7: 2500, |
|
8: 2500 |
|
}, |
|
constructedWall: { |
|
1: 0, |
|
2: 2500, |
|
3: 2500, |
|
4: 2500, |
|
5: 2500, |
|
6: 2500, |
|
7: 2500, |
|
8: 2500 |
|
}, |
|
rampart: { |
|
1: 0, |
|
2: 2500, |
|
3: 2500, |
|
4: 2500, |
|
5: 2500, |
|
6: 2500, |
|
7: 2500, |
|
8: 2500 |
|
}, |
|
storage: { |
|
1: 0, |
|
2: 0, |
|
3: 0, |
|
4: 1, |
|
5: 1, |
|
6: 1, |
|
7: 1, |
|
8: 1 |
|
}, |
|
tower: { |
|
1: 0, |
|
2: 0, |
|
3: 1, |
|
4: 1, |
|
5: 2, |
|
6: 2, |
|
7: 3, |
|
8: 6 |
|
}, |
|
observer: { |
|
1: 0, |
|
2: 0, |
|
3: 0, |
|
4: 0, |
|
5: 0, |
|
6: 0, |
|
7: 0, |
|
8: 1 |
|
}, |
|
powerSpawn: { |
|
1: 0, |
|
2: 0, |
|
3: 0, |
|
4: 0, |
|
5: 0, |
|
6: 0, |
|
7: 0, |
|
8: 1 |
|
}, |
|
extractor: { |
|
1: 0, |
|
2: 0, |
|
3: 0, |
|
4: 0, |
|
5: 0, |
|
6: 1, |
|
7: 1, |
|
8: 1 |
|
}, |
|
terminal: { |
|
1: 0, |
|
2: 0, |
|
3: 0, |
|
4: 0, |
|
5: 0, |
|
6: 1, |
|
7: 1, |
|
8: 1 |
|
}, |
|
lab: { |
|
1: 0, |
|
2: 0, |
|
3: 0, |
|
4: 0, |
|
5: 0, |
|
6: 3, |
|
7: 6, |
|
8: 10 |
|
}, |
|
container: { |
|
0: 5, |
|
1: 5, |
|
2: 5, |
|
3: 5, |
|
4: 5, |
|
5: 5, |
|
6: 5, |
|
7: 5, |
|
8: 5 |
|
}, |
|
nuker: { |
|
1: 0, |
|
2: 0, |
|
3: 0, |
|
4: 0, |
|
5: 0, |
|
6: 0, |
|
7: 0, |
|
8: 1 |
|
} |
|
}, |
|
CONTROLLER_DOWNGRADE: { |
|
1: 2e4, |
|
2: 5e4, |
|
3: 5e4, |
|
4: 5e4, |
|
5: 5e4, |
|
6: 5e4, |
|
7: 5e4, |
|
8: 5e4 |
|
}, |
|
CONTROLLER_CLAIM_DOWNGRADE: .2, |
|
CONTROLLER_RESERVE: 1, |
|
CONTROLLER_RESERVE_MAX: 5e3, |
|
CONTROLLER_MAX_UPGRADE_PER_TICK: 15, |
|
CONTROLLER_ATTACK_BLOCKED_UPGRADE: 1e3, |
|
TOWER_HITS: 3e3, |
|
TOWER_CAPACITY: 1e3, |
|
TOWER_ENERGY_COST: 10, |
|
TOWER_POWER_ATTACK: 600, |
|
TOWER_POWER_HEAL: 400, |
|
TOWER_POWER_REPAIR: 800, |
|
TOWER_OPTIMAL_RANGE: 5, |
|
TOWER_FALLOFF_RANGE: 20, |
|
TOWER_FALLOFF: .75, |
|
OBSERVER_HITS: 500, |
|
OBSERVER_RANGE: 5, |
|
POWER_BANK_HITS: 2e6, |
|
POWER_BANK_CAPACITY_MAX: 5e3, |
|
POWER_BANK_CAPACITY_MIN: 500, |
|
POWER_BANK_CAPACITY_CRIT: .3, |
|
POWER_BANK_DECAY: 5e3, |
|
POWER_BANK_HIT_BACK: .5, |
|
POWER_SPAWN_HITS: 5e3, |
|
POWER_SPAWN_ENERGY_CAPACITY: 5e3, |
|
POWER_SPAWN_POWER_CAPACITY: 100, |
|
POWER_SPAWN_ENERGY_RATIO: 50, |
|
EXTRACTOR_HITS: 500, |
|
LAB_HITS: 500, |
|
LAB_MINERAL_CAPACITY: 3e3, |
|
LAB_ENERGY_CAPACITY: 2e3, |
|
LAB_BOOST_ENERGY: 20, |
|
LAB_BOOST_MINERAL: 30, |
|
LAB_COOLDOWN: 10, |
|
GCL_POW: 2.4, |
|
GCL_MULTIPLY: 1e6, |
|
GCL_NOVICE: 3, |
|
MODE_SIMULATION: "simulation", |
|
MODE_SURVIVAL: "survival", |
|
MODE_WORLD: "world", |
|
MODE_ARENA: "arena", |
|
TERRAIN_MASK_WALL: 1, |
|
TERRAIN_MASK_SWAMP: 2, |
|
TERRAIN_MASK_LAVA: 4, |
|
MAX_CONSTRUCTION_SITES: 100, |
|
MAX_CREEP_SIZE: 50, |
|
MINERAL_REGEN_TIME: 5e4, |
|
MINERAL_MIN_AMOUNT: { |
|
H: 14e4, |
|
O: 14e4, |
|
L: 7e4, |
|
K: 7e4, |
|
Z: 7e4, |
|
U: 7e4, |
|
X: 7e4 |
|
}, |
|
MINERAL_RANDOM_FACTOR: 2, |
|
TERMINAL_CAPACITY: 3e5, |
|
TERMINAL_HITS: 3e3, |
|
TERMINAL_SEND_COST: .1, |
|
TERMINAL_MIN_SEND: 100, |
|
CONTAINER_HITS: 25e4, |
|
CONTAINER_CAPACITY: 2e3, |
|
CONTAINER_DECAY: 5e3, |
|
CONTAINER_DECAY_TIME: 100, |
|
CONTAINER_DECAY_TIME_OWNED: 500, |
|
NUKER_HITS: 1e3, |
|
NUKER_COOLDOWN: 1e5, |
|
NUKER_ENERGY_CAPACITY: 2e5, |
|
NUKER_GHODIUM_CAPACITY: 5e3, |
|
NUKE_LAND_TIME: 5e4, |
|
NUKE_RANGE: 5, |
|
NUKE_DAMAGE: { |
|
0: 1e7, |
|
1: 1e6, |
|
4: 1e5 |
|
}, |
|
PORTAL_DECAY: 3e4, |
|
RESOURCE_ENERGY: "energy", |
|
RESOURCE_POWER: "power", |
|
RESOURCE_HYDROGEN: "H", |
|
RESOURCE_OXYGEN: "O", |
|
RESOURCE_UTRIUM: "U", |
|
RESOURCE_LEMERGIUM: "L", |
|
RESOURCE_KEANIUM: "K", |
|
RESOURCE_ZYNTHIUM: "Z", |
|
RESOURCE_CATALYST: "X", |
|
RESOURCE_GHODIUM: "G", |
|
RESOURCE_HYDROXIDE: "OH", |
|
RESOURCE_ZYNTHIUM_KEANITE: "ZK", |
|
RESOURCE_UTRIUM_LEMERGITE: "UL", |
|
RESOURCE_UTRIUM_HYDRIDE: "UH", |
|
RESOURCE_UTRIUM_OXIDE: "UO", |
|
RESOURCE_KEANIUM_HYDRIDE: "KH", |
|
RESOURCE_KEANIUM_OXIDE: "KO", |
|
RESOURCE_LEMERGIUM_HYDRIDE: "LH", |
|
RESOURCE_LEMERGIUM_OXIDE: "LO", |
|
RESOURCE_ZYNTHIUM_HYDRIDE: "ZH", |
|
RESOURCE_ZYNTHIUM_OXIDE: "ZO", |
|
RESOURCE_GHODIUM_HYDRIDE: "GH", |
|
RESOURCE_GHODIUM_OXIDE: "GO", |
|
RESOURCE_UTRIUM_ACID: "UH2O", |
|
RESOURCE_UTRIUM_ALKALIDE: "UHO2", |
|
RESOURCE_KEANIUM_ACID: "KH2O", |
|
RESOURCE_KEANIUM_ALKALIDE: "KHO2", |
|
RESOURCE_LEMERGIUM_ACID: "LH2O", |
|
RESOURCE_LEMERGIUM_ALKALIDE: "LHO2", |
|
RESOURCE_ZYNTHIUM_ACID: "ZH2O", |
|
RESOURCE_ZYNTHIUM_ALKALIDE: "ZHO2", |
|
RESOURCE_GHODIUM_ACID: "GH2O", |
|
RESOURCE_GHODIUM_ALKALIDE: "GHO2", |
|
RESOURCE_CATALYZED_UTRIUM_ACID: "XUH2O", |
|
RESOURCE_CATALYZED_UTRIUM_ALKALIDE: "XUHO2", |
|
RESOURCE_CATALYZED_KEANIUM_ACID: "XKH2O", |
|
RESOURCE_CATALYZED_KEANIUM_ALKALIDE: "XKHO2", |
|
RESOURCE_CATALYZED_LEMERGIUM_ACID: "XLH2O", |
|
RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE: "XLHO2", |
|
RESOURCE_CATALYZED_ZYNTHIUM_ACID: "XZH2O", |
|
RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE: "XZHO2", |
|
RESOURCE_CATALYZED_GHODIUM_ACID: "XGH2O", |
|
RESOURCE_CATALYZED_GHODIUM_ALKALIDE: "XGHO2", |
|
REACTIONS: { |
|
H: { |
|
O: "OH", |
|
L: "LH", |
|
K: "KH", |
|
U: "UH", |
|
Z: "ZH", |
|
G: "GH" |
|
}, |
|
O: { |
|
H: "OH", |
|
L: "LO", |
|
K: "KO", |
|
U: "UO", |
|
Z: "ZO", |
|
G: "GO" |
|
}, |
|
Z: { |
|
K: "ZK", |
|
H: "ZH", |
|
O: "ZO" |
|
}, |
|
L: { |
|
U: "UL", |
|
H: "LH", |
|
O: "LO" |
|
}, |
|
K: { |
|
Z: "ZK", |
|
H: "KH", |
|
O: "KO" |
|
}, |
|
G: { |
|
H: "GH", |
|
O: "GO" |
|
}, |
|
U: { |
|
L: "UL", |
|
H: "UH", |
|
O: "UO" |
|
}, |
|
OH: { |
|
UH: "UH2O", |
|
UO: "UHO2", |
|
ZH: "ZH2O", |
|
ZO: "ZHO2", |
|
KH: "KH2O", |
|
KO: "KHO2", |
|
LH: "LH2O", |
|
LO: "LHO2", |
|
GH: "GH2O", |
|
GO: "GHO2" |
|
}, |
|
X: { |
|
UH2O: "XUH2O", |
|
UHO2: "XUHO2", |
|
LH2O: "XLH2O", |
|
LHO2: "XLHO2", |
|
KH2O: "XKH2O", |
|
KHO2: "XKHO2", |
|
ZH2O: "XZH2O", |
|
ZHO2: "XZHO2", |
|
GH2O: "XGH2O", |
|
GHO2: "XGHO2" |
|
}, |
|
ZK: { |
|
UL: "G" |
|
}, |
|
UL: { |
|
ZK: "G" |
|
}, |
|
LH: { |
|
OH: "LH2O" |
|
}, |
|
ZH: { |
|
OH: "ZH2O" |
|
}, |
|
GH: { |
|
OH: "GH2O" |
|
}, |
|
KH: { |
|
OH: "KH2O" |
|
}, |
|
UH: { |
|
OH: "UH2O" |
|
}, |
|
LO: { |
|
OH: "LHO2" |
|
}, |
|
ZO: { |
|
OH: "ZHO2" |
|
}, |
|
KO: { |
|
OH: "KHO2" |
|
}, |
|
UO: { |
|
OH: "UHO2" |
|
}, |
|
GO: { |
|
OH: "GHO2" |
|
}, |
|
LH2O: { |
|
X: "XLH2O" |
|
}, |
|
KH2O: { |
|
X: "XKH2O" |
|
}, |
|
ZH2O: { |
|
X: "XZH2O" |
|
}, |
|
UH2O: { |
|
X: "XUH2O" |
|
}, |
|
GH2O: { |
|
X: "XGH2O" |
|
}, |
|
LHO2: { |
|
X: "XLHO2" |
|
}, |
|
UHO2: { |
|
X: "XUHO2" |
|
}, |
|
KHO2: { |
|
X: "XKHO2" |
|
}, |
|
ZHO2: { |
|
X: "XZHO2" |
|
}, |
|
GHO2: { |
|
X: "XGHO2" |
|
} |
|
}, |
|
BOOSTS: { |
|
work: { |
|
UO: { |
|
harvest: 2 |
|
}, |
|
UHO2: { |
|
harvest: 3 |
|
}, |
|
XUHO2: { |
|
harvest: 4 |
|
}, |
|
LH: { |
|
build: 1.3, |
|
repair: 1.3 |
|
}, |
|
LH2O: { |
|
build: 1.65, |
|
repair: 1.65 |
|
}, |
|
XLH2O: { |
|
build: 2, |
|
repair: 2 |
|
}, |
|
ZH: { |
|
dismantle: 2 |
|
}, |
|
ZH2O: { |
|
dismantle: 3 |
|
}, |
|
XZH2O: { |
|
dismantle: 4 |
|
}, |
|
GH: { |
|
upgradeController: 1.3 |
|
}, |
|
GH2O: { |
|
upgradeController: 1.65 |
|
}, |
|
XGH2O: { |
|
upgradeController: 2 |
|
} |
|
}, |
|
attack: { |
|
UH: { |
|
attack: 2 |
|
}, |
|
UH2O: { |
|
attack: 3 |
|
}, |
|
XUH2O: { |
|
attack: 4 |
|
} |
|
}, |
|
ranged_attack: { |
|
KO: { |
|
rangedAttack: 2, |
|
rangedMassAttack: 2 |
|
}, |
|
KHO2: { |
|
rangedAttack: 3, |
|
rangedMassAttack: 3 |
|
}, |
|
XKHO2: { |
|
rangedAttack: 4, |
|
rangedMassAttack: 4 |
|
} |
|
}, |
|
heal: { |
|
LO: { |
|
heal: 2, |
|
rangedHeal: 2 |
|
}, |
|
LHO2: { |
|
heal: 3, |
|
rangedHeal: 3 |
|
}, |
|
XLHO2: { |
|
heal: 4, |
|
rangedHeal: 4 |
|
} |
|
}, |
|
carry: { |
|
KH: { |
|
capacity: 2 |
|
}, |
|
KH2O: { |
|
capacity: 3 |
|
}, |
|
XKH2O: { |
|
capacity: 4 |
|
} |
|
}, |
|
move: { |
|
ZO: { |
|
fatigue: 2 |
|
}, |
|
ZHO2: { |
|
fatigue: 3 |
|
}, |
|
XZHO2: { |
|
fatigue: 4 |
|
} |
|
}, |
|
tough: { |
|
GO: { |
|
damage: .7 |
|
}, |
|
GHO2: { |
|
damage: .5 |
|
}, |
|
XGHO2: { |
|
damage: .3 |
|
} |
|
} |
|
} |
|
}, b.exports.BODYPARTS_ALL = [ b.exports.MOVE, b.exports.WORK, b.exports.CARRY, b.exports.ATTACK, b.exports.RANGED_ATTACK, b.exports.TOUGH, b.exports.HEAL, b.exports.CLAIM ], |
|
b.exports.RESOURCES_ALL = [ b.exports.RESOURCE_ENERGY, b.exports.RESOURCE_POWER, b.exports.RESOURCE_HYDROGEN, b.exports.RESOURCE_OXYGEN, b.exports.RESOURCE_UTRIUM, b.exports.RESOURCE_KEANIUM, b.exports.RESOURCE_LEMERGIUM, b.exports.RESOURCE_ZYNTHIUM, b.exports.RESOURCE_CATALYST, b.exports.RESOURCE_GHODIUM, b.exports.RESOURCE_HYDROXIDE, b.exports.RESOURCE_ZYNTHIUM_KEANITE, b.exports.RESOURCE_UTRIUM_LEMERGITE, b.exports.RESOURCE_UTRIUM_HYDRIDE, b.exports.RESOURCE_UTRIUM_OXIDE, b.exports.RESOURCE_KEANIUM_HYDRIDE, b.exports.RESOURCE_KEANIUM_OXIDE, b.exports.RESOURCE_LEMERGIUM_HYDRIDE, b.exports.RESOURCE_LEMERGIUM_OXIDE, b.exports.RESOURCE_ZYNTHIUM_HYDRIDE, b.exports.RESOURCE_ZYNTHIUM_OXIDE, b.exports.RESOURCE_GHODIUM_HYDRIDE, b.exports.RESOURCE_GHODIUM_OXIDE, b.exports.RESOURCE_UTRIUM_ACID, b.exports.RESOURCE_UTRIUM_ALKALIDE, b.exports.RESOURCE_KEANIUM_ACID, b.exports.RESOURCE_KEANIUM_ALKALIDE, b.exports.RESOURCE_LEMERGIUM_ACID, b.exports.RESOURCE_LEMERGIUM_ALKALIDE, b.exports.RESOURCE_ZYNTHIUM_ACID, b.exports.RESOURCE_ZYNTHIUM_ALKALIDE, b.exports.RESOURCE_GHODIUM_ACID, b.exports.RESOURCE_GHODIUM_ALKALIDE, b.exports.RESOURCE_CATALYZED_UTRIUM_ACID, b.exports.RESOURCE_CATALYZED_UTRIUM_ALKALIDE, b.exports.RESOURCE_CATALYZED_KEANIUM_ACID, b.exports.RESOURCE_CATALYZED_KEANIUM_ALKALIDE, b.exports.RESOURCE_CATALYZED_LEMERGIUM_ACID, b.exports.RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE, b.exports.RESOURCE_CATALYZED_ZYNTHIUM_ACID, b.exports.RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE, b.exports.RESOURCE_CATALYZED_GHODIUM_ACID, b.exports.RESOURCE_CATALYZED_GHODIUM_ALKALIDE ], |
|
b.exports.COLORS_ALL = [ b.exports.COLOR_RED, b.exports.COLOR_PURPLE, b.exports.COLOR_BLUE, b.exports.COLOR_CYAN, b.exports.COLOR_GREEN, b.exports.COLOR_YELLOW, b.exports.COLOR_ORANGE, b.exports.COLOR_BROWN, b.exports.COLOR_GREY, b.exports.COLOR_WHITE ]; |
|
}, {} ], |
|
41: [ function(a, b, c) { |
|
"use strict"; |
|
var d, e, f, g, h = a("./../utils"), i = (a("./rooms"), a("./constants")), j = a("lodash"); |
|
c.make = function(a, b, c, k) { |
|
if (d = a, e = b, f = c, g = k, !g.ConstructionSite) { |
|
var l = function(a) { |
|
if (!d.roomObjects[a]) throw new Error("Could not find an object with ID " + a); |
|
return d.roomObjects[a]; |
|
}, m = function(a) { |
|
var b = l(a); |
|
g.RoomObject.call(this, b.x, b.y, b.room), this.id = a; |
|
}; |
|
m.prototype = Object.create(g.RoomObject.prototype), m.prototype.constructor = m, |
|
h.defineGameObjectProperties(m.prototype, l, { |
|
progress: function(a) { |
|
return a.progress; |
|
}, |
|
progressTotal: function(a) { |
|
return a.progressTotal; |
|
}, |
|
structureType: function(a) { |
|
return a.structureType; |
|
}, |
|
name: function(a) { |
|
return a.name; |
|
}, |
|
owner: function(a) { |
|
return new Object({ |
|
username: d.users[a.user].username |
|
}); |
|
}, |
|
my: function(a) { |
|
return j.isUndefined(a.user) ? void 0 : a.user == d.user._id; |
|
} |
|
}), m.prototype.toString = function() { |
|
return "[construction site (" + l(this.id).structureType + ") #" + this.id + "]"; |
|
}, m.prototype.remove = function() { |
|
return this.my || this.room && this.room.controller && this.room.controller.my ? (e.set(this.id, "remove", {}), |
|
i.OK) : i.ERR_NOT_OWNER; |
|
}, g.ConstructionSite = m; |
|
} |
|
}; |
|
}, { |
|
"./../utils": 140, |
|
"./constants": 40, |
|
"./rooms": 54, |
|
lodash: 60 |
|
} ], |
|
42: [ function(a, b, c) { |
|
"use strict"; |
|
var d, e, f, g, h, i = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), j = a("./../utils"), k = (a("./rooms"), a("lodash")), l = a("./constants"); |
|
c.make = function(a, b, c, m) { |
|
if (d = a, e = b, f = c, g = m, h = 0, !g.Creep) { |
|
var n = function(a) { |
|
if (!d.roomObjects[a]) throw new Error("Could not find an object with ID " + a); |
|
return d.roomObjects[a]; |
|
}, o = function(a) { |
|
var b = n(a); |
|
g.RoomObject.call(this, b.x, b.y, b.room), this.id = a; |
|
}; |
|
o.prototype = Object.create(g.RoomObject.prototype), o.prototype.constructor = o, |
|
j.defineGameObjectProperties(o.prototype, n, { |
|
name: function(a) { |
|
return a.user == d.user._id ? a.name : void 0; |
|
}, |
|
body: function(a) { |
|
return a.body; |
|
}, |
|
my: function(a) { |
|
return a.user == d.user._id; |
|
}, |
|
owner: function(a) { |
|
return new Object({ |
|
username: d.users[a.user].username |
|
}); |
|
}, |
|
spawning: function(a) { |
|
return a.spawning; |
|
}, |
|
ticksToLive: function(a) { |
|
return a.ageTime ? a.ageTime - d.time : void 0; |
|
}, |
|
carryCapacity: function(a) { |
|
return a.energyCapacity; |
|
}, |
|
carry: function(a) { |
|
var b = { |
|
energy: a.energy |
|
}; |
|
return l.RESOURCES_ALL.forEach(function(c) { |
|
a[c] && (b[c] = a[c]); |
|
}), b; |
|
}, |
|
fatigue: function(a) { |
|
return a.fatigue; |
|
}, |
|
hits: function(a) { |
|
return a.hits; |
|
}, |
|
hitsMax: function(a) { |
|
return a.hitsMax; |
|
} |
|
}), Object.defineProperty(o.prototype, "memory", { |
|
get: function() { |
|
return this.my && ((k.isUndefined(g.Memory.creeps) || "undefined" === g.Memory.creeps) && (g.Memory.creeps = {}), |
|
k.isObject(g.Memory.creeps)) ? g.Memory.creeps[n(this.id).name] = g.Memory.creeps[n(this.id).name] || {} : void 0; |
|
}, |
|
set: function(a) { |
|
if (!this.my) throw new Error("Could not set other player's creep memory"); |
|
if ((k.isUndefined(g.Memory.creeps) || "undefined" === g.Memory.creeps) && (g.Memory.creeps = {}), |
|
!k.isObject(g.Memory.creeps)) throw new Error("Could not set creep memory"); |
|
g.Memory.creeps[n(this.id).name] = a; |
|
} |
|
}), o.prototype.toString = function() { |
|
return "[creep " + (n(this.id).user == d.user._id ? n(this.id).name : "#" + this.id) + "]"; |
|
}, o.prototype.move = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : n(this.id).fatigue > 0 ? l.ERR_TIRED : 0 == this.getActiveBodyparts(l.MOVE) ? l.ERR_NO_BODYPART : (e.set(this.id, "move", { |
|
direction: a |
|
}), l.OK) : l.ERR_NOT_OWNER; |
|
}, o.prototype.moveTo = function(a, b, c) { |
|
if (!this.my) return l.ERR_NOT_OWNER; |
|
if (n(this.id).spawning) return l.ERR_BUSY; |
|
if (n(this.id).fatigue > 0) return l.ERR_TIRED; |
|
if (0 == this.getActiveBodyparts(l.MOVE)) return l.ERR_NO_BODYPART; |
|
var e = j.fetchXYArguments(a, b, g), f = i(e, 3), h = f[0], m = f[1], o = f[2]; |
|
if (o = o || this.pos.roomName, k.isUndefined(h) || k.isUndefined(m)) return l.ERR_INVALID_TARGET; |
|
var p = new g.RoomPosition(h, m, o); |
|
if (k.isObject(a) && (c = k.clone(b)), c = c || {}, k.isUndefined(c.reusePath) && (c.reusePath = 5), |
|
k.isUndefined(c.serializeMemory) && (c.serializeMemory = !0), h == this.pos.x && m == this.pos.y && o == this.pos.roomName) return l.OK; |
|
if (c.reusePath && this.memory && k.isObject(this.memory) && this.memory._move) { |
|
var q = this.memory._move; |
|
if (d.time > q.time + parseInt(c.reusePath) || q.room != this.pos.roomName) delete this.memory._move; else if (q.dest.room == this.pos.roomName && q.dest.x == h && q.dest.y == m || q.dest.room != this.pos.roomName && q.dest.room == o) { |
|
var r = k.isString(q.path) ? j.deserializePath(q.path) : q.path, s = k.findIndex(r, { |
|
x: this.pos.x, |
|
y: this.pos.y |
|
}); |
|
if (-1 != s) { |
|
k.cloneDeep(q); |
|
r.splice(0, s + 1); |
|
try { |
|
q.path = c.serializeMemory ? j.serializePath(r) : r; |
|
} catch (t) { |
|
throw t; |
|
} |
|
} |
|
if (0 == r.length) return this.pos.isNearTo(p) ? l.OK : l.ERR_NO_PATH; |
|
var u = this.moveByPath(r); |
|
if (u == l.OK) return l.OK; |
|
} |
|
} |
|
if (c.noPathFinding) return l.ERR_NOT_FOUND; |
|
var r = this.pos.findPathTo(p, c); |
|
return c.reusePath && this.memory && k.isObject(this.memory) && (this.memory._move = { |
|
dest: { |
|
x: h, |
|
y: m, |
|
room: o |
|
}, |
|
time: d.time, |
|
path: c.serializeMemory ? j.serializePath(r) : k.clone(r), |
|
room: this.pos.roomName |
|
}), 0 == r.length ? l.ERR_NO_PATH : (this.move(r[0].direction), l.OK); |
|
}, o.prototype.moveByPath = function(a) { |
|
var b = this; |
|
if (k.isString(a) && (a = j.deserializePath(a)), !k.isArray(a)) return l.ERR_INVALID_ARGS; |
|
var c = k.find(a, function(a) { |
|
return a.x - a.dx == b.pos.x && a.y - a.dy == b.pos.y; |
|
}); |
|
return c ? this.move(c.direction) : l.ERR_NOT_FOUND; |
|
}, o.prototype.harvest = function(a) { |
|
if (!this.my) return l.ERR_NOT_OWNER; |
|
if (n(this.id).spawning) return l.ERR_BUSY; |
|
if (0 == this.getActiveBodyparts(l.WORK)) return l.ERR_NO_BODYPART; |
|
if (!a || !a.id) return l.ERR_INVALID_TARGET; |
|
if (f.sources[a.id] && a instanceof g.Source) { |
|
if (!a.energy) return l.ERR_NOT_ENOUGH_ENERGY; |
|
if (!a.pos.isNearTo(this.pos)) return l.ERR_NOT_IN_RANGE; |
|
if (this.room.controller && (this.room.controller.owner && this.room.controller.owner.username != d.user.username || this.room.controller.reservation && this.room.controller.reservation.username != d.user.username)) return l.ERR_NOT_OWNER; |
|
} else { |
|
if (!(f.minerals[a.id] && a instanceof g.Mineral)) return l.ERR_INVALID_TARGET; |
|
if (!a.mineralAmount) return l.ERR_NOT_ENOUGH_ENERGY; |
|
if (!a.pos.isNearTo(this.pos)) return l.ERR_NOT_IN_RANGE; |
|
var b = k.find(a.pos.lookFor("structure"), { |
|
structureType: l.STRUCTURE_EXTRACTOR |
|
}); |
|
if (!b) return l.ERR_NOT_FOUND; |
|
if (b.owner && !b.my) return l.ERR_NOT_OWNER; |
|
if (!b.isActive()) return l.ERR_RCL_NOT_ENOUGH; |
|
} |
|
return e.set(this.id, "harvest", { |
|
id: a.id |
|
}), l.OK; |
|
}, o.prototype.drop = function(a, b) { |
|
return this.my ? this.spawning ? l.ERR_BUSY : k.contains(l.RESOURCES_ALL, a) ? n(this.id)[a] ? (b || (b = n(this.id)[a]), |
|
n(this.id)[a] < b ? l.ERR_NOT_ENOUGH_RESOURCES : (e.set(this.id, "drop", { |
|
amount: b, |
|
resourceType: a |
|
}), l.OK)) : l.ERR_NOT_ENOUGH_RESOURCES : l.ERR_INVALID_ARGS : l.ERR_NOT_OWNER; |
|
}, o.prototype.transfer = function(a, b, c) { |
|
if (!this.my) return l.ERR_NOT_OWNER; |
|
if (this.spawning) return l.ERR_BUSY; |
|
if (0 > c) return l.ERR_INVALID_ARGS; |
|
if (!k.contains(l.RESOURCES_ALL, b)) return l.ERR_INVALID_ARGS; |
|
if (!(a && a.id && (f.spawns[a.id] || f.creeps[a.id] || f.structures[a.id]) && (a instanceof g.StructureSpawn || a instanceof g.Structure || a instanceof g.Creep))) return l.ERR_INVALID_TARGET; |
|
if (b == l.RESOURCE_ENERGY) { |
|
if (f.structures[a.id] && "controller" == f.structures[a.id].structureType) return this.upgradeController(a); |
|
if (f.structures[a.id] && "extension" != f.structures[a.id].structureType && "spawn" != f.structures[a.id].structureType && "link" != f.structures[a.id].structureType && "storage" != f.structures[a.id].structureType && "tower" != f.structures[a.id].structureType && "powerSpawn" != f.structures[a.id].structureType && "terminal" != f.structures[a.id].structureType && "container" != f.structures[a.id].structureType && "lab" != f.structures[a.id].structureType && "nuker" != f.structures[a.id].structureType) return l.ERR_INVALID_TARGET; |
|
} else if (b == l.RESOURCE_POWER) { |
|
if (f.structures[a.id] && "storage" != f.structures[a.id].structureType && "terminal" != f.structures[a.id].structureType && "container" != f.structures[a.id].structureType && "powerSpawn" != f.structures[a.id].structureType) return l.ERR_INVALID_TARGET; |
|
} else if (f.structures[a.id] && "storage" != f.structures[a.id].structureType && "terminal" != f.structures[a.id].structureType && "container" != f.structures[a.id].structureType && "lab" != f.structures[a.id].structureType && "nuker" != f.structures[a.id].structureType) return l.ERR_INVALID_TARGET; |
|
if (!a.pos.isNearTo(this.pos)) return l.ERR_NOT_IN_RANGE; |
|
if (!n(this.id)[b]) return l.ERR_NOT_ENOUGH_ENERGY; |
|
if ("powerSpawn" == a.structureType) { |
|
if (n(a.id)[b] >= n(a.id)[b + "Capacity"]) return l.ERR_FULL; |
|
if (c || (c = Math.min(n(this.id)[b], n(a.id)[b + "Capacity"] - n(a.id)[b])), n(this.id)[b] < c) return l.ERR_NOT_ENOUGH_ENERGY; |
|
if (!c || n(a.id)[b] + c > n(a.id)[b + "Capacity"]) return l.ERR_FULL; |
|
} else if ("lab" == a.structureType) { |
|
if (b != l.RESOURCE_ENERGY && n(a.id).mineralType && n(a.id).mineralType != b) return l.ERR_FULL; |
|
var d = b == l.RESOURCE_ENERGY ? n(a.id).energyCapacity : n(a.id).mineralCapacity, h = b == l.RESOURCE_ENERGY ? n(a.id).energy : n(a.id).mineralAmount; |
|
if (h > d) return l.ERR_FULL; |
|
if (c || (c = Math.min(n(this.id)[b], d - h)), n(this.id)[b] < c) return l.ERR_NOT_ENOUGH_ENERGY; |
|
if (!c || h + c > d) return l.ERR_FULL; |
|
} else if ("nuker" == a.structureType) { |
|
if (b != l.RESOURCE_ENERGY && b != l.RESOURCE_GHODIUM) return l.ERR_FULL; |
|
if (n(a.id)[b] >= n(a.id)[b + "Capacity"]) return l.ERR_FULL; |
|
if (c || (c = Math.min(n(this.id)[b], n(a.id)[b + "Capacity"] - n(a.id)[b])), n(this.id)[b] < c) return l.ERR_NOT_ENOUGH_ENERGY; |
|
if (!c || n(a.id)[b] + c > n(a.id)[b + "Capacity"]) return l.ERR_FULL; |
|
} else { |
|
if (!k.isUndefined(n(a.id).energyCapacity) && j.calcResources(n(a.id)) > n(a.id).energyCapacity) return l.ERR_FULL; |
|
if (c || (c = k.isUndefined(n(a.id).energyCapacity) ? n(this.id)[b] : Math.min(n(this.id)[b], n(a.id).energyCapacity - j.calcResources(n(a.id)))), |
|
n(this.id)[b] < c) return l.ERR_NOT_ENOUGH_ENERGY; |
|
if (!k.isUndefined(n(a.id).energyCapacity) && (!c || j.calcResources(n(a.id)) + c > n(a.id).energyCapacity)) return l.ERR_FULL; |
|
} |
|
return e.set(this.id, "transfer", { |
|
id: a.id, |
|
amount: c, |
|
resourceType: b |
|
}), l.OK; |
|
}, o.prototype.pickup = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : a && a.id && f.energy[a.id] && a instanceof g.Energy ? j.calcResources(this.carry) >= this.carryCapacity ? l.ERR_FULL : a.pos.isNearTo(this.pos) ? (e.set(this.id, "pickup", { |
|
id: a.id |
|
}), l.OK) : l.ERR_NOT_IN_RANGE : l.ERR_INVALID_TARGET : l.ERR_NOT_OWNER; |
|
}, o.prototype.getActiveBodyparts = function(a) { |
|
return k.filter(this.body, function(b) { |
|
return b.hits > 0 && b.type == a; |
|
}).length; |
|
}, o.prototype.attack = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : 0 == this.getActiveBodyparts(l.ATTACK) ? l.ERR_NO_BODYPART : a && a.id && (f.creeps[a.id] || f.structures[a.id]) && (a instanceof g.Creep || a instanceof g.StructureSpawn || a instanceof g.Structure) ? a.pos.isNearTo(this.pos) ? (e.set(this.id, "attack", { |
|
id: a.id, |
|
x: a.pos.x, |
|
y: a.pos.y |
|
}), l.OK) : l.ERR_NOT_IN_RANGE : l.ERR_INVALID_TARGET : l.ERR_NOT_OWNER; |
|
}, o.prototype.rangedAttack = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : 0 == this.getActiveBodyparts(l.RANGED_ATTACK) ? l.ERR_NO_BODYPART : a && a.id && (f.creeps[a.id] || f.structures[a.id]) && (a instanceof g.Creep || a instanceof g.StructureSpawn || a instanceof g.Structure) ? this.pos.inRangeTo(a, 3) ? (e.set(this.id, "rangedAttack", { |
|
id: a.id |
|
}), l.OK) : l.ERR_NOT_IN_RANGE : l.ERR_INVALID_TARGET : l.ERR_NOT_OWNER; |
|
}, o.prototype.rangedMassAttack = function() { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : 0 == this.getActiveBodyparts(l.RANGED_ATTACK) ? l.ERR_NO_BODYPART : (e.set(this.id, "rangedMassAttack", {}), |
|
l.OK) : l.ERR_NOT_OWNER; |
|
}, o.prototype.heal = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : 0 == this.getActiveBodyparts(l.HEAL) ? l.ERR_NO_BODYPART : a && a.id && f.creeps[a.id] && a instanceof g.Creep ? a.pos.isNearTo(this.pos) ? (e.set(this.id, "heal", { |
|
id: a.id, |
|
x: a.pos.x, |
|
y: a.pos.y |
|
}), l.OK) : l.ERR_NOT_IN_RANGE : l.ERR_INVALID_TARGET : l.ERR_NOT_OWNER; |
|
}, o.prototype.rangedHeal = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : 0 == this.getActiveBodyparts(l.HEAL) ? l.ERR_NO_BODYPART : a && a.id && f.creeps[a.id] && a instanceof g.Creep ? this.pos.inRangeTo(a, 3) ? (e.set(this.id, "rangedHeal", { |
|
id: a.id |
|
}), l.OK) : l.ERR_NOT_IN_RANGE : l.ERR_INVALID_TARGET : l.ERR_NOT_OWNER; |
|
}, o.prototype.repair = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : 0 == this.getActiveBodyparts(l.WORK) ? l.ERR_NO_BODYPART : this.carry.energy ? a && a.id && f.structures[a.id] && (a instanceof g.Structure || a instanceof g.StructureSpawn) ? this.pos.inRangeTo(a, 3) ? (e.set(this.id, "repair", { |
|
id: a.id, |
|
x: a.pos.x, |
|
y: a.pos.y |
|
}), l.OK) : l.ERR_NOT_IN_RANGE : l.ERR_INVALID_TARGET : l.ERR_NOT_ENOUGH_ENERGY : l.ERR_NOT_OWNER; |
|
}, o.prototype.build = function(a) { |
|
if (!this.my) return l.ERR_NOT_OWNER; |
|
if (n(this.id).spawning) return l.ERR_BUSY; |
|
if (0 == this.getActiveBodyparts(l.WORK)) return l.ERR_NO_BODYPART; |
|
if (!this.carry.energy) return l.ERR_NOT_ENOUGH_ENERGY; |
|
if (!(a && a.id && f.constructionSites[a.id] && a instanceof g.ConstructionSite)) return l.ERR_INVALID_TARGET; |
|
if (!this.pos.inRangeTo(a, 3)) return l.ERR_NOT_IN_RANGE; |
|
if (k.contains([ "spawn", "extension", "constructedWall" ], a.structureType) && k.any(f.objectsByRoom[n(this.id).room], function(b) { |
|
return b.x == a.pos.x && b.y == a.pos.y && k.contains(l.OBSTACLE_OBJECT_TYPES, b.type); |
|
})) return l.ERR_INVALID_TARGET; |
|
var b = this.getActiveBodyparts(l.WORK) * l.BUILD_POWER, c = a.progressTotal - a.progress, d = Math.min(b, c, this.carry.energy); |
|
return a.progress + d >= a.progressTotal && !j.checkControllerAvailability(a.structureType, f.objectsByRoom[n(this.id).room], this.room.controller, 1) ? l.ERR_RCL_NOT_ENOUGH : (e.set(this.id, "build", { |
|
id: a.id, |
|
x: a.pos.x, |
|
y: a.pos.y |
|
}), l.OK); |
|
}, o.prototype.suicide = function() { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : (e.set(this.id, "suicide", {}), |
|
l.OK) : l.ERR_NOT_OWNER; |
|
}, o.prototype.say = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : (e.set(this.id, "say", { |
|
message: "" + a |
|
}), l.OK) : l.ERR_NOT_OWNER; |
|
}, o.prototype.claimController = function(a) { |
|
if (!this.my) return l.ERR_NOT_OWNER; |
|
if (n(this.id).spawning) return l.ERR_BUSY; |
|
var b = k.filter(d.userObjects, { |
|
type: "controller" |
|
}).length + h; |
|
return b && (!d.user.gcl || d.user.gcl < l.GCL_MULTIPLY * Math.pow(b, l.GCL_POW)) ? l.ERR_GCL_NOT_ENOUGH : b >= l.GCL_NOVICE && d.rooms[this.room.name].novice > Date.now() ? l.ERR_FULL : a && a.id && f.structures[a.id] && a instanceof g.Structure ? 0 == this.getActiveBodyparts(l.CLAIM) ? l.ERR_NO_BODYPART : a.pos.isNearTo(this.pos) ? "controller" != a.structureType ? l.ERR_INVALID_TARGET : a.level > 0 ? l.ERR_INVALID_TARGET : (h++, |
|
e.set(this.id, "claimController", { |
|
id: a.id |
|
}), l.OK) : l.ERR_NOT_IN_RANGE : l.ERR_INVALID_TARGET; |
|
}, o.prototype.attackController = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : a && a.id && f.structures[a.id] && a instanceof g.StructureController ? this.getActiveBodyparts(l.CLAIM) < 5 ? l.ERR_NO_BODYPART : a.pos.isNearTo(this.pos) ? a.owner || a.reservation ? (e.set(this.id, "attackController", { |
|
id: a.id |
|
}), l.OK) : l.ERR_INVALID_TARGET : l.ERR_NOT_IN_RANGE : l.ERR_INVALID_TARGET : l.ERR_NOT_OWNER; |
|
}, o.prototype.upgradeController = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : 0 == this.getActiveBodyparts(l.WORK) ? l.ERR_NO_BODYPART : this.carry.energy ? a && a.id && f.structures[a.id] && a instanceof g.StructureController ? a.upgradeBlocked && a.upgradeBlocked > 0 ? l.ERR_INVALID_TARGET : a.pos.inRangeTo(this.pos, 3) ? a.my ? a.level && a.owner ? (e.set(this.id, "upgradeController", { |
|
id: a.id |
|
}), l.OK) : l.ERR_INVALID_TARGET : l.ERR_NOT_OWNER : l.ERR_NOT_IN_RANGE : l.ERR_INVALID_TARGET : l.ERR_NOT_ENOUGH_ENERGY : l.ERR_NOT_OWNER; |
|
}, o.prototype.reserveController = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : a && a.id && f.structures[a.id] && a instanceof g.Structure ? a.pos.isNearTo(this.pos) ? "controller" != a.structureType ? l.ERR_INVALID_TARGET : a.owner ? l.ERR_INVALID_TARGET : a.reservation && a.reservation.username != d.user.username ? l.ERR_INVALID_TARGET : this.getActiveBodyparts(l.CLAIM) ? (e.set(this.id, "reserveController", { |
|
id: a.id |
|
}), l.OK) : l.ERR_NO_BODYPART : l.ERR_NOT_IN_RANGE : l.ERR_INVALID_TARGET : l.ERR_NOT_OWNER; |
|
}, o.prototype.notifyWhenAttacked = function(a) { |
|
return this.my ? k.isBoolean(a) ? (a != n(this.id).notifyWhenAttacked && e.set(this.id, "notifyWhenAttacked", { |
|
enabled: a |
|
}), l.OK) : l.ERR_INVALID_ARGS : l.ERR_NOT_OWNER; |
|
}, o.prototype.cancelOrder = function(a) { |
|
return e.remove(this.id, a) ? l.OK : l.ERR_NOT_FOUND; |
|
}, o.prototype.dismantle = function(a) { |
|
return this.my ? n(this.id).spawning ? l.ERR_BUSY : 0 == this.getActiveBodyparts(l.WORK) ? l.ERR_NO_BODYPART : a && a.id && f.structures[a.id] && (a instanceof g.Structure || a instanceof g.StructureSpawn) ? a.pos.isNearTo(this.pos) ? (e.set(this.id, "dismantle", { |
|
id: a.id |
|
}), l.OK) : l.ERR_NOT_IN_RANGE : l.ERR_INVALID_TARGET : l.ERR_NOT_OWNER; |
|
}, g.Creep = o; |
|
} |
|
}; |
|
}, { |
|
"./../utils": 140, |
|
"./constants": 40, |
|
"./rooms": 54, |
|
lodash: 60 |
|
} ], |
|
43: [ function(a, b, c) { |
|
"use strict"; |
|
var d, e, f, g, h = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), i = a("./../utils"), j = (a("./rooms"), a("./constants")), k = a("lodash"); |
|
c.make = function(a, b, c, l) { |
|
if (d = a, e = b, f = c, g = l, !g.Flag) { |
|
var m = function(a, b, c, d, e, f) { |
|
g.RoomObject.call(this, Number(e), Number(f), d), this.name = a, this.color = Number(b), |
|
this.secondaryColor = Number(c || b); |
|
}; |
|
m.prototype = Object.create(g.RoomObject.prototype), m.prototype.constructor = m, |
|
Object.defineProperty(m.prototype, "memory", { |
|
get: function() { |
|
return (k.isUndefined(g.Memory.flags) || "undefined" === g.Memory.flags) && (g.Memory.flags = {}), |
|
k.isObject(g.Memory.flags) ? g.Memory.flags[this.name] = g.Memory.flags[this.name] || {} : void 0; |
|
}, |
|
set: function(a) { |
|
if ((k.isUndefined(g.Memory.flags) || "undefined" === g.Memory.flags) && (g.Memory.flags = {}), |
|
!k.isObject(g.Memory.flags)) throw new Error("Could not set flag memory"); |
|
g.Memory.flags[this.name] = a; |
|
} |
|
}), m.prototype.toString = function() { |
|
return "[flag " + this.name + "]"; |
|
}, m.prototype.remove = function() { |
|
return e.pushByName("room", "removeFlag", { |
|
roomName: this.pos.roomName, |
|
name: this.name |
|
}), j.OK; |
|
}, m.prototype.setPosition = function(a, b) { |
|
var c = i.fetchXYArguments(a, b, g), d = h(c, 3), f = d[0], l = d[1], m = d[2]; |
|
return m = m || this.pos.roomName, k.isUndefined(f) || k.isUndefined(l) ? j.ERR_INVALID_TARGET : (e.pushByName("room", "removeFlag", { |
|
roomName: this.pos.roomName, |
|
name: this.name |
|
}), e.pushByName("room", "createFlag", { |
|
roomName: m, |
|
x: f, |
|
y: l, |
|
name: this.name, |
|
color: this.color, |
|
secondaryColor: this.secondaryColor |
|
}), j.OK); |
|
}, m.prototype.setColor = function(a, b) { |
|
return k.contains(j.COLORS_ALL, a) ? (b = b || a, k.contains(j.COLORS_ALL, b) ? (e.pushByName("room", "removeFlag", { |
|
roomName: this.pos.roomName, |
|
name: this.name |
|
}), e.pushByName("room", "createFlag", { |
|
roomName: this.pos.roomName, |
|
x: this.pos.x, |
|
y: this.pos.y, |
|
name: this.name, |
|
color: a, |
|
secondaryColor: b |
|
}), j.OK) : j.ERR_INVALID_ARGS) : j.ERR_INVALID_ARGS; |
|
}, g.Flag = m; |
|
} |
|
}; |
|
}, { |
|
"./../utils": 140, |
|
"./constants": 40, |
|
"./rooms": 54, |
|
lodash: 60 |
|
} ], |
|
44: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b, c) { |
|
return b in a ? Object.defineProperty(a, b, { |
|
value: c, |
|
enumerable: !0, |
|
configurable: !0, |
|
writable: !0 |
|
}) : a[b] = c, a; |
|
} |
|
!function() { |
|
function b(a, b) {} |
|
function e(a, b) { |
|
if (k.extend(a, { |
|
creeps: {}, |
|
structures: {}, |
|
ownedStructures: {}, |
|
spawns: {}, |
|
sources: {}, |
|
energy: {}, |
|
flags: {}, |
|
constructionSites: {}, |
|
minerals: {}, |
|
nukes: {} |
|
}), b) { |
|
var c = Object.keys(a); |
|
a.spatial = {}, c.forEach(function(b) { |
|
a.spatial[b] = new Array(50); |
|
for (var c = 0; 50 > c; c++) a.spatial[b][c] = new Array(50); |
|
}); |
|
} |
|
} |
|
function f(a, b, c, d) { |
|
(!p[b] || p[b](c)) && (a.findCache[b] = a.findCache[b] || {}, a.findCache[b][d.room] = a.findCache[b][d.room] || [], |
|
a.findCache[b][d.room].push(c)); |
|
} |
|
function g(a, b, c, d) { |
|
a[b][c.id] = c, a.byRoom[d.room][b][c.id] = c, a.byRoom[d.room].spatial[b][d.y][d.x] = a.byRoom[d.room].spatial[b][d.y][d.x] || [], |
|
a.byRoom[d.room].spatial[b][d.y][d.x].push(c); |
|
} |
|
function h(c, d, h, i, j) { |
|
var m = { |
|
_useNewPathFinder: !0, |
|
_objects: {}, |
|
byRoom: {}, |
|
findCache: {}, |
|
rooms: {} |
|
}, q = []; |
|
m.deprecated = function(a) { |
|
k.contains(q, a) || (q.push(a), j.console.log(a)); |
|
}, e(m); |
|
var r = Math.floor(Math.pow((c.user.gcl || 0) / l.GCL_MULTIPLY, 1 / l.GCL_POW)) + 1, s = Math.pow(r - 1, l.GCL_POW) * l.GCL_MULTIPLY, t = { |
|
creeps: {}, |
|
spawns: {}, |
|
structures: {}, |
|
flags: {}, |
|
rooms: {}, |
|
time: c.time, |
|
cpuLimit: c.cpu, |
|
cpu: { |
|
getUsed: function() { |
|
return i(); |
|
}, |
|
tickLimit: c.cpu, |
|
limit: Math.min(300, 20 + 10 * r), |
|
bucket: c.cpuBucket |
|
}, |
|
map: {}, |
|
gcl: { |
|
level: r, |
|
progress: (c.user.gcl || 0) - s, |
|
progressTotal: Math.pow(r, l.GCL_POW) * l.GCL_MULTIPLY - s |
|
}, |
|
market: {}, |
|
getObjectById: function(a) { |
|
return m._objects[a] || null; |
|
}, |
|
notify: function(a, b) { |
|
return d.push("notify", { |
|
message: a, |
|
groupInterval: b |
|
}, 20) ? l.OK : l.ERR_FULL; |
|
} |
|
}; |
|
b(c.user._id, "before objects by room"), m.objectsByRoom = {}, m.objectsByRoomKeys = {}, |
|
k.forEach(c.roomObjects, function(a, b) { |
|
a.temp || (m.objectsByRoom[a.room] = m.objectsByRoom[a.room] || {}, m.objectsByRoom[a.room][b] = a, |
|
m.objectsByRoomKeys[a.room] = m.objectsByRoomKeys[a.room] || [], m.objectsByRoomKeys[a.room].push(b)); |
|
}), b(c.user._id, "after objects by room"); |
|
for (var u in c.rooms) m.byRoom[u] = {}, e(m.byRoom[u], !0); |
|
a("./rooms").make(c, d, m, j), a("./rooms").makePos(m, j), a("./creeps").make(c, d, m, j), |
|
a("./structures").make(c, d, m, j), a("./sources").make(c, d, m, j), a("./minerals").make(c, d, m, j), |
|
a("./nukes").make(c, d, m, j), a("./resources").make(c, d, m, j), a("./flags").make(c, d, m, j), |
|
a("./construction-sites").make(c, d, m, j), a("./path-finder").make(c, d, m, j); |
|
for (var u in c.rooms) m.rooms[u] = new j.Room(u); |
|
t.rooms = k.clone(m.rooms); |
|
var v = { |
|
rampart: j.StructureRampart, |
|
road: j.StructureRoad, |
|
extension: j.StructureExtension, |
|
constructedWall: j.StructureWall, |
|
keeperLair: j.StructureKeeperLair, |
|
controller: j.StructureController, |
|
link: j.StructureLink, |
|
storage: j.StructureStorage, |
|
tower: j.StructureTower, |
|
observer: j.StructureObserver, |
|
powerBank: j.StructurePowerBank, |
|
powerSpawn: j.StructurePowerSpawn, |
|
lab: j.StructureLab, |
|
extractor: j.StructureExtractor, |
|
terminal: j.StructureTerminal, |
|
container: j.StructureContainer, |
|
spawn: j.StructureSpawn, |
|
nuker: j.StructureNuker, |
|
portal: j.StructurePortal |
|
}; |
|
b(c.user._id, "before objects"); |
|
var w = {}; |
|
for (var u in c.roomObjects) { |
|
var x = c.roomObjects[u]; |
|
x.temp || (w[x.type] = w[x.type] || 0, w[x.type]++, "creep" == x.type && (m._objects[u] = new j.Creep(u), |
|
g(m, "creeps", m._objects[u], x), c.userObjects[u] && (t.creeps[m.creeps[u].name] ? m.creeps[u].suicide() : t.creeps[m.creeps[u].name] = m.creeps[u]), |
|
f(m, l.FIND_CREEPS, m.creeps[u], x), f(m, l.FIND_MY_CREEPS, m.creeps[u], x), f(m, l.FIND_HOSTILE_CREEPS, m.creeps[u], x)), |
|
v[x.type] && (m._objects[u] = new v[x.type](u), g(m, "structures", m._objects[u], x), |
|
m._objects[u] instanceof j.OwnedStructure && (c.userObjects[u] && (t.structures[m.structures[u].id] = m.structures[u]), |
|
g(m, "ownedStructures", m._objects[u], x)), f(m, l.FIND_STRUCTURES, m.structures[u], x), |
|
f(m, l.FIND_MY_STRUCTURES, m.structures[u], x), f(m, l.FIND_HOSTILE_STRUCTURES, m.structures[u], x), |
|
"spawn" == x.type && (g(m, "spawns", m._objects[u], x), c.userObjects[u] && (t.spawns[m.spawns[u].name] = m.spawns[u]), |
|
f(m, l.FIND_MY_SPAWNS, m.spawns[u], x), f(m, l.FIND_HOSTILE_SPAWNS, m.spawns[u], x))), |
|
x.off || "extension" != x.type && "spawn" != x.type || (m.rooms[x.room].energyAvailable += x.energy, |
|
m.rooms[x.room].energyCapacityAvailable += x.energyCapacity), "source" == x.type && (m._objects[u] = new j.Source(u), |
|
g(m, "sources", m._objects[u], x), f(m, l.FIND_SOURCES, m.sources[u], x), f(m, l.FIND_SOURCES_ACTIVE, m.sources[u], x)), |
|
"mineral" == x.type && (m._objects[u] = new j.Mineral(u), g(m, "minerals", m._objects[u], x), |
|
f(m, l.FIND_MINERALS, m.minerals[u], x)), "energy" == x.type && (m._objects[u] = new j.Energy(u), |
|
g(m, "energy", m._objects[u], x), f(m, l.FIND_DROPPED_ENERGY, m.energy[u], x)), |
|
"nuke" == x.type && (m._objects[u] = new j.Nuke(u), g(m, "nukes", m._objects[u], x), |
|
f(m, l.FIND_NUKES, m._objects[u], x)), "constructionSite" == x.type && c.rooms[x.room] && (m._objects[u] = new j.ConstructionSite(u), |
|
g(m, "constructionSites", m._objects[u], x), f(m, l.FIND_CONSTRUCTION_SITES, m.constructionSites[u], x), |
|
f(m, l.FIND_MY_CONSTRUCTION_SITES, m.constructionSites[u], x), f(m, l.FIND_HOSTILE_CONSTRUCTION_SITES, m.constructionSites[u], x))); |
|
} |
|
b(c.user._id, "after objects 1"), c.flags.forEach(function(a) { |
|
m.byRoom[a.room] || (m.byRoom[a.room] = {}, e(m.byRoom[a.room], !0)); |
|
var b = a.data.split("|"); |
|
b.forEach(function(b) { |
|
if (b) { |
|
var c = b.split("~"); |
|
c[0] = c[0].replace(/\$VLINE\$/g, "|").replace(/\$TILDE\$/g, "~"); |
|
var d = "flag_" + c[0], e = m._objects[d] = new j.Flag(c[0], c[1], c[2], a.room, c[3], c[4]); |
|
m.flags[d] = e, m.byRoom[a.room].flags[d] = e, m.byRoom[a.room].spatial.flags[c[4]][c[3]] = m.byRoom[a.room].spatial.flags[c[4]][c[3]] || [], |
|
m.byRoom[a.room].spatial.flags[c[4]][c[3]].push(e), t.flags[c[0]] = e, (!p[l.FIND_FLAGS] || p[l.FIND_FLAGS](e)) && (m.findCache[l.FIND_FLAGS] = m.findCache[l.FIND_FLAGS] || {}, |
|
m.findCache[l.FIND_FLAGS][a.room] = m.findCache[l.FIND_FLAGS][a.room] || [], m.findCache[l.FIND_FLAGS][a.room].push(e)); |
|
} |
|
}); |
|
}), t.map = m.map = n.makeMap(c), t.market = m.market = o.make(c), k.extend(j, k.cloneDeep(l)), |
|
j.Game = t; |
|
} |
|
function i(a) { |
|
if (a in this.globals.require.cache) { |
|
if (-1 === this.globals.require.cache[a]) throw new Error("Circular reference to module '" + a + "'"); |
|
} else { |
|
if (k.isUndefined(this.codeModules[a])) throw new Error("Unknown module '" + a + "'"); |
|
this.globals.require.cache[a] = -1; |
|
var b = { |
|
exports: {}, |
|
user: this.runtimeData.user._id, |
|
timestamp: this.runtimeData.userCodeTimestamp, |
|
name: a, |
|
code: this.codeModules[a] |
|
}; |
|
try { |
|
m.evalCode(b, this.globals, !1, this.timeout, this.scriptCachedData); |
|
} catch (c) { |
|
throw delete this.globals.require.cache[a], c; |
|
} |
|
this.globals.require.cache[a] = b.exports, b.__initGlobals && (this.globals.require.initGlobals = this.globals.require.initGlobals || {}, |
|
this.globals.require.initGlobals[a] = b.__initGlobals); |
|
} |
|
return this.globals.require.cache[a]; |
|
} |
|
var j, k = a("lodash"), l = (a("../../../PathFinding.js/index"), a("./constants")), m = a("../core/core"), n = (a("../utils"), |
|
a("./map")), o = a("./market"), p = (j = {}, d(j, l.FIND_CREEPS, function(a) { |
|
return !a.spawning; |
|
}), d(j, l.FIND_MY_CREEPS, function(a) { |
|
return !a.spawning && a.my; |
|
}), d(j, l.FIND_HOSTILE_CREEPS, function(a) { |
|
return !a.spawning && !a.my; |
|
}), d(j, l.FIND_MY_SPAWNS, function(a) { |
|
return a.my === !0; |
|
}), d(j, l.FIND_HOSTILE_SPAWNS, function(a) { |
|
return a.my === !1; |
|
}), d(j, l.FIND_SOURCES_ACTIVE, function(a) { |
|
return a.energy > 0; |
|
}), d(j, l.FIND_MY_STRUCTURES, function(a) { |
|
return a.my === !0; |
|
}), d(j, l.FIND_HOSTILE_STRUCTURES, function(a) { |
|
return a.my === !1 && a.owner; |
|
}), d(j, l.FIND_MY_CONSTRUCTION_SITES, function(a) { |
|
return a.my; |
|
}), d(j, l.FIND_HOSTILE_CONSTRUCTION_SITES, function(a) { |
|
return a.my === !1; |
|
}), j); |
|
!function() { |
|
var a = {}; |
|
c.runCode = function(c, d, e, f, g, j, l, n, o, p, q, r) { |
|
var s = e.user._id; |
|
a[s] = a[s] || {}, a[s].globals = c, a[s].codeModules = d, a[s].runtimeData = e, |
|
a[s].intents = f, a[s].memory = g, a[s].fakeConsole = j, a[s].consoleCommands = l, |
|
a[s].timeout = n, a[s].getUsedCpu = o, a[s].resetUsedCpu = p, a[s].markStats = q || function() {}, |
|
a[s].scriptCachedData = r, k.extend(a[s].globals, { |
|
RawMemory: a[s].memory, |
|
console: a[s].fakeConsole, |
|
_: k |
|
}), Object.defineProperty(a[s].globals, "Memory", { |
|
configurable: !0, |
|
enumerable: !0, |
|
get: function() { |
|
try { |
|
a[s].memory._parsed = JSON.parse(a[s].memory.get() || "{}"); |
|
} catch (b) { |
|
a[s].memory._parsed = null; |
|
} |
|
return Object.defineProperty(a[s].globals, "Memory", { |
|
configurable: !0, |
|
enumerable: !0, |
|
value: a[s].memory._parsed |
|
}), a[s].memory._parsed; |
|
} |
|
}), a[s].markStats("beforeMake"), h(a[s].runtimeData, a[s].intents, a[s].memory, a[s].getUsedCpu, a[s].globals), |
|
a[s].markStats("afterMake"), b(s, "markGameObject"), "2" == a[s].runtimeData.user._id && (a[s].codeModules = { |
|
main: "PathFinder.use(true); var healer = require('healer'), findAttack = require('findAttack'); for (var i in Game.creeps) { var creep = Game.creeps[i]; if (!creep.room) { continue; } if (creep.getActiveBodyparts('heal') > 0) { healer(creep); } else { findAttack(Game.creeps[i]); } require('shootAtWill')(creep); } for (var i in Memory.creeps) { if (!Game.creeps[i]) { delete Memory.creeps[i]; } }", |
|
findAttack: "var flee = require('flee'); function checkPath(pos1, pos2) { var path = pos1.findPathTo(pos2); if (!path.length) { return false; } return path[path.length - 1].x == pos2.x && path[path.length - 1].y == pos2.y; } function costCallbackIgnoreRamparts(roomName, cm) { var ramparts = Game.rooms[roomName].find(FIND_STRUCTURES, {filter: i => i.structureType == STRUCTURE_RAMPART || i.structureType == STRUCTURE_WALL}); ramparts.forEach(i => cm.set(i.pos.x, i.pos.y, 0)); } module.exports = function (creep) { if (!creep.getActiveBodyparts(ATTACK) && creep.getActiveBodyparts(RANGED_ATTACK) && flee(creep, 3)) { return; } var target, healers = creep.room.find(FIND_MY_CREEPS, { filter: function (i) { return i.getActiveBodyparts('heal') > 0; } }); if (creep.hits < creep.hitsMax / 2 && healers.length > 0 && !creep.getActiveBodyparts(ATTACK)) { target = creep.pos.findClosestByPath(FIND_MY_CREEPS, { ignoreRoads: true, filter: function (i) { return i.getActiveBodyparts('heal') > 0; } }); if (!target || creep.moveTo(target, {maxRooms: 1, ignoreRoads: true}) != OK) { target = null; } } var nearCreeps = creep.pos.findInRange(FIND_HOSTILE_CREEPS, 1, { filter: function (i) { return i.owner.username != 'Source Keeper' } }); if (nearCreeps) { creep.attack(nearCreeps[0]); } if (!target) { target = creep.pos.findClosestByPath(FIND_HOSTILE_CREEPS, { ignoreRoads: true, filter: function (i) { return i.owner.username != 'Source Keeper' } }); if (target && (creep.getActiveBodyparts(ATTACK) || !creep.pos.inRangeTo(target, 3))) { creep.moveTo(target, {maxRooms: 1, ignoreRoads: true}); } } if (!target) { target = creep.pos.findClosestByPath(FIND_HOSTILE_CREEPS, { ignoreRoads: true, filter: function (i) { return i.owner.username != 'Source Keeper' }, costCallback: costCallbackIgnoreRamparts }); if (target && (creep.getActiveBodyparts(ATTACK) || !creep.pos.inRangeTo(target, 3))) { creep.moveTo(target, {maxRooms: 1, ignoreRoads: true, costCallback: costCallbackIgnoreRamparts}); } } if (!target) { target = creep.pos.findClosestByPath(FIND_HOSTILE_CREEPS, { ignoreDestructibleStructures: true, ignoreRoads: true, filter: function (i) { return i.owner.username != 'Source Keeper' } }); if (target && (creep.getActiveBodyparts(ATTACK) || !creep.pos.inRangeTo(target, 3))) { creep.moveTo(target, {ignoreDestructibleStructures: true, maxRooms: 1, ignoreRoads: true}); } } if (!target) { if (creep.room.controller && creep.room.controller.level > 0 && !creep.room.find(FIND_HOSTILE_CREEPS).length) { var spawns = _.filter(creep.room.find(FIND_HOSTILE_SPAWNS), spawn => !checkPath(creep.pos, spawn.pos)); if (!spawns.length) { creep.suicide(); return; } target = spawns[0]; if (target) { creep.moveTo(target, {ignoreDestructibleStructures: true, maxRooms: 1, ignoreRoads: true}); } } return; } creep.attack(target); if (creep.getActiveBodyparts(WORK) > 0 && creep.memory._move && creep.memory._move.path) { var path = Room.deserializePath(creep.memory._move.path); if (path.length && creep.pos.isNearTo(path[0].x, path[0].y)) { var structures = creep.room.lookForAt('structure', path[0].x, path[0].y); if (structures.length > 0) { creep.dismantle(structures[0]); } } } }", |
|
flee: "var rooms = require('rooms'); module.exports = function(creep, range) { var nearCreeps = creep.pos.findInRange(FIND_HOSTILE_CREEPS, range-1, {filter: i => i.getActiveBodyparts(ATTACK) > 0 || i.getActiveBodyparts(RANGED_ATTACK) > 0}); if(nearCreeps.length > 0) { var ret = PathFinder.search(creep.pos, _.map(nearCreeps, i => ({pos: i.pos, range: range})), { maxRooms: 1, flee: true, roomCallback(roomName) { if(!rooms.rooms[roomName] || rooms.rooms[roomName].time < Game.time) { rooms.rooms[roomName] = {costMatrix: rooms.createCostMatrix(roomName), time: Game.time}; } return rooms.rooms[roomName].costMatrix; } }); if(ret.path.length) { creep.moveTo(ret.path[0]); creep.say('flee'); return true; } } return false; }", |
|
healer: "var flee = require('flee'); module.exports = function (creep) { var target; var healTargets = creep.pos.findInRange(FIND_MY_CREEPS, 3); if(healTargets.length > 0) { healTargets = healTargets.sort((a,b) => (b.hitsMax - b.hits) - (a.hitsMax - a.hits)); if (creep.pos.isNearTo(healTargets[0])) { creep.heal(healTargets[0]); } else { creep.rangedHeal(healTargets[0]); } } if (creep.hits < creep.hitsMax / 2) { if (!flee(creep)) { target = creep.pos.findClosestByPath(FIND_MY_CREEPS, {filter: i => i.getActiveBodyparts('heal') > 0}); if (target) { creep.moveTo(target, {maxRooms: 1, ignoreRoads: true}); } } return; } target = creep.pos.findClosestByRange(FIND_MY_CREEPS, {filter: i => i.hits < i.hitsMax}); if (!target) { if (flee(creep, 4)) { return; } target = creep.pos.findClosestByRange(FIND_MY_CREEPS, {filter: i => i != creep && i.getActiveBodyparts(HEAL) == 0}); } if (!target) { creep.suicide(); return; } creep.moveTo(target, {maxRooms: 1, ignoreRoads: true, reusePath: 0}); if (creep.getActiveBodyparts(RANGED_ATTACK)) { require('shootAtWill')(creep); } }", |
|
rooms: "module.exports = { rooms: {}, createCostMatrix(roomName) { var cm = new PathFinder.CostMatrix; Game.rooms[roomName].find(FIND_CREEPS).forEach(i => cm.set(i.pos.x, i.pos.y, 255)); Game.rooms[roomName].find(FIND_STRUCTURES).forEach(i => { if(i.structureType != STRUCTURE_ROAD && i.structureType != STRUCTURE_CONTAINER) { cm.set(i.pos.x, i.pos.y, 255); } }); return cm; } } ", |
|
shootAtWill: "module.exports = function (creep) { if(!creep.getActiveBodyparts(RANGED_ATTACK)) { return; } var targets = creep.pos.findInRange(FIND_HOSTILE_CREEPS, 3, { filter: function (i) { return i.owner.username != 'Source Keeper' } }); if (!targets.length) { targets = creep.pos.findInRange(FIND_STRUCTURES, 3, { filter: function (i) { return i.structureType == STRUCTURE_RAMPART || i.structureType == STRUCTURE_WALL; } }); } var min = -1, target; for (var i in targets) { if (min == -1 || min > targets[i].hits) { target = targets[i]; min = targets[i].hits; } } creep.rangedAttack(target); }" |
|
}, a[s].runtimeData.userCodeTimestamp = 2), "3" == a[s].runtimeData.user._id && (a[s].codeModules = { |
|
main: "PathFinder.use(true); for (var i in Game.creeps) { var creep = Game.creeps[i], source = undefined; if (!creep.room) { continue; } if (creep.memory.sourceId) { source = Game.getObjectById(creep.memory.sourceId); } if(!source) { source = creep.pos.findInRange(FIND_SOURCES, 5)[0] || creep.pos.findInRange(FIND_MINERALS, 5)[0]; if (source) { creep.memory.sourceId = source.id; } } if (source) { if (!creep.pos.isNearTo(source)) { if (creep.moveTo(source, {reusePath: 50}) == ERR_NO_PATH) { delete creep.memory._move; creep.moveTo(source, {reusePath: 50, ignoreDestructibleStructures: true}); } } } var enemies = creep.pos.findInRange(FIND_HOSTILE_CREEPS, 1, { filter: function (i) { return i.owner.username != 'Invader' } }); if (enemies.length) { enemies.sort(function (a, b) { return a.hits - b.hits; }); creep.attack(enemies[0]); } var enemies = creep.pos.findInRange(FIND_HOSTILE_CREEPS, 3, { filter: function (i) { return i.owner.username != 'Invader' } }); if (enemies.length) { var massDmg = 0, distanceDmg = {1: 10, 2: 4, 3: 1}; for (var i in enemies) { var distance = Math.max(Math.abs(enemies[i].pos.x - creep.pos.x), Math.abs(enemies[i].pos.y - creep.pos.y)); massDmg += distanceDmg[distance]; } if (massDmg > 13) { creep.rangedMassAttack(); } else { enemies.sort(function (a, b) { return a.hits - b.hits; }); creep.rangedAttack(enemies[0]); } } for (var i in Memory.creeps) { if (!Game.creeps[i]) { delete Memory.creeps[i]; } } }" |
|
}, a[s].runtimeData.userCodeTimestamp = 2), a[s].globals.require && a[s].runtimeData.userCodeTimestamp == a[s].globals.require.timestamp && k.isObject(a[s].globals.require.cache.main) && k.isFunction(a[s].globals.require.cache.main.loop) || (a[s].globals.require = i.bind(a[s]), |
|
a[s].globals.require.cache = { |
|
lodash: k |
|
}, a[s].globals.require.timestamp = a[s].runtimeData.userCodeTimestamp), a[s].resetUsedCpu(); |
|
var t = a[s].globals.require("main"); |
|
if (k.isObject(t) && k.isFunction(t.loop) && (a[s].globals.require.initGlobals && k.forEach(a[s].globals.require.initGlobals, function(a) { |
|
return a(); |
|
}), m.evalCode({ |
|
exports: t, |
|
user: a[s].runtimeData.user._id, |
|
timestamp: a[s].runtimeData.userCodeTimestamp, |
|
name: "__mainLoop", |
|
code: "module.exports.loop();" |
|
}, a[s].globals, !1, a[s].timeout)), a[s].consoleCommands) for (var u = 0; u < a[s].consoleCommands.length; u++) { |
|
var v = m.evalCode({ |
|
exports: {}, |
|
user: a[s].runtimeData.user._id, |
|
name: "_console" + new Date().getTime() + "_" + u, |
|
code: a[s].consoleCommands[u].expression |
|
}, a[s].globals, !0); |
|
a[s].consoleCommands[u].hidden || a[s].fakeConsole.commandResult(v); |
|
} |
|
}; |
|
}(); |
|
}(); |
|
}, { |
|
"../../../PathFinding.js/index": 1, |
|
"../core/core": 28, |
|
"../utils": 140, |
|
"./constants": 40, |
|
"./construction-sites": 41, |
|
"./creeps": 42, |
|
"./flags": 43, |
|
"./map": 45, |
|
"./market": 47, |
|
"./minerals": 48, |
|
"./nukes": 50, |
|
"./path-finder": 51, |
|
"./resources": 53, |
|
"./rooms": 54, |
|
"./sources": 55, |
|
"./structures": 56, |
|
lodash: 60 |
|
} ], |
|
45: [ function(a, b, c) { |
|
"use strict"; |
|
var d = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), e = a("./constants"), f = a("lodash"), g = a("../utils"), h = (a("util"), a("./path-utils")), i = h.Heap, j = h.OpenClosed, k = a("./mapgrid"), l = 30; |
|
c.makeMap = function(a) { |
|
function b() { |
|
if (!o) { |
|
if (!f.isFunction(k)) throw new Error("Could not load world map data"); |
|
o = new k(a.accessibleRooms); |
|
} |
|
} |
|
function c(a) { |
|
if (!/^(W|E)\d+(N|S)\d+$/.test(a)) return null; |
|
b(); |
|
var c = g.roomNameToXY(a), f = d(c, 2), h = f[0], i = f[1], j = k.gridData[h + "," + i]; |
|
if (!j) return null; |
|
var l = {}; |
|
return j.t && (l[e.TOP] = g.getRoomNameFromXY(h, i - 1)), j.b && (l[e.BOTTOM] = g.getRoomNameFromXY(h, i + 1)), |
|
j.l && (l[e.LEFT] = g.getRoomNameFromXY(h - 1, i)), j.r && (l[e.RIGHT] = g.getRoomNameFromXY(h + 1, i)), |
|
l; |
|
} |
|
function h(a, b) { |
|
var c = s - a, d = t - b; |
|
return 0 > c || c >= 2 * l || 0 > d || d >= 2 * l ? void 0 : c * l * 2 + d; |
|
} |
|
function m(a) { |
|
return [ s - Math.floor(a / (2 * l)), t - a % (2 * l) ]; |
|
} |
|
function n(a, b) { |
|
return Math.abs(a - u) + Math.abs(b - v); |
|
} |
|
var o, p, q, r, s, t, u, v; |
|
return { |
|
findRoute: function(a, b, k) { |
|
if (f.isObject(a) && (a = a.name), f.isObject(b) && (b = b.name), a == b) return []; |
|
if (!/(W|E)\d+(N|S)\d+$/.test(a) || !/(W|E)\d+(N|S)\d+$/.test(b)) return e.ERR_NO_PATH; |
|
var o = g.roomNameToXY(a), w = d(o, 2), x = w[0], y = w[1], z = g.roomNameToXY(b), A = d(z, 2); |
|
if (u = A[0], v = A[1], x == u && y == v) return []; |
|
s = x + l, t = y + l, p ? (p.clear(), q.clear()) : (p = new i(Math.pow(2 * l, 2), Float64Array), |
|
q = new j(Math.pow(2 * l, 2))), r || (r = new Uint16Array(Math.pow(2 * l, 2))); |
|
var B = h(x, y); |
|
p.push(B, n(x, y)); |
|
for (var C = k && k.routeCallback || function() { |
|
return 1; |
|
}; p.size(); ) { |
|
var D = p.min(), E = p.minPriority(); |
|
p.pop(), q.close(D); |
|
var F = m(D), G = d(F, 2), H = G[0], I = G[1], J = n(H, I), K = E - J; |
|
if (0 === J) { |
|
for (var L = []; D !== B; ) { |
|
var M = m(D), N = d(M, 2), O = N[0], P = N[1]; |
|
D = r[D]; |
|
var Q = m(D), R = d(Q, 2), S = R[0], T = R[1], U = void 0; |
|
U = O > S ? e.FIND_EXIT_RIGHT : S > O ? e.FIND_EXIT_LEFT : P > T ? e.FIND_EXIT_BOTTOM : e.FIND_EXIT_TOP, |
|
L.push({ |
|
exit: U, |
|
room: g.getRoomNameFromXY(O, P) |
|
}); |
|
} |
|
return L.reverse(), L; |
|
} |
|
var V = g.getRoomNameFromXY(H, I), W = c(V); |
|
for (var U in W) { |
|
var X = W[U], Y = g.roomNameToXY(X), Z = d(Y, 2), $ = Z[0], _ = Z[1], aa = h($, _); |
|
if (void 0 !== aa && !q.isClosed(aa)) { |
|
var ba = Number(C(X, V)) || 1; |
|
if (ba !== 1 / 0) { |
|
var ca = K + n($, _) + ba; |
|
q.isOpen(aa) ? p.priority(aa) > ca && (p.update(aa, ca), r[aa] = D) : (p.push(aa, ca), |
|
q.open(aa), r[aa] = D); |
|
} |
|
} |
|
} |
|
} |
|
return e.ERR_NO_PATH; |
|
}, |
|
findExit: function(a, b, c) { |
|
var d = this.findRoute(a, b, c); |
|
return f.isArray(d) ? d.length ? d[0].exit : e.ERR_INVALID_ARGS : d; |
|
}, |
|
describeExits: c, |
|
isRoomProtected: function(b) { |
|
return /^(W|E)\d+(N|S)\d+$/.test(b) ? !f.contains(a.accessibleRooms, b) : null; |
|
}, |
|
getTerrainAt: function(b, c, d) { |
|
if (f.isObject(b) && (c = b.y, d = b.roomName, b = b.x), a.staticTerrainData && a.staticTerrainData[d]) { |
|
var g = a.staticTerrainData[d][50 * c + b]; |
|
return g & e.TERRAIN_MASK_WALL ? "wall" : g & e.TERRAIN_MASK_SWAMP ? "swamp" : "plain"; |
|
} |
|
}, |
|
getRoomLinearDistance: function(a, b) { |
|
var c = g.roomNameToXY(a), e = d(c, 2), f = e[0], h = e[1], i = g.roomNameToXY(b), j = d(i, 2), k = j[0], l = j[1]; |
|
return Math.max(Math.abs(k - f), Math.abs(l - h)); |
|
} |
|
}; |
|
}; |
|
}, { |
|
"../utils": 140, |
|
"./constants": 40, |
|
"./mapgrid": 46, |
|
"./path-utils": 52, |
|
lodash: 60, |
|
util: 144 |
|
} ], |
|
46: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a) { |
|
this.width = 62, this.height = 62, this.nodes = this._buildNodes(this.width, this.height, a); |
|
} |
|
var e = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), f = a("../../../PathFinding.js/index"), g = a("../core/core"), h = g.getMapGridData(), i = a("../utils"); |
|
d.gridData = h, d.prototype._buildNodes = function(a, b, c) { |
|
var d, g, h = {}; |
|
for (d = -b / 2; b / 2 > d; ++d) for (h[d] = {}, g = -a / 2; a / 2 > g; ++g) h[d][g] = new f.Node(g, d); |
|
return c && c.forEach(function(a) { |
|
var b = i.roomNameToXY(a), c = e(b, 2), d = c[0], f = c[1]; |
|
h[f] && h[f][d] && (h[f][d].weight = 1); |
|
}), h; |
|
}, d.prototype.getNodeAt = function(a, b) { |
|
return this.nodes[b][a]; |
|
}, d.prototype.isWalkableAt = function(a, b) { |
|
return this.isInside(a, b) && this.nodes[b][a].weight > 0; |
|
}, d.prototype.isInside = function(a, b) { |
|
return a >= -this.width / 2 && a < this.width / 2 && b >= -this.height / 2 && b < this.height / 2; |
|
}, d.prototype.setWalkableAt = function(a, b, c) {}, d.prototype.getNeighbors = function(a, b) { |
|
var c = a.x, d = a.y, e = [], f = this.nodes, g = h[c + "," + d]; |
|
return g ? (g.t && this.isWalkableAt(c, d - 1) && e.push(f[d - 1][c]), g.r && this.isWalkableAt(c + 1, d) && e.push(f[d][c + 1]), |
|
g.b && this.isWalkableAt(c, d + 1) && e.push(f[d + 1][c]), g.l && this.isWalkableAt(c - 1, d) && e.push(f[d][c - 1]), |
|
e) : []; |
|
}, d.prototype.clone = function() { |
|
var a, b, c = this.width, e = this.height, g = this.nodes, h = new d(), i = {}; |
|
for (a = -e / 2; e / 2 > a; ++a) for (i[a] = {}, b = -c / 2; c / 2 > b; ++b) i[a][b] = new f.Node(b, a, g[a][b].walkable, g[a][b].weight); |
|
return h.nodes = i, h; |
|
}, b.exports = d; |
|
}, { |
|
"../../../PathFinding.js/index": 1, |
|
"../core/core": 28, |
|
"../utils": 140 |
|
} ], |
|
47: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("./constants"), a("lodash")); |
|
a("../utils"), a("util"); |
|
c.make = function(a) { |
|
return { |
|
incomingTransactions: d.map(a.transactions.incoming || [], function(b) { |
|
return b.transactionId = "" + b._id, delete b._id, b.sender = { |
|
username: a.users[b.sender].username |
|
}, b.recipient = { |
|
username: a.users[b.recipient].username |
|
}, b; |
|
}), |
|
outgoingTransactions: d.map(a.transactions.outgoing || [], function(b) { |
|
return b.transactionId = "" + b._id, delete b._id, b.sender = { |
|
username: a.users[b.sender].username |
|
}, b.recipient = { |
|
username: a.users[b.recipient].username |
|
}, b; |
|
}) |
|
}; |
|
}; |
|
}, { |
|
"../utils": 140, |
|
"./constants": 40, |
|
lodash: 60, |
|
util: 144 |
|
} ], |
|
48: [ function(a, b, c) { |
|
"use strict"; |
|
var d, e, f, g, h = a("./../utils"); |
|
a("./rooms"), a("./constants"); |
|
c.make = function(a, b, c, i) { |
|
if (d = a, e = b, f = c, g = i, !g.Mineral) { |
|
var j = function(a) { |
|
if (!d.roomObjects[a]) throw new Error("Could not find an object with ID " + a); |
|
return d.roomObjects[a]; |
|
}, k = function(a) { |
|
var b = j(a); |
|
g.RoomObject.call(this, b.x, b.y, b.room), this.id = a; |
|
}; |
|
k.prototype = Object.create(g.RoomObject.prototype), k.prototype.constructor = k, |
|
h.defineGameObjectProperties(k.prototype, j, { |
|
mineralType: function(a) { |
|
return a.mineralType; |
|
}, |
|
mineralAmount: function(a) { |
|
return a.mineralAmount; |
|
}, |
|
ticksToRegeneration: function(a) { |
|
return a.nextRegenerationTime ? a.nextRegenerationTime - d.time : void 0; |
|
} |
|
}), k.prototype.toString = function() { |
|
return "[mineral (" + this.mineralType + ") #" + this.id + "]"; |
|
}, g.Mineral = k; |
|
} |
|
}; |
|
}, { |
|
"./../utils": 140, |
|
"./constants": 40, |
|
"./rooms": 54 |
|
} ], |
|
49: [ function(a, b, c) { |
|
"use strict"; |
|
var d = [ "Jackson", "Aiden", "Liam", "Lucas", "Noah", "Mason", "Jayden", "Ethan", "Jacob", "Jack", "Caden", "Logan", "Benjamin", "Michael", "Caleb", "Ryan", "Alexander", "Elijah", "James", "William", "Oliver", "Connor", "Matthew", "Daniel", "Luke", "Brayden", "Jayce", "Henry", "Carter", "Dylan", "Gabriel", "Joshua", "Nicholas", "Isaac", "Owen", "Nathan", "Grayson", "Eli", "Landon", "Andrew", "Max", "Samuel", "Gavin", "Wyatt", "Christian", "Hunter", "Cameron", "Evan", "Charlie", "David", "Sebastian", "Joseph", "Dominic", "Anthony", "Colton", "John", "Tyler", "Zachary", "Thomas", "Julian", "Levi", "Adam", "Isaiah", "Alex", "Aaron", "Parker", "Cooper", "Miles", "Chase", "Muhammad", "Christopher", "Blake", "Austin", "Jordan", "Leo", "Jonathan", "Adrian", "Colin", "Hudson", "Ian", "Xavier", "Camden", "Tristan", "Carson", "Jason", "Nolan", "Riley", "Lincoln", "Brody", "Bentley", "Nathaniel", "Josiah", "Declan", "Jake", "Asher", "Jeremiah", "Cole", "Mateo", "Micah", "Elliot" ], e = [ "Sophia", "Emma", "Olivia", "Isabella", "Mia", "Ava", "Lily", "Zoe", "Emily", "Chloe", "Layla", "Madison", "Madelyn", "Abigail", "Aubrey", "Charlotte", "Amelia", "Ella", "Kaylee", "Avery", "Aaliyah", "Hailey", "Hannah", "Addison", "Riley", "Harper", "Aria", "Arianna", "Mackenzie", "Lila", "Evelyn", "Adalyn", "Grace", "Brooklyn", "Ellie", "Anna", "Kaitlyn", "Isabelle", "Sophie", "Scarlett", "Natalie", "Leah", "Sarah", "Nora", "Mila", "Elizabeth", "Lillian", "Kylie", "Audrey", "Lucy", "Maya", "Annabelle", "Makayla", "Gabriella", "Elena", "Victoria", "Claire", "Savannah", "Peyton", "Maria", "Alaina", "Kennedy", "Stella", "Liliana", "Allison", "Samantha", "Keira", "Alyssa", "Reagan", "Molly", "Alexandra", "Violet", "Charlie", "Julia", "Sadie", "Ruby", "Eva", "Alice", "Eliana", "Taylor", "Callie", "Penelope", "Camilla", "Bailey", "Kaelyn", "Alexis", "Kayla", "Katherine", "Sydney", "Lauren", "Jasmine", "London", "Bella", "Adeline", "Caroline", "Vivian", "Juliana", "Gianna", "Skyler", "Jordyn" ]; |
|
c.getUniqueName = function(a) { |
|
var b, c, f = 0; |
|
do { |
|
var g = Math.random() > .5 ? d : e; |
|
b = g[Math.floor(Math.random() * g.length)], f > 3 && (b += g[Math.floor(Math.random() * g.length)]), |
|
f++, c = a(b); |
|
} while (c); |
|
return b; |
|
}; |
|
}, {} ], |
|
50: [ function(a, b, c) { |
|
"use strict"; |
|
var d, e, f, g, h = a("./../utils"); |
|
a("./rooms"), a("./constants"); |
|
c.make = function(a, b, c, i) { |
|
if (d = a, e = b, f = c, g = i, !g.Nuke) { |
|
var j = function(a) { |
|
if (!d.roomObjects[a]) throw new Error("Could not find an object with ID " + a); |
|
return d.roomObjects[a]; |
|
}, k = function(a) { |
|
var b = j(a); |
|
g.RoomObject.call(this, b.x, b.y, b.room), this.id = a; |
|
}; |
|
k.prototype = Object.create(g.RoomObject.prototype), k.prototype.constructor = k, |
|
h.defineGameObjectProperties(k.prototype, j, { |
|
timeToLand: function(a) { |
|
return a.landTime - d.time; |
|
}, |
|
launchRoomName: function(a) { |
|
return a.launchRoomName; |
|
} |
|
}), k.prototype.toString = function() { |
|
return "[nuke #" + this.id + "]"; |
|
}, g.Nuke = k; |
|
} |
|
}; |
|
}, { |
|
"./../utils": 140, |
|
"./constants": 40, |
|
"./rooms": 54 |
|
} ], |
|
51: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("./constants"), a("../core/core")); |
|
c.make = function(a, b, c, e) { |
|
function f() { |
|
this._bits = new Uint8Array(2500); |
|
} |
|
d.pathFinder.make(a, b, c, e), f.prototype.set = function(a, b, c) { |
|
a = 0 | a, b = 0 | b, this._bits[50 * a + b] = Math.min(Math.max(0, c), 255); |
|
}, f.prototype.get = function(a, b) { |
|
return a = 0 | a, b = 0 | b, this._bits[50 * a + b]; |
|
}, f.prototype.clone = function() { |
|
var a = new f(); |
|
return a._bits = new Uint8Array(this._bits), a; |
|
}, f.prototype.serialize = function() { |
|
return Array.prototype.slice.apply(new Uint32Array(this._bits.buffer)); |
|
}, f.deserialize = function(a) { |
|
var b = Object.create(f.prototype); |
|
return b._bits = new Uint8Array(new Uint32Array(a).buffer), b; |
|
}, e.PathFinder = { |
|
CostMatrix: f, |
|
search: function(a, b, c) { |
|
return !b || Array.isArray(b) && !b.length ? { |
|
path: [], |
|
ops: 0 |
|
} : d.pathFinder.search(a, b, c); |
|
}, |
|
use: function(a) { |
|
c._useNewPathFinder = !!a; |
|
} |
|
}; |
|
}; |
|
}, { |
|
"../core/core": 28, |
|
"./constants": 40, |
|
lodash: 60 |
|
} ], |
|
52: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b) { |
|
if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function"); |
|
} |
|
var e = function() { |
|
function a(a, b) { |
|
for (var c = 0; c < b.length; c++) { |
|
var d = b[c]; |
|
d.enumerable = d.enumerable || !1, d.configurable = !0, "value" in d && (d.writable = !0), |
|
Object.defineProperty(a, d.key, d); |
|
} |
|
} |
|
return function(b, c, d) { |
|
return c && a(b.prototype, c), d && a(b, d), b; |
|
}; |
|
}(); |
|
c.OpenClosed = function() { |
|
function a(b) { |
|
d(this, a), this.list = new Uint8Array(b), this.marker = 1; |
|
} |
|
return e(a, [ { |
|
key: "clear", |
|
value: function() { |
|
this.marker >= 253 ? (this.list = new Uint8Array(this.list.length), this.marker = 1) : this.marker += 2; |
|
} |
|
}, { |
|
key: "isOpen", |
|
value: function(a) { |
|
return this.list[a] === this.marker; |
|
} |
|
}, { |
|
key: "isClosed", |
|
value: function(a) { |
|
return this.list[a] === this.marker + 1; |
|
} |
|
}, { |
|
key: "open", |
|
value: function(a) { |
|
this.list[a] = this.marker; |
|
} |
|
}, { |
|
key: "close", |
|
value: function(a) { |
|
this.list[a] = this.marker + 1; |
|
} |
|
} ]), a; |
|
}(), c.Heap = function() { |
|
function a(b, c) { |
|
d(this, a), this.priorities = new (c || Uint16Array)(b + 1), this.heap = new Uint16Array(b + 1), |
|
this.size_ = 0; |
|
} |
|
return e(a, [ { |
|
key: "minPriority", |
|
value: function() { |
|
return this.priorities[this.heap[1]]; |
|
} |
|
}, { |
|
key: "min", |
|
value: function() { |
|
return this.heap[1]; |
|
} |
|
}, { |
|
key: "size", |
|
value: function() { |
|
return this.size_; |
|
} |
|
}, { |
|
key: "priority", |
|
value: function(a) { |
|
return this.priorities[a]; |
|
} |
|
}, { |
|
key: "pop", |
|
value: function() { |
|
this.heap[1] = this.heap[this.size_], --this.size_; |
|
for (var a = 1; ;) { |
|
var b = a; |
|
if ((b << 1) + 1 <= this.size_ ? (this.priorities[this.heap[b]] >= this.priorities[this.heap[b << 1]] && (a = b << 1), |
|
this.priorities[this.heap[a]] >= this.priorities[this.heap[(b << 1) + 1]] && (a = (b << 1) + 1)) : b << 1 <= this.size_ && this.priorities[this.heap[b]] >= this.priorities[this.heap[b << 1]] && (a = b << 1), |
|
b === a) return; |
|
var c = this.heap[b]; |
|
this.heap[b] = this.heap[a], this.heap[a] = c; |
|
} |
|
} |
|
}, { |
|
key: "push", |
|
value: function(a, b) { |
|
this.priorities[a] = b; |
|
var c = ++this.size_; |
|
this.heap[c] = a, this.bubbleUp(c); |
|
} |
|
}, { |
|
key: "update", |
|
value: function(a, b) { |
|
for (var c = this.size_; c > 0; --c) if (this.heap[c] === a) return this.priorities[a] = b, |
|
void this.bubbleUp(c); |
|
} |
|
}, { |
|
key: "bubbleUp", |
|
value: function(a) { |
|
for (;1 !== a; ) { |
|
if (!(this.priorities[this.heap[a]] <= this.priorities[this.heap[a >>> 1]])) return; |
|
var b = this.heap[a]; |
|
this.heap[a] = this.heap[a >>> 1], this.heap[a >>>= 1] = b; |
|
} |
|
} |
|
}, { |
|
key: "clear", |
|
value: function() { |
|
this.size_ = 0; |
|
} |
|
} ]), a; |
|
}(); |
|
}, {} ], |
|
53: [ function(a, b, c) { |
|
"use strict"; |
|
var d, e, f, g, h = a("./../utils"), i = (a("./rooms"), a("./constants")); |
|
c.make = function(a, b, c, j) { |
|
if (d = a, e = b, f = c, g = j, !g.Resource) { |
|
var k = function(a) { |
|
if (!d.roomObjects[a]) throw new Error("Could not find an object with ID " + a); |
|
return d.roomObjects[a]; |
|
}, l = function(a) { |
|
var b = k(a); |
|
g.RoomObject.call(this, b.x, b.y, b.room), this.id = a; |
|
}; |
|
l.prototype = Object.create(g.RoomObject.prototype), l.prototype.constructor = l, |
|
h.defineGameObjectProperties(l.prototype, k, { |
|
energy: function(a) { |
|
return a.energy; |
|
}, |
|
amount: function(a) { |
|
return a[a.resourceType || i.RESOURCE_ENERGY]; |
|
}, |
|
resourceType: function(a) { |
|
return a.resourceType || i.RESOURCE_ENERGY; |
|
} |
|
}), l.prototype.toString = function() { |
|
return "[resource (" + this.resourceType + ") #" + this.id + "]"; |
|
}, g.Resource = l, g.Energy = l; |
|
} |
|
}; |
|
}, { |
|
"./../utils": 140, |
|
"./constants": 40, |
|
"./rooms": 54 |
|
} ], |
|
54: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b) { |
|
b = b || {}, u.defaults(b, { |
|
maxOps: 2e3, |
|
heuristicWeight: 1 |
|
}); |
|
var c = b.maxOps + "," + b.heuristicWeight; |
|
return r[a].pfFinders[c] || (r[a].pfFinders[c] = new w.AStarFinder({ |
|
diagonalMovement: 1, |
|
maxOpsLimit: b.maxOps, |
|
heuristic: w.Heuristic.chebyshev, |
|
weight: b.heuristicWeight |
|
})), r[a].pfFinders[c]; |
|
} |
|
function e(a, b, c) { |
|
b = b || {}; |
|
var d = new Array(50), e = u.clone(v.OBSTACLE_OBJECT_TYPES); |
|
b.ignoreDestructibleStructures && (e = u.without(e, "constructedWall", "spawn", "extension", "link", "storage", "observer", "tower", "powerBank", "powerSpawn", "lab", "terminal")), |
|
b.ignoreCreeps && (e = u.without(e, "creep")); |
|
for (var f = 0; 50 > f; f++) { |
|
d[f] = new Array(50); |
|
for (var g = 0; 50 > g; g++) { |
|
d[f][g] = 0 == g || 0 == f || 49 == g || 49 == f ? 11 : 2; |
|
var h = k.staticTerrainData[a][50 * f + g]; |
|
h & v.TERRAIN_MASK_WALL && (d[f][g] = 0), h & v.TERRAIN_MASK_SWAMP && 2 == d[f][g] && (d[f][g] = 10); |
|
} |
|
} |
|
if (m.objectsByRoomKeys[a].forEach(function(c) { |
|
var f = m.objectsByRoom[a][c]; |
|
(u.contains(e, f.type) || !b.ignoreDestructibleStructures && "rampart" == f.type && f.user != k.user._id || !b.ignoreDestructibleStructures && "constructionSite" == f.type && f.user == k.user._id && u.contains(v.OBSTACLE_OBJECT_TYPES, f.structureType)) && (d[f.y][f.x] = 0), |
|
"road" == f.type && d[f.y][f.x] > 0 && (d[f.y][f.x] = 1); |
|
}), b.ignore) { |
|
if (!u.isArray(b.ignore)) throw new Error("option `ignore` is not an array"); |
|
u.forEach(b.ignore, function(c, e) { |
|
c && (c.pos && (d[c.pos.y][c.pos.x] = d[c.pos.y][c.pos.x] > 2 ? 2 : d[c.pos.y][c.pos.x]), |
|
!u.isObject(c) || u.isUndefined(c.x) || c instanceof n.RoomPosition || (b.ignore[e] = new n.RoomPosition(c.x, c.y, a)), |
|
u.isUndefined(c.x) || (d[c.y][c.x] = d[c.y][c.x] > 2 ? 2 : d[c.y][c.x])); |
|
}); |
|
} |
|
if (b.avoid) { |
|
if (!u.isArray(b.avoid)) throw new Error("option `avoid` is not an array"); |
|
u.forEach(b.avoid, function(c, e) { |
|
c && (c.pos && (d[c.pos.y][c.pos.x] = 0), !u.isObject(c) || u.isUndefined(c.x) || c instanceof n.RoomPosition || (b.avoid[e] = new n.RoomPosition(c.x, c.y, a)), |
|
u.isUndefined(c.x) || (d[c.y][c.x] = 0)); |
|
}); |
|
} |
|
return c && u.forEach(r[a].pfEndNodes[c], function(a) { |
|
u.isUndefined(a.x) ? u.isUndefined(a.pos) || (d[a.pos.y][a.pos.x] = 999) : d[a.y][a.x] = 999; |
|
}), new w.Grid(50, 50, d); |
|
} |
|
function f(a, b, c) { |
|
var d = "grid"; |
|
return b = b || {}, b.ignoreCreeps && (d += "_ignoreCreeps"), b.ignoreDestructibleStructures && (d += "_ignoreDestructibleStructures"), |
|
u.isNumber(c) && (d += "_endNodes" + c), b.avoid && (d += "_avoid" + r[a].positionsSetCache.key(b.avoid)), |
|
b.ignore && (d += "_ignore" + r[a].positionsSetCache.key(b.ignore)), r[a].pfGrid[d] || (r[a].pfGrid[d] = e(a, b, c)), |
|
r[a].pfGrid[d].clone(); |
|
} |
|
function g(a, b) { |
|
b = b || {}; |
|
var c = new n.PathFinder.CostMatrix(), d = u.clone(v.OBSTACLE_OBJECT_TYPES); |
|
return d.push("portal"), b.ignoreDestructibleStructures && (d = u.without(d, "constructedWall", "spawn", "extension", "link", "storage", "observer", "tower", "powerBank", "powerSpawn", "lab", "terminal")), |
|
b.ignoreCreeps && (d = u.without(d, "creep")), m.objectsByRoomKeys[a] && m.objectsByRoomKeys[a].forEach(function(e) { |
|
var f = m.objectsByRoom[a][e]; |
|
(u.contains(d, f.type) || !b.ignoreDestructibleStructures && "rampart" == f.type && f.user != k.user._id || !b.ignoreDestructibleStructures && "constructionSite" == f.type && f.user == k.user._id && u.contains(v.OBSTACLE_OBJECT_TYPES, f.structureType)) && c.set(f.x, f.y, 255), |
|
"swamp" == f.type && 0 == c.get(f.x, f.y) && c.set(f.x, f.y, b.ignoreRoads ? 5 : 10), |
|
!b.ignoreRoads && "road" == f.type && c.get(f.x, f.y) < 255 && c.set(f.x, f.y, 1); |
|
}), c; |
|
} |
|
function h(a, b) { |
|
if (!r[a]) return new n.PathFinder.CostMatrix(); |
|
var c = "grid2"; |
|
return b = b || {}, b.ignoreCreeps && (c += "_ignoreCreeps"), b.ignoreDestructibleStructures && (c += "_ignoreDestructibleStructures"), |
|
b.ignoreRoads && (c += "_ignoreRoads"), r[a].pfGrid[c] || (r[a].pfGrid[c] = g(a, b)), |
|
r[a].pfGrid[c]; |
|
} |
|
function i(a, b, c, d) { |
|
d = d || {}, d.avoid && (m.deprecated("`avoid` option cannot be used when `PathFinder.use()` is enabled. Use `costCallback` instead."), |
|
d.avoid = void 0), d.ignore && (m.deprecated("`ignore` option cannot be used when `PathFinder.use()` is enabled. Use `costCallback` instead."), |
|
d.ignore = void 0), void 0 === d.maxOps && (void 0 === d.maxRooms || d.maxRooms > 1) && b.roomName != c.roomName && (d.maxOps = 2e4); |
|
var e = { |
|
roomCallback: function(a) { |
|
var b = h(a, d); |
|
if ("function" == typeof d.costCallback) { |
|
b = b.clone(); |
|
var c = d.costCallback(a, b); |
|
c instanceof n.PathFinder.CostMatrix && (b = c); |
|
} |
|
return b; |
|
}, |
|
maxOps: d.maxOps, |
|
maxRooms: d.maxRooms |
|
}; |
|
d.ignoreRoads || (e.plainCost = 2, e.swampCost = 10); |
|
var f = n.PathFinder.search(b, { |
|
range: Math.max(1, d.range || 0), |
|
pos: c |
|
}, e); |
|
!d.range && (f.path.length && f.path[f.path.length - 1].isNearTo(c) && !f.path[f.path.length - 1].isEqualTo(c) || !f.path.length && b.isNearTo(c)) && f.path.push(c); |
|
for (var g = b.x, i = b.y, j = [], k = 0; k < f.path.length; k++) { |
|
var l = f.path[k]; |
|
if (l.roomName != a) break; |
|
var o = { |
|
x: l.x, |
|
y: l.y, |
|
dx: l.x - g, |
|
dy: l.y - i, |
|
direction: x.getDirection(l.x - g, l.y - i) |
|
}; |
|
g = o.x, i = o.y, j.push(o); |
|
} |
|
return d.serialize ? x.serializePath(j) : j; |
|
} |
|
function j(a, b, c) { |
|
if (c = c || {}, u.isNumber(b) && (b = m.rooms[a.roomName].find(b, { |
|
filter: c.filter |
|
})), !b.length) return null; |
|
var d = u.map(b, function(a) { |
|
return a.pos && (a = a.pos), { |
|
range: 1, |
|
pos: a |
|
}; |
|
}); |
|
c.avoid && m.deprecated("`avoid` option cannot be used when `PathFinder.use()` is enabled. Use `costCallback` instead."), |
|
c.ignore && m.deprecated("`ignore` option cannot be used when `PathFinder.use()` is enabled. Use `costCallback` instead."); |
|
var e = { |
|
roomCallback: function(a) { |
|
if (m.objectsByRoom[a]) { |
|
var b = h(a, c); |
|
return "function" == typeof c.costCallback && (b = b.clone(), c.costCallback(a, b)), |
|
b; |
|
} |
|
}, |
|
maxOps: c.maxOps, |
|
maxRooms: 1 |
|
}; |
|
c.ignoreRoads || (e.plainCost = 2, e.swampCost = 10); |
|
var f = n.PathFinder.search(a, d, e), g = null, i = a; |
|
return f.path.length && (i = f.path[f.path.length - 1]), b.forEach(function(a) { |
|
return i.isEqualTo(a) ? a : void (i.isNearTo(a) && (g = a)); |
|
}), g; |
|
} |
|
var k, l, m, n, o, p, q, r, s, t = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), u = a("lodash"), v = a("./constants"), w = a("../../../PathFinding.js/index"), x = a("./../utils"), y = Math.abs, z = (Math.min, |
|
Math.max); |
|
c.make = function(a, b, c, e) { |
|
function g(a) { |
|
var b, c = (z(a), a), d = a.match(/survival_(.*)$/); |
|
d && (c = d[1]), k.games && c in k.games && (b = k.games[c]), this.name = a, this.mode = "sim" == a ? v.MODE_SIMULATION : /^arena/.test(a) ? v.MODE_ARENA : /^survival/.test(a) ? v.MODE_SURVIVAL : v.MODE_WORLD, |
|
this.energyAvailable = 0, this.energyCapacityAvailable = 0, this.survivalInfo = b, |
|
r[a] = { |
|
pfGrid: {}, |
|
pfFinders: {}, |
|
pfEndNodes: {}, |
|
pfDijkstraFinder: new w.DijkstraFinder({ |
|
diagonalMovement: 1 |
|
}), |
|
pathCache: {}, |
|
positionsSetCache: { |
|
cache: {}, |
|
key: function e(b) { |
|
if (!u.isArray(b)) return 0; |
|
var c = u.map(b, function(b) { |
|
return b && b.pos ? b.pos : !u.isObject(b) || u.isUndefined(b.x) || b instanceof n.RoomPosition ? b : new n.RoomPosition(b.x, b.y, a); |
|
}), e = u.findKey(this.cache, function(a) { |
|
return c.length == a.length && u.every(c, function(b) { |
|
return u.any(a, function(a) { |
|
if (!u.isObject(b) || !b.isEqualTo) throw new Error("Invalid position " + b + ", check your `opts` property"); |
|
return b.isEqualTo(a); |
|
}); |
|
}); |
|
}); |
|
return void 0 === e ? (e = o++, this.cache[e] = u.clone(b)) : e = parseInt(e), e; |
|
} |
|
}, |
|
lookTypeRegisters: { |
|
creep: m.byRoom[a].creeps, |
|
energy: m.byRoom[a].energy, |
|
resource: m.byRoom[a].energy, |
|
source: m.byRoom[a].sources, |
|
mineral: m.byRoom[a].minerals, |
|
structure: m.byRoom[a].structures, |
|
flag: m.byRoom[a].flags, |
|
constructionSite: m.byRoom[a].constructionSites, |
|
nuke: m.byRoom[a].nukes |
|
}, |
|
lookTypeSpatialRegisters: { |
|
creep: m.byRoom[a].spatial.creeps, |
|
energy: m.byRoom[a].spatial.energy, |
|
resource: m.byRoom[a].spatial.energy, |
|
source: m.byRoom[a].spatial.sources, |
|
mineral: m.byRoom[a].spatial.minerals, |
|
structure: m.byRoom[a].spatial.structures, |
|
flag: m.byRoom[a].spatial.flags, |
|
constructionSite: m.byRoom[a].spatial.constructionSites, |
|
nuke: m.byRoom[a].spatial.nukes |
|
} |
|
}; |
|
} |
|
function h(a, b, c, d, e) { |
|
if ("terrain" == b) { |
|
var f = "plain", g = k.staticTerrainData[a][50 * d + c]; |
|
return g & v.TERRAIN_MASK_SWAMP && (f = "swamp"), g & v.TERRAIN_MASK_WALL && (f = "wall"), |
|
e ? void e.push({ |
|
type: "terrain", |
|
terrain: f |
|
}) : [ f ]; |
|
} |
|
if (0 > c || 0 > d || c > 49 || d > 49) throw new Error("look coords are out of bounds"); |
|
var h, i = r[a].lookTypeSpatialRegisters[b][d][c]; |
|
return i ? e ? void i.forEach(function(a) { |
|
h = { |
|
type: b |
|
}, h[b] = a, e.push(h); |
|
}) : u.clone(i) : []; |
|
} |
|
function j(a, b, c, d, e, f, g) { |
|
var i = r[a].lookTypeRegisters[b], j = i && Object.keys(i); |
|
if ("terrain" != b && j.length < (e - c + 1) * (f - d + 1)) { |
|
var k, l = !g[c][d], m = function(b) { |
|
return (!b.pos && b.roomName == a || b.pos && b.pos.roomName == a) && b.pos && b.pos.y >= c && b.pos.y <= e && b.pos.x >= d && b.pos.x <= f || !b.pos && b.y >= c && b.y <= e && b.x >= d && b.x <= f; |
|
}; |
|
j.forEach(function(a) { |
|
var c = i[a]; |
|
m(c) && (l ? (g[c.y || c.pos.y][c.x || c.pos.x] = g[c.y || c.pos.y][c.x || c.pos.x] || [], |
|
g[c.y || c.pos.y][c.x || c.pos.x].push(c)) : (k = { |
|
type: b |
|
}, k[b] = c, g[c.y || c.pos.y][c.x || c.pos.x].push(k))); |
|
}); |
|
} else for (var n = c; e >= n; n++) for (var o = d; f >= o; o++) g[n][o] ? h(a, b, o, n, g[n][o]) : g[n][o] = h(a, b, o, n); |
|
} |
|
if (k = a, l = b, m = c, n = e, o = 1, p = [], q = [], r = {}, s = 0, !n.Room) { |
|
var z = function(a) { |
|
if (!k.rooms[a]) throw new Error("Could not find a room with name " + a); |
|
return k.rooms[a]; |
|
}; |
|
g.serializePath = function(a) { |
|
return x.serializePath(a); |
|
}, g.deserializePath = function(a) { |
|
return x.deserializePath(a); |
|
}, g.prototype.toString = function() { |
|
return "[room " + this.name + "]"; |
|
}, g.prototype.toJSON = function() { |
|
var a = {}; |
|
for (var b in this) "_" == b[0] || u.contains([ "toJSON", "toString", "controller", "storage", "terminal" ], b) || (a[b] = this[b]); |
|
return a; |
|
}, Object.defineProperty(g.prototype, "memory", { |
|
get: function() { |
|
return (u.isUndefined(n.Memory.rooms) || "undefined" === n.Memory.rooms) && (n.Memory.rooms = {}), |
|
u.isObject(n.Memory.rooms) ? n.Memory.rooms[this.name] = n.Memory.rooms[this.name] || {} : void 0; |
|
}, |
|
set: function(a) { |
|
if ((u.isUndefined(n.Memory.rooms) || "undefined" === n.Memory.rooms) && (n.Memory.rooms = {}), |
|
!u.isObject(n.Memory.rooms)) throw new Error("Could not set room memory"); |
|
n.Memory.rooms[this.name] = a; |
|
} |
|
}), g.prototype.find = function(a, b) { |
|
var c = this, d = []; |
|
if (b = b || {}, m.findCache[a] && m.findCache[a][this.name]) d = m.findCache[a][this.name]; else switch (a) { |
|
case v.FIND_EXIT: |
|
return m.findCache[a] = m.findCache[a] || {}, m.findCache[a][this.name] = this.find(v.FIND_EXIT_TOP, b).concat(this.find(v.FIND_EXIT_BOTTOM, b)).concat(this.find(v.FIND_EXIT_RIGHT, b)).concat(this.find(v.FIND_EXIT_LEFT, b)), |
|
u.clone(m.findCache[a][this.name]); |
|
|
|
case v.FIND_EXIT_TOP: |
|
case v.FIND_EXIT_RIGHT: |
|
case v.FIND_EXIT_BOTTOM: |
|
case v.FIND_EXIT_LEFT: |
|
m.findCache[a] = m.findCache[a] || {}; |
|
for (var e = [], f = 0; 50 > f; f++) { |
|
var g = 0, h = 0; |
|
a == v.FIND_EXIT_LEFT || a == v.FIND_EXIT_RIGHT ? h = f : g = f, a == v.FIND_EXIT_RIGHT && (g = 49), |
|
a == v.FIND_EXIT_BOTTOM && (h = 49), e.push(!(k.staticTerrainData[this.name][50 * h + g] & v.TERRAIN_MASK_WALL)); |
|
} |
|
d = u.reduce(e, function(b, d, e) { |
|
return d && (a == v.FIND_EXIT_TOP && b.push(c.getPositionAt(e, 0)), a == v.FIND_EXIT_BOTTOM && b.push(c.getPositionAt(e, 49)), |
|
a == v.FIND_EXIT_LEFT && b.push(c.getPositionAt(0, e)), a == v.FIND_EXIT_RIGHT && b.push(c.getPositionAt(49, e))), |
|
b; |
|
}, []), m.findCache[a][this.name] = d; |
|
} |
|
return d = b.filter ? u.filter(d, b.filter) : u.clone(d); |
|
}, g.prototype.lookAt = function(a, b) { |
|
var c = x.fetchXYArguments(a, b, n), d = t(c, 2), e = d[0], f = d[1], g = []; |
|
return h(this.name, v.LOOK_CREEPS, e, f, g), h(this.name, v.LOOK_ENERGY, e, f, g), |
|
h(this.name, v.LOOK_RESOURCES, e, f, g), h(this.name, v.LOOK_SOURCES, e, f, g), |
|
h(this.name, v.LOOK_MINERALS, e, f, g), h(this.name, v.LOOK_STRUCTURES, e, f, g), |
|
h(this.name, v.LOOK_FLAGS, e, f, g), h(this.name, v.LOOK_CONSTRUCTION_SITES, e, f, g), |
|
h(this.name, v.LOOK_TERRAIN, e, f, g), h(this.name, v.LOOK_NUKES, e, f, g), g; |
|
}, g.prototype.lookForAt = function(a, b, c) { |
|
var d = x.fetchXYArguments(b, c, n), e = t(d, 2), f = e[0], g = e[1]; |
|
return "terrain" == a || a in r[this.name].lookTypeSpatialRegisters ? h(this.name, a, f, g) : v.ERR_INVALID_ARGS; |
|
}, g.prototype.lookAtArea = function(a, b, c, d) { |
|
for (var e = {}, f = a; c >= f; f++) { |
|
e[f] = {}; |
|
for (var g = b; d >= g; g++) e[f][g] = []; |
|
} |
|
return j(this.name, v.LOOK_CREEPS, a, b, c, d, e), j(this.name, v.LOOK_ENERGY, a, b, c, d, e), |
|
j(this.name, v.LOOK_RESOURCES, a, b, c, d, e), j(this.name, v.LOOK_SOURCES, a, b, c, d, e), |
|
j(this.name, v.LOOK_MINERALS, a, b, c, d, e), j(this.name, v.LOOK_STRUCTURES, a, b, c, d, e), |
|
j(this.name, v.LOOK_FLAGS, a, b, c, d, e), j(this.name, v.LOOK_CONSTRUCTION_SITES, a, b, c, d, e), |
|
j(this.name, v.LOOK_TERRAIN, a, b, c, d, e), j(this.name, v.LOOK_NUKES, a, b, c, d, e), |
|
e; |
|
}, g.prototype.lookForAtArea = function(a, b, c, d, e) { |
|
for (var f = {}, g = b; d >= g; g++) f[g] = {}; |
|
return j(this.name, a, b, c, d, e, f), f; |
|
}, g.prototype.findPath = function(a, b, c) { |
|
if (a.roomName != this.name) return c.serialize ? "" : []; |
|
if (m._useNewPathFinder) return i(this.name, a, b, c); |
|
var e, g = a.x, h = a.y, j = ""; |
|
if (c = u.clone(c || {}), c.ignoreCreeps && (j += "_ignoreCreeps"), c.ignoreDestructibleStructures && (j += "_ignoreDestructibleStructures"), |
|
c.avoid && (j += "_avoid" + r[this.name].positionsSetCache.key(c.avoid)), c.ignore && (j += "_ignore" + r[this.name].positionsSetCache.key(c.ignore)), |
|
u.isNumber(b)) { |
|
if (!r[this.name].pfEndNodes[b]) return c.serialize ? "" : []; |
|
var k = f(this.name, c, b); |
|
e = r[this.name].pfDijkstraFinder.findPath(g, h, -999, -999, k); |
|
} else { |
|
if (b.roomName != this.name) return c.serialize ? "" : []; |
|
var l = b.x, n = b.y, o = g + "," + h + "," + l + "," + n + j; |
|
if (r[this.name].pathCache[o]) return c.serialize ? x.serializePath(r[this.name].pathCache[o]) : u.cloneDeep(r[this.name].pathCache[o]); |
|
if (g == l && h == n) return c.serialize ? "" : []; |
|
if (0 > g || 0 > h || 0 > l || 0 > n || g >= 50 || h >= 50 || l >= 50 || n >= 50) return c.serialize ? "" : []; |
|
if (y(g - l) < 2 && y(h - n) < 2) { |
|
var p = [ { |
|
x: l, |
|
y: n, |
|
dx: l - g, |
|
dy: n - h, |
|
direction: x.getDirection(l - g, n - h) |
|
} ]; |
|
return c.serialize ? x.serializePath(p) : p; |
|
} |
|
var k = f(this.name, c), q = d(this.name, c); |
|
k.setWalkableAt(l, n, !0), e = q.findPath(g, h, l, n, k); |
|
} |
|
e.splice(0, 1); |
|
var s = g, t = h, v = u.map(e, function(a) { |
|
var b = { |
|
x: a[0], |
|
y: a[1], |
|
dx: a[0] - s, |
|
dy: a[1] - t, |
|
direction: x.getDirection(a[0] - s, a[1] - t) |
|
}; |
|
return s = b.x, t = b.y, b; |
|
}); |
|
if (v.length > 0) { |
|
var w = v[v.length - 1], o = g + "," + h + "," + w.x + "," + w.y + j; |
|
r[this.name].pathCache[o] = u.cloneDeep(v); |
|
} |
|
return c.serialize ? x.serializePath(v) : v; |
|
}, g.prototype.getPositionAt = function(a, b) { |
|
return 0 > a || a > 49 || 0 > b || b > 49 ? null : new n.RoomPosition(a, b, this.name); |
|
}, g.prototype.createFlag = function(a, b, c, d, e) { |
|
var f = x.fetchXYArguments(a, b, n), g = t(f, 2), h = g[0], i = g[1]; |
|
if (u.isUndefined(h) || u.isUndefined(i) || 0 > h || h > 49 || 0 > i || i > 49) return v.ERR_INVALID_ARGS; |
|
if (u.isObject(a) && (e = d, d = c, c = b), d || (d = v.COLOR_WHITE), e || (e = d), |
|
!u.contains(v.COLORS_ALL, d)) return v.ERR_INVALID_ARGS; |
|
if (!u.contains(v.COLORS_ALL, e)) return v.ERR_INVALID_ARGS; |
|
if (!c) { |
|
var j = 1; |
|
do c = "Flag" + j, j++; while (u.any(m.flags, { |
|
name: c |
|
}) || -1 != p.indexOf(c)); |
|
} |
|
return u.any(m.flags, { |
|
name: c |
|
}) || -1 != p.indexOf(c) ? v.ERR_NAME_EXISTS : (p.push(c), l.pushByName("room", "createFlag", { |
|
roomName: this.name, |
|
x: h, |
|
y: i, |
|
name: c, |
|
color: d, |
|
secondaryColor: e |
|
}), c); |
|
}, g.prototype.createConstructionSite = function(a, b, c) { |
|
var d = x.fetchXYArguments(a, b, n), e = t(d, 2), f = e[0], g = e[1]; |
|
if (u.isUndefined(f) || u.isUndefined(g) || 0 > f || f > 49 || 0 > g || g > 49) return v.ERR_INVALID_ARGS; |
|
if (u.isString(b) && u.isUndefined(c) && (c = b), !v.CONSTRUCTION_COST[c]) return v.ERR_INVALID_ARGS; |
|
if (this.controller && this.controller.level > 0 && !this.controller.my) return v.ERR_RCL_NOT_ENOUGH; |
|
if (!x.checkControllerAvailability(c, m.objectsByRoom[this.name], this.controller)) return v.ERR_RCL_NOT_ENOUGH; |
|
if (!x.checkConstructionSite(m.objectsByRoom[this.name], c, f, g) || !x.checkConstructionSite(k.staticTerrainData[this.name], c, f, g)) return v.ERR_INVALID_TARGET; |
|
if (this.mode == v.MODE_ARENA) return v.ERR_INVALID_TARGET; |
|
if (u(k.userObjects).filter({ |
|
type: "constructionSite" |
|
}).size() + s >= v.MAX_CONSTRUCTION_SITES) return v.ERR_FULL; |
|
var h = { |
|
roomName: this.name, |
|
x: f, |
|
y: g, |
|
structureType: c |
|
}; |
|
if ("spawn" == c) { |
|
var i, j = 1; |
|
do i = "Spawn" + j, j++; while (u.any(m.spawns, { |
|
name: i |
|
}) || u.any(m.constructionSites, { |
|
structureType: "spawn", |
|
name: i |
|
}) || -1 != q.indexOf(i)); |
|
q.push(i), h.name = i; |
|
} |
|
return s++, l.pushByName("room", "createConstructionSite", h), v.OK; |
|
}, g.prototype.getEndNodes = function(a, b) { |
|
var c; |
|
if (b = b || {}, u.isUndefined(a)) throw new Error("Find type cannot be undefined"); |
|
return !b.filter && u.isNumber(a) ? c = a : (u.isNumber(a) && (a = this.find(a, b)), |
|
c = r[this.name].positionsSetCache.key(a), r[this.name].pfEndNodes[c] = r[this.name].positionsSetCache.cache[c]), |
|
r[this.name].pfEndNodes[c] || (r[this.name].pfEndNodes[c] = u.clone(a), u.isNumber(a) && (r[this.name].pfEndNodes[c] = this.find(a, b))), |
|
{ |
|
key: c, |
|
objects: r[this.name].pfEndNodes[c] |
|
}; |
|
}, g.prototype.findExitTo = function(a) { |
|
return m.map.findExit(this.name, a); |
|
}, n.Room = g; |
|
} |
|
}, c.makePos = function(a) { |
|
function b(a, b, c) { |
|
if (a = +a, b = +b, u.isNaN(a) || u.isNaN(b) || !u.isString(c)) throw new Error("invalid arguments in RoomPosition constructor"); |
|
this.x = a, this.y = b, this.roomName = c; |
|
} |
|
function c(a, b, c) { |
|
this.room = m.rooms[c], this.pos = new n.RoomPosition(a, b, c); |
|
} |
|
m = a, n.RoomPosition || (b.prototype.toString = function() { |
|
return "[room " + this.roomName + " pos " + this.x + "," + this.y + "]"; |
|
}, b.prototype.inRangeTo = function(a, b, c) { |
|
var d = a, e = b, f = c, g = this.roomName; |
|
if (u.isUndefined(c)) { |
|
var h = a; |
|
h.pos && (h = h.pos), d = h.x, e = h.y, g = h.roomName, f = b; |
|
} |
|
return y(d - this.x) <= f && y(e - this.y) <= f && g == this.roomName; |
|
}, b.prototype.isNearTo = function(a, b) { |
|
var c = x.fetchXYArguments(a, b, n), d = t(c, 3), e = d[0], f = d[1], g = d[2]; |
|
return y(e - this.x) <= 1 && y(f - this.y) <= 1 && (!g || g == this.roomName); |
|
}, b.prototype.getDirectionTo = function(a, b) { |
|
var c = x.fetchXYArguments(a, b, n), d = t(c, 2), e = d[0], f = d[1]; |
|
return x.getDirection(e - this.x, f - this.y); |
|
}, b.prototype.findPathTo = function(a, b, c) { |
|
var d = x.fetchXYArguments(a, b, n), e = t(d, 3), f = e[0], g = e[1], h = e[2], i = m.rooms[this.roomName]; |
|
if (u.isObject(b) && (c = u.clone(b)), c = c || {}, h = h || this.roomName, !i) throw new Error("Could not access room " + this.roomName); |
|
if (h == this.roomName || m._useNewPathFinder) return i.findPath(this, new n.RoomPosition(f, g, h), c); |
|
var j = i.findExitTo(h); |
|
if (0 > j) return []; |
|
var k = this.findClosestByPath(j, c); |
|
return k ? i.findPath(this, k, c) : []; |
|
}, b.prototype.findClosestByPath = function(a, b) { |
|
var c = this; |
|
b = u.clone(b || {}); |
|
var d = m.rooms[this.roomName]; |
|
if (!d) throw new Error("Could not access room " + this.roomName); |
|
if (u.isUndefined(a)) return null; |
|
if (m._useNewPathFinder) return j(this, a, b); |
|
b.serialize = !1; |
|
var e, f = null, g = d.getEndNodes(a, b); |
|
if (!b.algorithm) { |
|
var h, i = 0; |
|
g.objects.forEach(function(a) { |
|
var b = a.x, d = a.y, e = a.roomName; |
|
a.pos && (b = a.pos.x, d = a.pos.y, e = a.pos.roomName); |
|
var f = z(y(c.x - b), y(c.y - d)); |
|
(u.isUndefined(h) || h > f) && (h = f), i += f; |
|
}), b.algorithm = i > 10 * h ? "dijkstra" : "astar"; |
|
} |
|
if ("dijkstra" == b.algorithm && (e = 1, g.objects.forEach(function(a) { |
|
var b = c.isEqualTo(a) ? -1 : c.isNearTo(a) ? 0 : 1; |
|
e > b && (f = a, e = b); |
|
}), 1 == e)) { |
|
var k = d.findPath(this, g.key, b); |
|
if (k.length > 0) { |
|
var l = k[k.length - 1], n = d.getPositionAt(l.x, l.y); |
|
f = u.find(g.objects, function(a) { |
|
return n.isEqualTo(a); |
|
}); |
|
} |
|
} |
|
return "astar" == b.algorithm && g.objects.forEach(function(a) { |
|
var g, h = c.isEqualTo(a) ? -1 : c.isNearTo(a) ? 0 : (g = c.findPathTo(a, b)) && g.length > 0 && d.getPositionAt(g[g.length - 1].x, g[g.length - 1].y).isNearTo(a) ? g.length : void 0; |
|
(u.isUndefined(e) || e >= h) && !u.isUndefined(h) && (e = h, f = a); |
|
}), f; |
|
}, b.prototype.findInRange = function(a, b, c) { |
|
var d = this, e = m.rooms[this.roomName]; |
|
if (!e) throw new Error("Could not access room " + this.roomName); |
|
c = u.clone(c || {}); |
|
var f = [], g = []; |
|
return u.isNumber(a) && (f = e.find(a, c)), u.isArray(a) && (f = a), f.forEach(function(a) { |
|
d.inRangeTo(a, b) && g.push(a); |
|
}), g; |
|
}, b.prototype.findClosestByRange = function(a, b) { |
|
var c = this, d = m.rooms[this.roomName]; |
|
if (!d) throw new Error("Could not access room " + this.roomName); |
|
b = u.clone(b || {}); |
|
var e = []; |
|
u.isNumber(a) && (e = d.find(a, b)), u.isArray(a) && (e = a); |
|
var f = null, g = 1 / 0; |
|
return e.forEach(function(a) { |
|
var b = c.getRangeTo(a); |
|
g > b && (g = b, f = a); |
|
}), f; |
|
}, b.prototype.isEqualTo = function(a, b) { |
|
var c = x.fetchXYArguments(a, b, n), d = t(c, 3), e = d[0], f = d[1], g = d[2]; |
|
return e == this.x && f == this.y && (!g || g == this.roomName); |
|
}, b.prototype.getRangeTo = function(a, b) { |
|
var c = x.fetchXYArguments(a, b, n), d = t(c, 3), e = d[0], f = d[1], g = d[2]; |
|
return g && g != this.roomName ? 1 / 0 : z(y(this.x - e), y(this.y - f)); |
|
}, b.prototype.look = function() { |
|
var a = m.rooms[this.roomName]; |
|
if (!a) throw new Error("Could not access room " + this.roomName); |
|
return a.lookAt(this); |
|
}, b.prototype.lookFor = function(a) { |
|
if ("terrain" == a) return m.map.getTerrainAt(this); |
|
var b = m.rooms[this.roomName]; |
|
if (!b) throw new Error("Could not access room " + this.roomName); |
|
return b.lookForAt(a, this); |
|
}, b.prototype.createFlag = function(a, b, c) { |
|
var d = m.rooms[this.roomName]; |
|
if (!d) throw new Error("Could not access room " + this.roomName); |
|
return d.createFlag(this, a, b, c); |
|
}, b.prototype.createConstructionSite = function(a) { |
|
var b = m.rooms[this.roomName]; |
|
if (!b) throw new Error("Could not access room " + this.roomName); |
|
return b.createConstructionSite(this, a); |
|
}, n.RoomPosition = b, n.RoomObject = c); |
|
}; |
|
}, { |
|
"../../../PathFinding.js/index": 1, |
|
"./../utils": 140, |
|
"./constants": 40, |
|
lodash: 60 |
|
} ], |
|
55: [ function(a, b, c) { |
|
"use strict"; |
|
var d, e, f, g, h = a("./../utils"); |
|
a("./rooms"), a("./constants"); |
|
c.make = function(a, b, c, i) { |
|
if (d = a, e = b, f = c, g = i, !g.Source) { |
|
var j = function(a) { |
|
if (!d.roomObjects[a]) throw new Error("Could not find an object with ID " + a); |
|
return d.roomObjects[a]; |
|
}, k = function(a) { |
|
var b = j(a); |
|
g.RoomObject.call(this, b.x, b.y, b.room), this.id = a; |
|
}; |
|
k.prototype = Object.create(g.RoomObject.prototype), k.prototype.constructor = k, |
|
h.defineGameObjectProperties(k.prototype, j, { |
|
energy: function(a) { |
|
return a.energy; |
|
}, |
|
energyCapacity: function(a) { |
|
return a.energyCapacity; |
|
}, |
|
ticksToRegeneration: function(a) { |
|
return a.nextRegenerationTime ? a.nextRegenerationTime - d.time : void 0; |
|
} |
|
}), k.prototype.toString = function() { |
|
return "[source #" + this.id + "]"; |
|
}, g.Source = k; |
|
} |
|
}; |
|
}, { |
|
"./../utils": 140, |
|
"./constants": 40, |
|
"./rooms": 54 |
|
} ], |
|
56: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a) { |
|
if (!h.roomObjects[a]) throw new Error("Could not find an object with ID " + a); |
|
return h.roomObjects[a]; |
|
} |
|
function e(a) { |
|
var b = { |
|
energy: a.energy |
|
}; |
|
return o.RESOURCES_ALL.forEach(function(c) { |
|
a[c] && (b[c] = a[c]); |
|
}), b; |
|
} |
|
function f(a, b, c) { |
|
return a && a.id && j.creeps[a.id] && a instanceof k.Creep ? a.my ? this.my === !1 && p.any(this.pos.lookFor("structure"), function(a) { |
|
return a.structureType == o.STRUCTURE_RAMPART; |
|
}) ? o.ERR_NOT_OWNER : d(this.id)[b] ? (c || (c = Math.min(d(this.id)[b], d(a.id).energyCapacity - n.calcResources(d(a.id)))), |
|
d(this.id)[b] < c || 0 > c ? o.ERR_NOT_ENOUGH_ENERGY : d(a.id).energyCapacity && (!c || n.calcResources(d(a.id)) + c > d(a.id).energyCapacity) ? o.ERR_FULL : a.pos.isNearTo(this.pos) ? (i.set(d(this.id)._id, "transfer", { |
|
id: a.id, |
|
amount: c, |
|
resourceType: b |
|
}), o.OK) : o.ERR_NOT_IN_RANGE) : o.ERR_NOT_ENOUGH_ENERGY : o.ERR_NOT_OWNER : o.ERR_INVALID_TARGET; |
|
} |
|
function g(a, b) { |
|
return a && a.id && j.creeps[a.id] && a instanceof k.Creep ? a.my ? this.my === !1 && p.any(this.pos.lookFor("structure"), function(a) { |
|
return a.structureType == o.STRUCTURE_RAMPART; |
|
}) ? o.ERR_NOT_OWNER : d(this.id).energy ? (b || (b = d(a.id).energyCapacity ? Math.min(d(this.id).energy, d(a.id).energyCapacity - n.calcResources(d(a.id))) : d(this.id).energy), |
|
this.energy < b || 0 > b ? o.ERR_NOT_ENOUGH_ENERGY : d(a.id).energyCapacity && (!b || n.calcResources(d(a.id)) + b > d(a.id).energyCapacity) ? o.ERR_FULL : a.pos.isNearTo(this.pos) ? (i.set(this.id, "transfer", { |
|
id: a.id, |
|
amount: b, |
|
resourceType: "energy" |
|
}), o.OK) : o.ERR_NOT_IN_RANGE) : o.ERR_NOT_ENOUGH_ENERGY : o.ERR_NOT_OWNER : o.ERR_INVALID_TARGET; |
|
} |
|
var h, i, j, k, l, m = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), n = a("./../utils"), o = (a("./rooms"), a("./constants")), p = a("lodash"); |
|
c.make = function(b, c, q, r) { |
|
if (h = b, i = c, j = q, k = r, l = [], !k.Structure) { |
|
var s = function(a) { |
|
var b = d(a); |
|
k.RoomObject.call(this, b.x, b.y, b.room), this.id = a; |
|
var c = d(a); |
|
c.type == o.STRUCTURE_CONTROLLER && (j.rooms[c.room].controller = this), c.type == o.STRUCTURE_STORAGE && (j.rooms[c.room].storage = this), |
|
c.type == o.STRUCTURE_TERMINAL && (j.rooms[c.room].terminal = this); |
|
}; |
|
s.prototype = Object.create(k.RoomObject.prototype), s.prototype.constructor = s, |
|
n.defineGameObjectProperties(s.prototype, d, { |
|
hits: function(a) { |
|
return a.hits; |
|
}, |
|
hitsMax: function(a) { |
|
return a.hitsMax; |
|
}, |
|
structureType: function(a) { |
|
return a.type; |
|
} |
|
}), s.prototype.toString = function() { |
|
return "[structure (" + d(this.id).type + ") #" + this.id + "]"; |
|
}, s.prototype.destroy = function() { |
|
return this.room.controller && this.room.controller.my ? this.room.find(o.FIND_HOSTILE_CREEPS).length > 0 ? o.ERR_BUSY : (i.pushByName("room", "destroyStructure", { |
|
roomName: this.room.name, |
|
id: this.id |
|
}), o.OK) : o.ERR_NOT_OWNER; |
|
}, s.prototype.notifyWhenAttacked = function(a) { |
|
return this.my === !1 || this.room.controller && !this.room.controller.my ? o.ERR_NOT_OWNER : p.isBoolean(a) ? (a != d(this.id).notifyWhenAttacked && i.set(this.id, "notifyWhenAttacked", { |
|
enabled: a |
|
}), o.OK) : o.ERR_INVALID_ARGS; |
|
}, s.prototype.isActive = function() { |
|
return this.owner && o.CONTROLLER_STRUCTURES[d(this.id).type] ? this.room.controller ? n.checkStructureAgainstController(d(this.id), j.objectsByRoom[d(this.id).room], d(this.room.controller.id)) : !1 : !0; |
|
}, k.Structure = s; |
|
var t = function(a) { |
|
s.call(this, a); |
|
}; |
|
t.prototype = Object.create(s.prototype), t.prototype.constructor = t, n.defineGameObjectProperties(t.prototype, d, { |
|
owner: function(a) { |
|
return p.isUndefined(a.user) || null === a.user ? void 0 : { |
|
username: h.users[a.user].username |
|
}; |
|
}, |
|
my: function(a) { |
|
return p.isUndefined(a.user) ? void 0 : a.user == h.user._id; |
|
} |
|
}), k.OwnedStructure = t; |
|
var u = function(a) { |
|
s.call(this, a); |
|
}; |
|
u.prototype = Object.create(s.prototype), u.prototype.constructor = u, n.defineGameObjectProperties(u.prototype, d, { |
|
store: e, |
|
storeCapacity: function(a) { |
|
return a.energyCapacity; |
|
} |
|
}), u.prototype.transfer = f, k.StructureContainer = u; |
|
var v = function(a) { |
|
t.call(this, a); |
|
}; |
|
v.prototype = Object.create(t.prototype), v.prototype.constructor = v, n.defineGameObjectProperties(v.prototype, d, { |
|
ticksToDowngrade: function(a) { |
|
return a.downgradeTime ? a.downgradeTime - h.time : void 0; |
|
}, |
|
reservation: function(a) { |
|
return a.reservation ? { |
|
username: h.users[a.reservation.user].username, |
|
ticksToEnd: a.reservation.endTime - h.time |
|
} : void 0; |
|
}, |
|
level: function(a) { |
|
return a.level; |
|
}, |
|
progress: function(a) { |
|
return a.level > 0 ? a.progress : void 0; |
|
}, |
|
progressTotal: function(a) { |
|
return a.level > 0 && a.level < 8 ? o.CONTROLLER_LEVELS[a.level] : void 0; |
|
}, |
|
upgradeBlocked: function(a) { |
|
return a.upgradeBlocked && a.upgradeBlocked > h.time ? a.upgradeBlocked - h.time : void 0; |
|
} |
|
}), v.prototype.unclaim = function() { |
|
return this.my ? (i.set(this.id, "unclaim", {}), o.OK) : o.ERR_NOT_OWNER; |
|
}, k.StructureController = v; |
|
var w = function(a) { |
|
t.call(this, a); |
|
}; |
|
w.prototype = Object.create(t.prototype), w.prototype.constructor = w, n.defineGameObjectProperties(w.prototype, d, { |
|
energy: function(a) { |
|
return a.energy; |
|
}, |
|
energyCapacity: function(a) { |
|
return a.energyCapacity; |
|
} |
|
}), w.prototype.transferEnergy = g, k.StructureExtension = w; |
|
var x = function(a) { |
|
t.call(this, a); |
|
}; |
|
x.prototype = Object.create(t.prototype), x.prototype.constructor = x, k.StructureExtractor = x; |
|
var y = function(a) { |
|
t.call(this, a); |
|
}; |
|
y.prototype = Object.create(t.prototype), y.prototype.constructor = y, n.defineGameObjectProperties(y.prototype, d, { |
|
my: function() { |
|
return !1; |
|
}, |
|
owner: function() { |
|
return { |
|
username: "Source Keeper" |
|
}; |
|
}, |
|
ticksToSpawn: function(a) { |
|
return a.nextSpawnTime ? a.nextSpawnTime - h.time : void 0; |
|
} |
|
}), k.StructureKeeperLair = y; |
|
var z = function(a) { |
|
t.call(this, a); |
|
}; |
|
z.prototype = Object.create(t.prototype), z.prototype.constructor = z, n.defineGameObjectProperties(z.prototype, d, { |
|
energy: function(a) { |
|
return a.energy; |
|
}, |
|
energyCapacity: function(a) { |
|
return a.energyCapacity; |
|
}, |
|
cooldown: function(a) { |
|
return a.cooldown; |
|
}, |
|
mineralAmount: function(a) { |
|
return a.mineralAmount; |
|
}, |
|
mineralCapacity: function(a) { |
|
return a.mineralCapacity; |
|
}, |
|
mineralType: function(a) { |
|
return a.mineralType; |
|
} |
|
}), z.prototype.transfer = function(a, b, c) { |
|
if (!(a && a.id && j.creeps[a.id] && a instanceof k.Creep)) return o.ERR_INVALID_TARGET; |
|
if (!a.my) return o.ERR_NOT_OWNER; |
|
if (this.my === !1 && p.any(this.pos.lookFor("structure"), function(a) { |
|
return a.structureType == o.STRUCTURE_RAMPART; |
|
})) return o.ERR_NOT_OWNER; |
|
if (b != o.RESOURCE_ENERGY && d(this.id).mineralType != b) return o.ERR_INVALID_ARGS; |
|
var e = b == o.RESOURCE_ENERGY ? d(this.id).energy : d(this.id).mineralAmount; |
|
return e ? (c || (c = Math.min(e, d(a.id).energyCapacity - n.calcResources(d(a.id)))), |
|
c > e || 0 > c ? o.ERR_NOT_ENOUGH_ENERGY : d(a.id).energyCapacity && (!c || n.calcResources(d(a.id)) + c > d(a.id).energyCapacity) ? o.ERR_FULL : a.pos.isNearTo(this.pos) ? (i.set(d(this.id)._id, "transfer", { |
|
id: a.id, |
|
amount: c, |
|
resourceType: b |
|
}), o.OK) : o.ERR_NOT_IN_RANGE) : o.ERR_NOT_ENOUGH_RESOURCES; |
|
}, z.prototype.runReaction = function(a, b) { |
|
return this.my ? this.cooldown > 0 ? o.ERR_TIRED : n.checkStructureAgainstController(d(this.id), j.objectsByRoom[d(this.id).room], d(this.room.controller.id)) ? a && a.id && j.structures[a.id] && a instanceof k.Structure && a.structureType == o.STRUCTURE_LAB && a.id != this.id && b && a.id && j.structures[b.id] && b instanceof k.Structure && b.structureType == o.STRUCTURE_LAB && b.id != this.id ? this.pos.getRangeTo(a) > 2 || this.pos.getRangeTo(b) > 2 ? o.ERR_NOT_IN_RANGE : this.mineralAmount > this.mineralCapacity - o.LAB_COOLDOWN ? o.ERR_FULL : a.mineralAmount < o.LAB_COOLDOWN || b.mineralAmount < o.LAB_COOLDOWN ? o.ERR_NOT_ENOUGH_RESOURCES : !o.REACTIONS[a.mineralType][b.mineralType] || this.mineralType && this.mineralType != o.REACTIONS[a.mineralType][b.mineralType] ? o.ERR_INVALID_ARGS : (i.set(this.id, "runReaction", { |
|
lab1: a.id, |
|
lab2: b.id |
|
}), o.OK) : o.ERR_INVALID_TARGET : o.ERR_RCL_NOT_ENOUGH : o.ERR_NOT_OWNER; |
|
}, z.prototype.boostCreep = function(a, b) { |
|
var c = this; |
|
if (!this.my) return o.ERR_NOT_OWNER; |
|
if (!n.checkStructureAgainstController(d(this.id), j.objectsByRoom[d(this.id).room], d(this.room.controller.id))) return o.ERR_RCL_NOT_ENOUGH; |
|
if (!(a && a.id && j.creeps[a.id] && a instanceof k.Creep)) return o.ERR_INVALID_TARGET; |
|
if (!this.pos.isNearTo(a)) return o.ERR_NOT_IN_RANGE; |
|
if (d(this.id).energy < o.LAB_BOOST_ENERGY) return o.ERR_NOT_ENOUGH_RESOURCES; |
|
if (d(this.id).mineralAmount < o.LAB_BOOST_MINERAL) return o.ERR_NOT_ENOUGH_RESOURCES; |
|
b = b || 0; |
|
var e = p(a.body).filter(function(a) { |
|
return !a.boost && o.BOOSTS[a.type][d(c.id).mineralType]; |
|
}).size(); |
|
return !e || b && b > e ? o.ERR_NOT_FOUND : (i.set(this.id, "boostCreep", { |
|
id: a.id, |
|
bodyPartsCount: b |
|
}), o.OK); |
|
}, k.StructureLab = z; |
|
var A = function(a) { |
|
t.call(this, a); |
|
}; |
|
A.prototype = Object.create(t.prototype), A.prototype.constructor = A, n.defineGameObjectProperties(A.prototype, d, { |
|
energy: function(a) { |
|
return a.energy; |
|
}, |
|
energyCapacity: function(a) { |
|
return a.energyCapacity; |
|
}, |
|
cooldown: function(a) { |
|
return a.cooldown; |
|
} |
|
}), A.prototype.transferEnergy = function(a, b) { |
|
if (0 > b) return o.ERR_INVALID_ARGS; |
|
if (!(a && a.id && (j.structures[a.id] || j.creeps[a.id]) && (a instanceof k.Structure || a instanceof k.Creep) && a !== this)) return o.ERR_INVALID_TARGET; |
|
if (!a.my) return o.ERR_NOT_OWNER; |
|
if (this.my === !1 && p.any(this.pos.lookFor("structure"), function(a) { |
|
return a.structureType == o.STRUCTURE_RAMPART; |
|
})) return o.ERR_NOT_OWNER; |
|
if (a instanceof k.Structure) { |
|
if (a.structureType != o.STRUCTURE_LINK) return o.ERR_INVALID_TARGET; |
|
if (this.cooldown > 0) return o.ERR_TIRED; |
|
if (!this.room.controller) return o.ERR_RCL_NOT_ENOUGH; |
|
if (!n.checkStructureAgainstController(d(this.id), j.objectsByRoom[d(this.id).room], d(this.room.controller.id))) return o.ERR_RCL_NOT_ENOUGH; |
|
} |
|
return a instanceof k.Creep && !this.pos.isNearTo(a) ? o.ERR_NOT_IN_RANGE : d(this.id).energy ? (b || (b = d(a.id).energyCapacity ? Math.min(d(this.id).energy, d(a.id).energyCapacity - d(a.id).energy) : d(this.id).energy), |
|
this.energy < b ? o.ERR_NOT_ENOUGH_ENERGY : d(a.id).energyCapacity && (!b || d(a.id).energy + b > d(a.id).energyCapacity) ? o.ERR_FULL : a.pos.roomName != this.pos.roomName ? o.ERR_NOT_IN_RANGE : (i.set(this.id, "transfer", { |
|
id: a.id, |
|
amount: b, |
|
resourceType: "energy" |
|
}), o.OK)) : o.ERR_NOT_ENOUGH_ENERGY; |
|
}, k.StructureLink = A; |
|
var B = function(a) { |
|
t.call(this, a); |
|
}; |
|
B.prototype = Object.create(t.prototype), B.prototype.constructor = B, B.prototype.observeRoom = function(a) { |
|
if (!this.my) return o.ERR_NOT_OWNER; |
|
if (!p.isString(a) || !/^(W|E)\d+(S|N)\d+$/.test(a)) return o.ERR_INVALID_ARGS; |
|
if (!n.checkStructureAgainstController(d(this.id), j.objectsByRoom[d(this.id).room], d(this.room.controller.id))) return o.ERR_RCL_NOT_ENOUGH; |
|
var b = n.roomNameToXY(a), c = m(b, 2), e = c[0], f = c[1], g = n.roomNameToXY(d(this.id).room), h = m(g, 2), k = h[0], l = h[1]; |
|
return Math.abs(e - k) > o.OBSERVER_RANGE || Math.abs(f - l) > o.OBSERVER_RANGE ? o.ERR_NOT_IN_RANGE : (i.set(this.id, "observeRoom", { |
|
roomName: a |
|
}), o.OK); |
|
}, k.StructureObserver = B; |
|
var C = function(a) { |
|
t.call(this, a); |
|
}; |
|
C.prototype = Object.create(t.prototype), C.prototype.constructor = C, n.defineGameObjectProperties(C.prototype, d, { |
|
power: function(a) { |
|
return a.power; |
|
}, |
|
ticksToDecay: function(a) { |
|
return a.nextDecayTime ? a.nextDecayTime - h.time : a.decayTime ? a.decayTime - h.time : void 0; |
|
}, |
|
my: function() { |
|
return !1; |
|
}, |
|
owner: function() { |
|
return { |
|
username: "Power Bank" |
|
}; |
|
} |
|
}), k.StructurePowerBank = C; |
|
var D = function(a) { |
|
t.call(this, a); |
|
}; |
|
D.prototype = Object.create(t.prototype), D.prototype.constructor = D, n.defineGameObjectProperties(D.prototype, d, { |
|
energy: function(a) { |
|
return a.energy; |
|
}, |
|
energyCapacity: function(a) { |
|
return a.energyCapacity; |
|
}, |
|
power: function(a) { |
|
return a.power; |
|
}, |
|
powerCapacity: function(a) { |
|
return a.powerCapacity; |
|
} |
|
}), D.prototype.transferEnergy = g, D.prototype.processPower = function() { |
|
return this.my ? n.checkStructureAgainstController(d(this.id), j.objectsByRoom[d(this.id).room], d(this.room.controller.id)) ? !this.power || this.energy < o.POWER_SPAWN_ENERGY_RATIO ? o.ERR_NOT_ENOUGH_RESOURCES : (i.set(this.id, "processPower", {}), |
|
o.OK) : o.ERR_RCL_NOT_ENOUGH : o.ERR_NOT_OWNER; |
|
}, k.StructurePowerSpawn = D; |
|
var E = function(a) { |
|
t.call(this, a); |
|
}; |
|
E.prototype = Object.create(t.prototype), E.prototype.constructor = E, n.defineGameObjectProperties(E.prototype, d, { |
|
ticksToDecay: function(a) { |
|
return a.nextDecayTime ? a.nextDecayTime - h.time : a.decayTime ? a.decayTime - h.time : void 0; |
|
} |
|
}), k.StructureRampart = E; |
|
var F = function(a) { |
|
s.call(this, a); |
|
}; |
|
F.prototype = Object.create(s.prototype), F.prototype.constructor = F, n.defineGameObjectProperties(F.prototype, d, { |
|
ticksToDecay: function(a) { |
|
return a.nextDecayTime ? a.nextDecayTime - h.time : a.decayTime ? a.decayTime - h.time : void 0; |
|
} |
|
}), k.StructureRoad = F; |
|
var G = function(a) { |
|
t.call(this, a); |
|
}; |
|
G.prototype = Object.create(t.prototype), G.prototype.constructor = G, n.defineGameObjectProperties(G.prototype, d, { |
|
store: e, |
|
storeCapacity: function(a) { |
|
return a.energyCapacity; |
|
} |
|
}), G.prototype.transfer = f, k.StructureStorage = G; |
|
var H = function(a) { |
|
t.call(this, a); |
|
}; |
|
H.prototype = Object.create(t.prototype), H.prototype.constructor = H, n.defineGameObjectProperties(H.prototype, d, { |
|
store: e, |
|
storeCapacity: function(a) { |
|
return a.energyCapacity; |
|
} |
|
}), H.prototype.transfer = f, H.prototype.send = function(a, b, c, e) { |
|
if (!this.my) return o.ERR_NOT_OWNER; |
|
if (!n.checkStructureAgainstController(d(this.id), j.objectsByRoom[d(this.id).room], d(this.room.controller.id))) return o.ERR_RCL_NOT_ENOUGH; |
|
if (!/^(W|E)\d+(N|S)\d+$/.test(c)) return o.ERR_INVALID_ARGS; |
|
if (!p.contains(o.RESOURCES_ALL, a)) return o.ERR_INVALID_ARGS; |
|
if (b < o.TERMINAL_MIN_SEND) return o.ERR_INVALID_ARGS; |
|
if (!d(this.id)[a] || d(this.id)[a] < b) return o.ERR_NOT_ENOUGH_RESOURCES; |
|
var f = n.roomNameToXY(d(this.id).room), g = m(f, 2), h = g[0], k = g[1], l = n.roomNameToXY(c), q = m(l, 2), r = q[0], s = q[1], t = Math.max(Math.abs(r - h), Math.abs(s - k)); |
|
return a != o.RESOURCE_ENERGY && d(this.id).energy < Math.round(o.TERMINAL_SEND_COST * t * b) || a == o.RESOURCE_ENERGY && d(this.id).energy < b + Math.round(o.TERMINAL_SEND_COST * t * b) ? o.ERR_NOT_ENOUGH_RESOURCES : e && (!p.isString(e) || e.length > 100) ? o.ERR_INVALID_ARGS : (i.set(this.id, "send", { |
|
resourceType: a, |
|
amount: b, |
|
targetRoomName: c, |
|
description: e |
|
}), o.OK); |
|
}, k.StructureTerminal = H; |
|
var I = function(a) { |
|
t.call(this, a); |
|
}; |
|
I.prototype = Object.create(t.prototype), I.prototype.constructor = I, n.defineGameObjectProperties(I.prototype, d, { |
|
energy: function(a) { |
|
return a.energy; |
|
}, |
|
energyCapacity: function(a) { |
|
return a.energyCapacity; |
|
} |
|
}), I.prototype.transferEnergy = g, I.prototype.attack = function(a) { |
|
return this.my ? a && a.id && (j.creeps[a.id] || j.structures[a.id]) && (a instanceof k.Creep || a instanceof k.StructureSpawn || a instanceof k.Structure) ? d(this.id).energy < o.TOWER_ENERGY_COST ? o.ERR_NOT_ENOUGH_ENERGY : n.checkStructureAgainstController(d(this.id), j.objectsByRoom[d(this.id).room], d(this.room.controller.id)) ? (i.set(this.id, "attack", { |
|
id: a.id |
|
}), o.OK) : o.ERR_RCL_NOT_ENOUGH : o.ERR_INVALID_TARGET : o.ERR_NOT_OWNER; |
|
}, I.prototype.heal = function(a) { |
|
return this.my ? a && a.id && j.creeps[a.id] && a instanceof k.Creep ? d(this.id).energy < o.TOWER_ENERGY_COST ? o.ERR_NOT_ENOUGH_ENERGY : n.checkStructureAgainstController(d(this.id), j.objectsByRoom[d(this.id).room], d(this.room.controller.id)) ? (i.set(this.id, "heal", { |
|
id: a.id |
|
}), o.OK) : o.ERR_RCL_NOT_ENOUGH : o.ERR_INVALID_TARGET : o.ERR_NOT_OWNER; |
|
}, I.prototype.repair = function(a) { |
|
return this.my ? a && a.id && j.structures[a.id] && (a instanceof k.Structure || a instanceof k.StructureSpawn) ? d(this.id).energy < o.TOWER_ENERGY_COST ? o.ERR_NOT_ENOUGH_ENERGY : n.checkStructureAgainstController(d(this.id), j.objectsByRoom[d(this.id).room], d(this.room.controller.id)) ? (i.set(this.id, "repair", { |
|
id: a.id |
|
}), o.OK) : o.ERR_RCL_NOT_ENOUGH : o.ERR_INVALID_TARGET : o.ERR_NOT_OWNER; |
|
}, k.StructureTower = I; |
|
var J = function(a) { |
|
s.call(this, a); |
|
}; |
|
J.prototype = Object.create(s.prototype), J.prototype.constructor = J, n.defineGameObjectProperties(J.prototype, d, { |
|
ticksToLive: function(a) { |
|
return a.ticksToLive; |
|
} |
|
}), k.StructureWall = J; |
|
var K = function(a) { |
|
t.call(this, a); |
|
}; |
|
K.prototype = Object.create(t.prototype), K.prototype.constructor = K, n.defineGameObjectProperties(K.prototype, d, { |
|
name: function(a) { |
|
return a.user == h.user._id ? a.name : void 0; |
|
}, |
|
energy: function(a) { |
|
return a.energy; |
|
}, |
|
energyCapacity: function(a) { |
|
return a.energyCapacity; |
|
}, |
|
spawning: function(a) { |
|
return a.spawning; |
|
} |
|
}), Object.defineProperty(K.prototype, "memory", { |
|
get: function() { |
|
return this.my && ((p.isUndefined(k.Memory.spawns) || "undefined" === k.Memory.spawns) && (k.Memory.spawns = {}), |
|
p.isObject(k.Memory.spawns)) ? k.Memory.spawns[d(this.id).name] = k.Memory.spawns[d(this.id).name] || {} : void 0; |
|
}, |
|
set: function(a) { |
|
if (!this.my) throw new Error("Could not set other player's spawn memory"); |
|
if ((p.isUndefined(k.Memory.spawns) || "undefined" === k.Memory.spawns) && (k.Memory.spawns = {}), |
|
!p.isObject(k.Memory.spawns)) throw new Error("Could not set spawn memory"); |
|
k.Memory.spawns[d(this.id).name] = a; |
|
} |
|
}), K.prototype.toString = function() { |
|
return "[spawn " + (d(this.id).user == h.user._id ? d(this.id).name : "#" + this.id) + "]"; |
|
}, K.prototype.canCreateCreep = function(a, b) { |
|
if (!this.my) return o.ERR_NOT_OWNER; |
|
if (d(this.id).spawning) return o.ERR_BUSY; |
|
if (!a || !p.isArray(a) || 0 == a.length || a.length > o.MAX_CREEP_SIZE) return o.ERR_INVALID_ARGS; |
|
for (var c = 0; c < a.length; c++) if (!p.contains(o.BODYPARTS_ALL, a[c])) return o.ERR_INVALID_ARGS; |
|
return this.room.energyAvailable < n.calcCreepCost(a) ? o.ERR_NOT_ENOUGH_ENERGY : h.roomObjects[this.id].off ? o.ERR_RCL_NOT_ENOUGH : b && (k.Game.creeps[b] || -1 != l.indexOf(b)) ? o.ERR_NAME_EXISTS : o.OK; |
|
}, K.prototype.createCreep = function(b, c, e) { |
|
var f = this; |
|
p.isObject(c) && p.isUndefined(e) && (e = c, c = void 0); |
|
var g = this.canCreateCreep(b, c); |
|
return g != o.OK ? g : (c || (c = a("./names").getUniqueName(function(a) { |
|
return p.any(h.roomObjects, { |
|
type: "creep", |
|
user: d(f.id).user, |
|
name: a |
|
}) || -1 != l.indexOf(a); |
|
})), l.push(c), p.isUndefined(k.Memory.creeps) && (k.Memory.creeps = {}), p.isObject(k.Memory.creeps) && (p.isUndefined(e) ? k.Memory.creeps[c] = k.Memory.creeps[c] || {} : k.Memory.creeps[c] = e), |
|
i.set(this.id, "createCreep", { |
|
name: c, |
|
body: b |
|
}), c); |
|
}, K.prototype.transferEnergy = function(a, b) { |
|
return this.my ? a && a.id && j.creeps[a.id] && a instanceof k.Creep ? h.roomObjects[this.id].off ? o.ERR_RCL_NOT_ENOUGH : d(this.id).energy ? (b || (b = d(a.id).energyCapacity ? Math.min(d(this.id).energy, d(a.id).energyCapacity - d(a.id).energy) : d(this.id).energy), |
|
this.energy < b || 0 > b ? o.ERR_NOT_ENOUGH_ENERGY : d(a.id).energy == d(a.id).energyCapacity ? o.ERR_FULL : a.pos.isNearTo(this.pos) ? (i.set(this.id, "transferEnergy", { |
|
id: a.id, |
|
amount: b |
|
}), o.OK) : o.ERR_NOT_IN_RANGE) : o.ERR_NOT_ENOUGH_ENERGY : o.ERR_INVALID_TARGET : o.ERR_NOT_OWNER; |
|
}, K.prototype.destroy = function() { |
|
return this.my ? (i.pushByName("room", "destroyStructure", { |
|
roomName: this.room.name, |
|
id: this.id |
|
}), o.OK) : o.ERR_NOT_OWNER; |
|
}, K.prototype.notifyWhenAttacked = function(a) { |
|
return this.my ? p.isBoolean(a) ? (a != d(this.id).notifyWhenAttacked && i.set(this.id, "notifyWhenAttacked", { |
|
enabled: a |
|
}), o.OK) : o.ERR_INVALID_ARGS : o.ERR_NOT_OWNER; |
|
}, K.prototype.renewCreep = function(a) { |
|
return this.my ? a && a.id && j.creeps[a.id] && a instanceof k.Creep ? h.roomObjects[this.id].off ? o.ERR_RCL_NOT_ENOUGH : a.my ? a.pos.isNearTo(this.pos) ? this.spawning ? o.ERR_BUSY : this.room.energyAvailable < Math.ceil(n.calcCreepCost(a.body) / o.CREEP_SPAWN_TIME / a.body.length) ? o.ERR_NOT_ENOUGH_ENERGY : a.ticksToLive + Math.floor(o.CREEP_LIFE_TIME / o.CREEP_SPAWN_TIME / a.body.length) > o.CREEP_LIFE_TIME ? o.ERR_FULL : (i.set(this.id, "renewCreep", { |
|
id: a.id |
|
}), o.OK) : o.ERR_NOT_IN_RANGE : o.ERR_NOT_OWNER : o.ERR_INVALID_TARGET : o.ERR_NOT_OWNER; |
|
}, K.prototype.recycleCreep = function(a) { |
|
return this.my ? a && a.id && j.creeps[a.id] && a instanceof k.Creep ? h.roomObjects[this.id].off ? o.ERR_RCL_NOT_ENOUGH : a.my ? a.pos.isNearTo(this.pos) ? (i.set(this.id, "recycleCreep", { |
|
id: a.id |
|
}), o.OK) : o.ERR_NOT_IN_RANGE : o.ERR_NOT_OWNER : o.ERR_INVALID_TARGET : o.ERR_NOT_OWNER; |
|
}, k.StructureSpawn = K, k.Spawn = K; |
|
var L = function(a) { |
|
t.call(this, a); |
|
}; |
|
L.prototype = Object.create(t.prototype), L.prototype.constructor = L, n.defineGameObjectProperties(L.prototype, d, { |
|
energy: function(a) { |
|
return a.energy; |
|
}, |
|
energyCapacity: function(a) { |
|
return a.energyCapacity; |
|
}, |
|
ghodium: function(a) { |
|
return a.G; |
|
}, |
|
ghodiumCapacity: function(a) { |
|
return a.GCapacity; |
|
}, |
|
cooldown: function(a) { |
|
return a.cooldownTime && a.cooldownTime > h.time ? a.cooldownTime - h.time : 0; |
|
} |
|
}), L.prototype.launchNuke = function(a) { |
|
if (!this.my) return o.ERR_NOT_OWNER; |
|
if (h.rooms[this.room.name].novice > Date.now()) return o.ERR_INVALID_TARGET; |
|
if (!(a instanceof k.RoomPosition)) return o.ERR_INVALID_TARGET; |
|
if (this.cooldown > 0) return o.ERR_TIRED; |
|
if (!n.checkStructureAgainstController(d(this.id), j.objectsByRoom[d(this.id).room], d(this.room.controller.id))) return o.ERR_RCL_NOT_ENOUGH; |
|
var b = n.roomNameToXY(a.roomName), c = m(b, 2), e = c[0], f = c[1], g = n.roomNameToXY(d(this.id).room), l = m(g, 2), p = l[0], q = l[1]; |
|
return Math.abs(e - p) > o.NUKE_RANGE || Math.abs(f - q) > o.NUKE_RANGE ? o.ERR_NOT_IN_RANGE : this.energy < this.energyCapacity || this.ghodium < this.ghodiumCapacity ? o.ERR_NOT_ENOUGH_RESOURCES : (i.set(this.id, "launchNuke", { |
|
roomName: a.roomName, |
|
x: a.x, |
|
y: a.y |
|
}), o.OK); |
|
}, k.StructureNuker = L; |
|
var M = function(a) { |
|
s.call(this, a); |
|
}; |
|
M.prototype = Object.create(s.prototype), M.prototype.constructor = M, n.defineGameObjectProperties(M.prototype, d, { |
|
destination: function(a) { |
|
return new k.RoomPosition(a.destination.x, a.destination.y, a.destination.room); |
|
}, |
|
ticksToDecay: function(a) { |
|
return a.decayTime ? a.decayTime - h.time : void 0; |
|
} |
|
}), k.StructurePortal = M; |
|
} |
|
}; |
|
}, { |
|
"./../utils": 140, |
|
"./constants": 40, |
|
"./names": 49, |
|
"./rooms": 54, |
|
lodash: 60 |
|
} ], |
|
57: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b, c) { |
|
return b in a ? Object.defineProperty(a, b, { |
|
value: c, |
|
enumerable: !0, |
|
configurable: !0, |
|
writable: !0 |
|
}) : a[b] = c, a; |
|
} |
|
var e = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), f = a("./core/core.js"), g = a("q"), h = a("lodash"), i = a("./game/constants"), j = a("./utils"); |
|
b.exports = function() { |
|
return f.getInterRoom().then(function(a) { |
|
var b = e(a, 4), c = b[0], k = b[1], l = b[2], m = b[3]; |
|
if (!k) return !0; |
|
var n = f.bulkObjectsWrite(), o = f.bulkRoomsWrite(), p = f.bulkTransactionsWrite(), q = {}; |
|
return k.forEach(function(a) { |
|
l[a.interRoom.room] && (q[a.interRoom.room] || o.update(a.interRoom.room, { |
|
active: !0 |
|
}), q[a.interRoom.room] = !0, n.update(a, { |
|
room: a.interRoom.room, |
|
x: a.interRoom.x, |
|
y: a.interRoom.y, |
|
interRoom: null |
|
})); |
|
}), h.filter(m, function(a) { |
|
return !!a.send; |
|
}).forEach(function(a) { |
|
var b = a.send; |
|
if (n.update(a, { |
|
send: null |
|
}), a[b.resourceType] && !(a[b.resourceType] < b.amount)) { |
|
var f = j.roomNameToXY(a.room), g = e(f, 2), k = g[0], l = g[1], o = j.roomNameToXY(b.targetRoomName), q = e(o, 2), r = q[0], s = q[1], t = Math.max(Math.abs(r - k), Math.abs(s - l)), u = Math.round(i.TERMINAL_SEND_COST * t * b.amount); |
|
if (!(b.resourceType != i.RESOURCE_ENERGY && a.energy < u || b.resourceType == i.RESOURCE_ENERGY && a.energy < b.amount + u)) { |
|
var v = h.find(m, { |
|
room: b.targetRoomName |
|
}); |
|
if (v) { |
|
var w = j.calcResources(v); |
|
w + b.amount > v.energyCapacity ? n.insert(d({ |
|
room: b.targetRoomName, |
|
x: v.x, |
|
y: v.y, |
|
type: "energy", |
|
resourceType: b.resourceType |
|
}, b.resourceType, b.amount)) : (v[b.resourceType] = v[b.resourceType] || 0, v[b.resourceType] += b.amount, |
|
n.update(v, d({}, b.resourceType, v[b.resourceType]))), n.update(a, d({}, b.resourceType, a[b.resourceType] - b.amount)), |
|
n.update(a, { |
|
energy: a.energy - u |
|
}), p.insert({ |
|
time: +c, |
|
sender: "" + a.user, |
|
recipient: "" + v.user, |
|
resourceType: b.resourceType, |
|
amount: b.amount, |
|
from: a.room, |
|
to: b.targetRoomName, |
|
description: b.description |
|
}); |
|
} |
|
} |
|
} |
|
}), g.all([ n.execute(), o.execute(), p.execute() ]); |
|
}); |
|
}; |
|
}, { |
|
"./core/core.js": 28, |
|
"./game/constants": 40, |
|
"./utils": 140, |
|
lodash: 60, |
|
q: 61 |
|
} ], |
|
58: [ function(a, b, c) { |
|
"use strict"; |
|
b.exports = { |
|
ptr: !1 |
|
}; |
|
}, {} ], |
|
59: [ function(a, b, c) { |
|
(function(b) { |
|
"use strict"; |
|
function c() { |
|
var j, l = b.hrtime ? b.hrtime() : Date.now(), p = 1; |
|
"undefined" == typeof self && (j = setInterval(function() { |
|
i.queue.resetAll(); |
|
}, n.ptr ? 5e4 : 1e4)), i.notifyTickStarted().then(function() { |
|
return p = 2, m.setNow(), i.getAllUsers(); |
|
}).then(function(a) { |
|
return p = 3, m.mark("getAllUsers"), d.addMulti(k.map(a, function(a) { |
|
return a._id.toString(); |
|
})); |
|
}).then(function() { |
|
return p = 31, d.whenAllDone(); |
|
}).then(function() { |
|
return p = 4, m.mark("whenAllUsersDone"), p = "rooms", i.getAllRooms(); |
|
}).then(function(a) { |
|
return p = 5, m.mark("getAllRooms"), e.addMulti(k.map(a, function(a) { |
|
return a._id.toString(); |
|
})); |
|
}).then(function() { |
|
return p = 6, e.whenAllDone(); |
|
}).then(function() { |
|
return p = 7, m.mark("whenAllRoomsDone"), i.commitDbBulk(); |
|
}).then(function() { |
|
return p = 8, m.mark("commitDbBulk1"), a("./inter-room")(); |
|
}).then(function() { |
|
return p = 9, m.mark("interRoom"), i.commitDbBulk(); |
|
}).then(function() { |
|
return p = 10, m.mark("commitDbBulk2"), i.incrementGameTime(); |
|
}).then(function() { |
|
return p = 11, i.notifyRoomsDone(); |
|
})["catch"](function(a) {})["finally"](function() { |
|
j && clearInterval(j); |
|
var a; |
|
if (b.hrtime ? (a = b.hrtime(l), a = 1e3 * a[0] + a[1] / 1e6) : a = Date.now() - l, |
|
!k.isUndefined(g)) { |
|
var d; |
|
b.hrtime ? (d = b.hrtime(g), d = 1e3 * d[0] + d[1] / 1e6) : d = Date.now() - g, |
|
o.push(d), 1 == o.length && i.getInterRoom().then(function(a) { |
|
var b = h(a, 3), c = (b[0], b[1], b[2]); |
|
i.saveAccessibleRoomsList(c); |
|
}), o.length >= 20 && (i.cleanTimelineStats(), i.sendUsageMetrics(o), o = []); |
|
} |
|
g = b.hrtime ? b.hrtime() : Date.now(), i.flushTimelineStats(m.getStats()), setTimeout(c, Math.max(f - a, 0)); |
|
}); |
|
} |
|
var d, e, f, g, h = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), i = a("./core/core.js"), j = a("q"), k = a("lodash"), l = a("./utils"), m = l.getTimelineStats("main"), n = a("./config"), o = []; |
|
i.connect("main").then(function() { |
|
return d = i.queue.create("users"), e = i.queue.create("rooms"), i.getTickPeriod(); |
|
}).then(function(a) { |
|
f = a, c(); |
|
}), "undefined " == typeof self && setInterval(function() { |
|
var a = j.getUnhandledReasons(); |
|
a.forEach(function(a) {}), j.resetUnhandledRejections(); |
|
}, 1e3); |
|
}).call(this, a("_process")); |
|
}, { |
|
"./config": 25, |
|
"./core/core.js": 28, |
|
"./inter-room": 57, |
|
"./utils": 140, |
|
_process: 142, |
|
lodash: 60, |
|
q: 61 |
|
} ], |
|
60: [ function(a, b, c) { |
|
arguments[4][32][0].apply(c, arguments); |
|
}, { |
|
dup: 32 |
|
} ], |
|
61: [ function(a, b, c) { |
|
arguments[4][33][0].apply(c, arguments); |
|
}, { |
|
_process: 142, |
|
dup: 33 |
|
} ], |
|
62: [ function(a, b, c) { |
|
"use strict"; |
|
function d(b, c, d, f, l, o, p, q) { |
|
return h.when().then(function() { |
|
var r, s = g.bulkObjectsWrite(), t = g.bulkUsersWrite(), u = g.bulkFlagsWrite(), v = !0, w = !1, x = g.getRoomStatsUpdater(b), y = {}, z = [], A = [], B = f[i.findKey(f)]; |
|
"terrain" == B.type && (f = B.terrain), i.forEach(d, function(a) { |
|
a && ("creep" == a.type && (a._actionLog = a.actionLog, a._ticksToLive = a.ageTime - o, |
|
a.actionLog = { |
|
attacked: null, |
|
healed: null, |
|
attack: null, |
|
rangedAttack: null, |
|
rangedMassAttack: null, |
|
rangedHeal: null, |
|
harvest: null, |
|
heal: null, |
|
repair: null, |
|
build: null, |
|
say: null, |
|
upgradeController: null, |
|
reserveController: null |
|
}), "link" == a.type && (a._actionLog = a.actionLog, a.actionLog = { |
|
transferEnergy: null |
|
}), "lab" == a.type && (a._actionLog = a.actionLog, a.actionLog = { |
|
runReaction: null |
|
}), "tower" == a.type && (a._actionLog = a.actionLog, a.actionLog = { |
|
attack: null, |
|
heal: null, |
|
repair: null |
|
}), "controller" == a.type && (r = a), "observer" == a.type && (a.observeRoom = null), |
|
a.user && "3" != a.user && !a.userNotActive && "flag" != a.type && (v = !1), "powerBank" == a.type && (v = !1), |
|
"energy" == a.type && (v = !1), "nuke" == a.type && (v = !1), "portal" == a.type && (v = !1), |
|
"constructedWall" == a.type && a.decayTime && a.user && (w = !0), "extension" == a.type && A.push(a), |
|
"spawn" == a.type && z.push(a)); |
|
}), (z.length || A.length) && a("./processor/intents/_calc_spawns")(z, A, r, s), |
|
k.init(d, f), c && i.forEach(c.users, function(b, c) { |
|
b.objectsManual && (b.objects = b.objects || {}, i.extend(b.objects, b.objectsManual)); |
|
for (var e in b.objects) { |
|
var g = b.objects[e], h = d[e]; |
|
"room" != e ? h && ("creep" == h.type && a("./processor/intents/creeps/intents")(h, g, d, f, s, t, r, x, o), |
|
"link" == h.type && a("./processor/intents/links/intents")(h, g, d, f, s, t, r, x), |
|
"tower" == h.type && a("./processor/intents/towers/intents")(h, g, d, f, s, t, r, x), |
|
"lab" == h.type && a("./processor/intents/labs/intents")(h, g, d, f, s, t, r, x), |
|
"spawn" == h.type && a("./processor/intents/spawns/intents")(h, g, d, f, s, t, r, x, o), |
|
"constructionSite" == h.type && g.remove && a("./processor/intents/construction-sites/remove")(h, d, s), |
|
"terminal" == h.type && g.send && a("./processor/intents/terminal/send")(h, g.send, d, f, s, t, r), |
|
"nuker" == h.type && g.launchNuke && a("./processor/intents/nukers/launch-nuke")(h, g.launchNuke, d, f, s, t, r, x, o, p), |
|
"observer" == h.type && g.observeRoom && (h.observeRoom = g.observeRoom.roomName), |
|
"powerSpawn" == h.type && a("./processor/intents/power-spawns/intents")(h, g, d, f, s, t, r, x), |
|
("extension" == h.type || "storage" == h.type || "powerSpawn" == h.type || "terminal" == h.type || "container" == h.type) && g.transfer && a("./processor/intents/extensions/transfer")(h, g.transfer, d, f, s, t, r), |
|
"controller" == h.type && g.unclaim && a("./processor/intents/controllers/unclaim")(h, g.unclaim, d, f, s, t), |
|
g.notifyWhenAttacked && (j.CONSTRUCTION_COST[h.type] || "creep" == h.type) && s.update(h, { |
|
notifyWhenAttacked: !!g.notifyWhenAttacked.enabled |
|
})) : a("./processor/intents/room/intents")(g, d, f, s, t, r, q, u); |
|
} |
|
}), k.check(); |
|
var C = i(d).filter(function(a) { |
|
return !a.off && ("spawn" == a.type || "extension" == a.type); |
|
}).sum("energy"), D = [ "creep", "spawn", "extension", "controller", "link", "storage", "rampart", "constructedWall", "road", "tower", "observer", "powerBank", "powerSpawn", "lab", "terminal", "container", "nuker", "portal" ], E = { |
|
walls: [], |
|
roads: [], |
|
pb: [], |
|
portals: [] |
|
}; |
|
i.forEach(d, function(b) { |
|
if (b) { |
|
if ("energy" == b.type && a("./processor/intents/energy/tick")(b, d, f, s, t, r), |
|
"source" == b.type && a("./processor/intents/sources/tick")(b, d, f, s, t, r, o), |
|
"mineral" == b.type && a("./processor/intents/minerals/tick")(b, d, f, s, t, r, o), |
|
"creep" == b.type && a("./processor/intents/creeps/tick")(b, d, f, s, t, r, x, o), |
|
"spawn" == b.type && a("./processor/intents/spawns/tick")(b, d, f, s, t, r, C), |
|
"rampart" == b.type && a("./processor/intents/ramparts/tick")(b, d, f, s, t, r, o), |
|
"extension" == b.type && a("./processor/intents/extensions/tick")(b, d, f, s, t, r, o), |
|
"road" == b.type && a("./processor/intents/roads/tick")(b, d, f, s, t, r, o), "constructionSite" == b.type && a("./processor/intents/construction-sites/tick")(b, d, f, s, t, r), |
|
"keeperLair" == b.type && a("./processor/intents/keeper-lairs/tick")(b, d, f, s, t, r, o), |
|
"portal" == b.type && a("./processor/intents/portals/tick")(b, d, f, s, t, r, o), |
|
"constructedWall" == b.type && a("./processor/intents/constructedWalls/tick")(b, d, f, s, t, r, o), |
|
"link" == b.type && a("./processor/intents/links/tick")(b, d, f, s, t, r), "tower" == b.type && a("./processor/intents/towers/tick")(b, d, f, s, t, r), |
|
"controller" == b.type && a("./processor/intents/controllers/tick")(b, d, f, s, t, r, o), |
|
"lab" == b.type && a("./processor/intents/labs/tick")(b, d, f, s, t, r, o), "container" == b.type && a("./processor/intents/containers/tick")(b, d, f, s, t, r, o), |
|
"nuke" == b.type && a("./processor/intents/nukes/tick")(b, d, f, s, t, r, o, x, p), |
|
"observer" == b.type && s.update(b, { |
|
observeRoom: b.observeRoom |
|
}), "storage" == b.type && r) { |
|
var c = r.level > 0 && r.user == b.user && j.CONTROLLER_STRUCTURES.storage[r.level] > 0 ? j.STORAGE_CAPACITY : 0; |
|
c != b.energyCapacity && s.update(b, { |
|
energyCapacity: c |
|
}); |
|
} |
|
if ("powerBank" == b.type && o >= b.decayTime - 1 && (s.remove(b._id), delete d[b._id]), |
|
"flag" != b.type && (y[b._id] = b, "creep" == b.type && (y[b._id] = i.cloneDeep(b), |
|
y[b._id]._id = "" + b._id, delete y[b._id]._actionLog, delete y[b._id]._ticksToLive, |
|
b.actionLog.say && delete y[b._id].actionLog.say)), i.contains(D, b.type)) if (b.user) { |
|
if (b.newbieWall) return; |
|
E[b.user] = E[b.user] || [], E[b.user].push([ b.x, b.y ]); |
|
} else "constructedWall" == b.type ? E.walls.push([ b.x, b.y ]) : "road" == b.type ? E.roads.push([ b.x, b.y ]) : "powerBank" == b.type ? E.pb.push([ b.x, b.y ]) : "portal" == b.type && E.portals.push([ b.x, b.y ]); |
|
"energy" == b.type && "power" == b.resourceType && E.pb.push([ b.x, b.y ]); |
|
} |
|
}); |
|
var F = []; |
|
m.mark("processRoom:" + b), F.push(g.mapViewSave(b, E)), F.push(s.execute()), F.push(t.execute()), |
|
F.push(u.execute()), F.push(e(b, y, o)), Date.now() > n + 3e4 && (F.push(g.roomsStatsSave()), |
|
n = Date.now()); |
|
var G = h.all(F); |
|
v && (G = G.then(function() { |
|
return g.deactivateRoom(b); |
|
})); |
|
var H = !1; |
|
return w ? (H = !0, r.user && i.forEach(d, function(a) { |
|
"constructedWall" == a.type && a.decayTime && a.user && (H = !1); |
|
})) : "newbie" == p.status && (H = !0), H && (G = G.then(function() { |
|
return g.setRoomStatus(b, "normal"); |
|
})), l && "finished" == l.status && (G = G.then(function() { |
|
return g.finishGame(l); |
|
})), G; |
|
}); |
|
} |
|
function e(a, b, c) { |
|
var d = h.when(); |
|
if (!(c % 20)) { |
|
var e = 20 * Math.floor((c - 1) / 20); |
|
d = g.history.upload(a, e); |
|
} |
|
var f = JSON.stringify(b); |
|
return d.then(function() { |
|
return g.history.saveTick(a, c, f); |
|
}); |
|
} |
|
var f, g = a("./core/core"), h = a("q"), i = a("lodash"), j = a("./game/constants"), k = a("./processor/intents/movement"), l = a("./utils"), m = l.getTimelineStats("processor"), n = (a("./config"), |
|
0); |
|
g.connect("processor").then(function() { |
|
function a() { |
|
var b; |
|
f.fetch().then(function(a) { |
|
return m.setNow(), h.all([ g.getRoomIntents(b = a), g.getRoomObjects(a), g.getRoomTerrain(a), g.getGameInfo(a), g.getGameTime(), g.getRoomInfo(a), g.getRoomFlags(a) ]); |
|
}).then(function(a) { |
|
m.mark("getRoomData:" + b), d(b, a[0], a[1], a[2], a[3], parseInt(a[4]), a[5], a[6])["catch"](function(a) {}).then(function() { |
|
return m.mark("saveRoom:" + b), g.clearRoomIntents(b); |
|
}).then(function() { |
|
return f.markDone(b); |
|
}); |
|
}).then(function() { |
|
g.flushTimelineStats(m.getStats()), setTimeout(a, 0); |
|
}); |
|
} |
|
f = g.queue.create("rooms", !0); |
|
a(); |
|
})["catch"](function(a) {}), "undefined " == typeof self && setInterval(function() { |
|
var a = h.getUnhandledReasons(); |
|
a.forEach(function(a) {}), h.resetUnhandledRejections(); |
|
}, 1e3); |
|
}, { |
|
"./config": 25, |
|
"./core/core": 28, |
|
"./game/constants": 40, |
|
"./processor/intents/_calc_spawns": 63, |
|
"./processor/intents/constructedWalls/tick": 65, |
|
"./processor/intents/construction-sites/remove": 66, |
|
"./processor/intents/construction-sites/tick": 67, |
|
"./processor/intents/containers/tick": 68, |
|
"./processor/intents/controllers/tick": 69, |
|
"./processor/intents/controllers/unclaim": 70, |
|
"./processor/intents/creeps/intents": 83, |
|
"./processor/intents/creeps/tick": 93, |
|
"./processor/intents/energy/tick": 96, |
|
"./processor/intents/extensions/tick": 97, |
|
"./processor/intents/extensions/transfer": 98, |
|
"./processor/intents/keeper-lairs/tick": 99, |
|
"./processor/intents/labs/intents": 101, |
|
"./processor/intents/labs/tick": 103, |
|
"./processor/intents/links/intents": 105, |
|
"./processor/intents/links/tick": 106, |
|
"./processor/intents/minerals/tick": 108, |
|
"./processor/intents/movement": 109, |
|
"./processor/intents/nukers/launch-nuke": 110, |
|
"./processor/intents/nukes/tick": 111, |
|
"./processor/intents/portals/tick": 112, |
|
"./processor/intents/power-spawns/intents": 113, |
|
"./processor/intents/ramparts/tick": 115, |
|
"./processor/intents/roads/tick": 116, |
|
"./processor/intents/room/intents": 121, |
|
"./processor/intents/sources/tick": 123, |
|
"./processor/intents/spawns/intents": 127, |
|
"./processor/intents/spawns/tick": 130, |
|
"./processor/intents/terminal/send": 132, |
|
"./processor/intents/towers/intents": 135, |
|
"./processor/intents/towers/tick": 137, |
|
"./utils": 140, |
|
lodash: 60, |
|
q: 61 |
|
} ], |
|
63: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../utils"), f = a("../../game/constants"); |
|
b.exports = function(a, b, c, g) { |
|
var h = a; |
|
h.length > f.CONTROLLER_STRUCTURES.spawn[0 | c.level] ? (h.sort(e.comparatorDistance(c)), |
|
h = d.take(h, f.CONTROLLER_STRUCTURES.spawn[0 | c.level]), a.forEach(function(a) { |
|
return a._off = !d.contains(h, a); |
|
})) : a.forEach(function(a) { |
|
return a._off = !1; |
|
}), a.forEach(function(a) { |
|
a._off !== a.off && g.update(a._id, { |
|
off: a._off |
|
}); |
|
}); |
|
var i = b; |
|
i.length > f.CONTROLLER_STRUCTURES.extension[0 | c.level] ? (i.sort(e.comparatorDistance(c)), |
|
i = d.take(i, f.CONTROLLER_STRUCTURES.extension[0 | c.level]), b.forEach(function(a) { |
|
return a._off = !d.contains(i, a); |
|
})) : b.forEach(function(a) { |
|
return a._off = !1; |
|
}), b.forEach(function(a) { |
|
a._off !== a.off && g.update(a._id, { |
|
off: a._off |
|
}); |
|
}); |
|
}; |
|
}, { |
|
"../../game/constants": 40, |
|
"../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
64: [ function(a, b, c) { |
|
"use strict"; |
|
function d(b, c, d, h, i) { |
|
var j = 0, k = c; |
|
if (e.any(b.body, function(a) { |
|
return !!a.boost; |
|
})) for (var l = 0; l < b.body.length && !(0 >= k); l++) { |
|
var m = b.body[l], n = 1; |
|
m.boost && g.BOOSTS[m.type][m.boost] && g.BOOSTS[m.type][m.boost].damage && (n = g.BOOSTS[m.type][m.boost].damage); |
|
var o = m.hits / n; |
|
j += Math.min(o, k) * (1 - n), k -= Math.min(o, k); |
|
} |
|
c -= Math.round(j), b.hits -= c, a("./creeps/_recalc-body")(b); |
|
for (var p = 0; p < g.RESOURCES_ALL.length; p++) { |
|
var q = g.RESOURCES_ALL[p], r = f.calcResources(b); |
|
if (r <= b.energyCapacity) break; |
|
b[q] && a("./creeps/drop")(b, { |
|
amount: Math.min(b[q], r - b.energyCapacity), |
|
resourceType: q |
|
}, d, h, i); |
|
} |
|
} |
|
var e = a("lodash"), f = a("../../utils"), g = a("../../game/constants"); |
|
b.exports = function(b, c, h, i, j, k, l, m, n) { |
|
if (c.hits) { |
|
var o = 0; |
|
if ("creep" == c.type ? ("melee" != i || e.any(j, { |
|
type: "rampart", |
|
x: b.x, |
|
y: b.y |
|
}) || (o = f.calcBodyEffectiveness(c.body, g.ATTACK, "attack", g.ATTACK_POWER)), |
|
d(c, h, j, k, l)) : c.hits -= h, "powerBank" == c.type && (o = h * g.POWER_BANK_HIT_BACK), |
|
"constructedWall" == c.type && c.decayTime) a("./creeps/_clear-newbie-walls")(j, l); else if (c.hits <= 0) { |
|
if ("creep" == c.type ? a("./creeps/_die")(c, j, l, n) : (g.RESOURCES_ALL.forEach(function(b) { |
|
c[b] > 0 && a("./creeps/_create-energy")(c.x, c.y, c.room, c[b], j, l, b); |
|
}), l.remove(c._id), delete j[c._id]), "spawn" == c.type && c.spawning) { |
|
var p = e.find(j, { |
|
user: c.user, |
|
name: c.spawning.name |
|
}); |
|
p && l.remove(p._id); |
|
} |
|
} else "creep" == c.type ? l.update(c, { |
|
hits: c.hits, |
|
body: c.body, |
|
energy: c.energy, |
|
energyCapacity: c.energyCapacity |
|
}) : l.update(c, { |
|
hits: c.hits |
|
}); |
|
b.actionLog && (b.actionLog["creep" == b.type && "ranged" == i ? "rangedAttack" : "attack"] = { |
|
x: c.x, |
|
y: c.y |
|
}), c.actionLog && (c.actionLog.attacked = { |
|
x: b.x, |
|
y: b.y |
|
}), c.notifyWhenAttacked && "2" != b.user && "3" != b.user && f.sendAttackingNotification(c, m), |
|
o && (d(b, o, j, k, l), b.actionLog.attacked = { |
|
x: c.x, |
|
y: c.y |
|
}, b.hits <= 0 ? a("./creeps/_die")(b, j, l, n) : l.update(b, { |
|
hits: b.hits, |
|
body: b.body, |
|
energy: b.energy, |
|
energyCapacity: b.energyCapacity |
|
})); |
|
} |
|
}; |
|
}, { |
|
"../../game/constants": 40, |
|
"../../utils": 140, |
|
"./creeps/_clear-newbie-walls": 71, |
|
"./creeps/_create-energy": 72, |
|
"./creeps/_die": 73, |
|
"./creeps/_recalc-body": 74, |
|
"./creeps/drop": 80, |
|
lodash: 60 |
|
} ], |
|
65: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = (a("../../../utils"), a("../../../game/constants")), f = a("../../../core/core"); |
|
b.exports = function(a, b, c, g, h, i, j) { |
|
if (a && "constructedWall" == a.type) { |
|
if (i && !a.newbieWall) { |
|
var k = e.CONTROLLER_STRUCTURES.constructedWall[i.level] ? e.WALL_HITS_MAX : 0; |
|
k != a.hitsMax && g.update(a, { |
|
hitsMax: k |
|
}); |
|
} |
|
a.ticksToLive > 0 && g.update(a, { |
|
decayTime: j + a.ticksToLive, |
|
ticksToLive: null |
|
}), a.decayTime && (d.isObject(a.decayTime) || ((j >= a.decayTime - 1 || i && !i.user) && (g.remove(a._id), |
|
delete b[a._id]), a.user && j == a.decayTime - 5e3 && f.sendNotification(a.user, "Attention! Your room protection will be removed soon.\nLearn how to defend your room against intruders from <a href='http://support.screeps.com/hc/en-us/articles/203339002-Defending-your-room'>this article</a>.")), |
|
d.isObject(a.decayTime) && Date.now() > a.decayTime.timestamp && (g.remove(a._id), |
|
delete b[a._id])); |
|
} |
|
}; |
|
}, { |
|
"../../../core/core": 28, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
66: [ function(a, b, c) { |
|
"use strict"; |
|
a("lodash"), a("../../../utils"), a("../../../game/constants"); |
|
b.exports = function(b, c, d) { |
|
b && "constructionSite" == b.type && (d.remove(b._id), b.progress > 1 && a("../creeps/_create-energy")(b.x, b.y, b.room, Math.floor(b.progress / 2), c, d)); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../creeps/_create-energy": 72, |
|
lodash: 60 |
|
} ], |
|
67: [ function(a, b, c) { |
|
"use strict"; |
|
a("lodash"), a("../../../utils"), a("../../../game/constants"); |
|
b.exports = function(a, b, c, d) { |
|
!a || "constructionSite" != a.type; |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
68: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(b, c, e, f, g, h, i) { |
|
(!b.nextDecayTime || i >= b.nextDecayTime - 1) && (b.hits = b.hits || 0, b.hits -= d.CONTAINER_DECAY, |
|
b.hits <= 0 ? (d.RESOURCES_ALL.forEach(function(d) { |
|
b[d] > 0 && a("../creeps/_create-energy")(b.x, b.y, b.room, b[d], c, f, d); |
|
}), f.remove(b._id), delete c[b._id]) : (b.nextDecayTime = i + (h && h.level > 0 ? d.CONTAINER_DECAY_TIME_OWNED : d.CONTAINER_DECAY_TIME), |
|
f.update(b, { |
|
hits: b.hits, |
|
nextDecayTime: b.nextDecayTime |
|
}))); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../creeps/_create-energy": 72, |
|
lodash: 60 |
|
} ], |
|
69: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../utils"), a("../../../game/constants")), e = a("../../../core/core"); |
|
b.exports = function(a, b, c, f, g, h, i) { |
|
if (a && "controller" == a.type && (a.reservation && (i >= a.reservation.endTime - 1 || a.user) && f.update(a, { |
|
reservation: null |
|
}), a.user)) { |
|
if (a._upgraded || !a.downgradeTime || a.tutorial) return void f.update(a, { |
|
downgradeTime: i + d.CONTROLLER_DOWNGRADE[a.level] + 1 |
|
}); |
|
i == a.downgradeTime - 5e3 && e.sendNotification(a.user, "Attention! Your Controller in room " + a.room + " will be downgraded to level " + (a.level - 1) + " in 5000 ticks (~3 hours)! Upgrade it to prevent losing of this room. <a href='http://support.screeps.com/hc/en-us/articles/203086021-Territory-control'>Learn more</a>"), |
|
i >= a.downgradeTime - 1 && (a.level--, e.sendNotification(a.user, "Your Controller in room " + a.room + " has been downgraded to level " + a.level + " due to absence of upgrading activity!"), |
|
0 == a.level ? (a.progress = 0, a.user = null, a.downgradeTime = null, a.upgradeBlocked = null) : (a.downgradeTime = i + d.CONTROLLER_DOWNGRADE[a.level] + 1, |
|
a.progress += Math.round(.9 * d.CONTROLLER_LEVELS[a.level])), f.update(a, { |
|
downgradeTime: a.downgradeTime, |
|
level: a.level, |
|
progress: a.progress, |
|
user: a.user, |
|
upgradeBlocked: a.upgradeBlocked |
|
})); |
|
} |
|
}; |
|
}, { |
|
"../../../core/core": 28, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
70: [ function(a, b, c) { |
|
"use strict"; |
|
a("lodash"), a("../../../utils"), a("../../../game/constants"); |
|
b.exports = function(a, b, c, d, e) { |
|
"controller" == a.type && a.user && a.level && e.update(a, { |
|
user: null, |
|
level: 0, |
|
progress: 0, |
|
downgradeTime: null |
|
}); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
71: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"); |
|
a("../../../utils"), a("../../../game/constants"); |
|
b.exports = function(a, b) { |
|
d.forEach(a, function(c) { |
|
"constructedWall" == c.type && c.decayTime && c.user && (b.remove(c._id), delete a[c._id]); |
|
}); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
72: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b, c) { |
|
return b in a ? Object.defineProperty(a, b, { |
|
value: c, |
|
enumerable: !0, |
|
configurable: !0, |
|
writable: !0 |
|
}) : a[b] = c, a; |
|
} |
|
var e = a("lodash"), f = a("../../../utils"); |
|
a("../../../game/constants"); |
|
b.exports = function(a, b, c, g, h, i, j) { |
|
if (j = j || "energy", g = Math.round(g), !(0 >= g)) { |
|
var k = e.find(h, { |
|
type: "container", |
|
x: a, |
|
y: b |
|
}); |
|
if (k && k.hits > 0) { |
|
var l = f.calcResources(k), m = Math.min(g, k.energyCapacity - l); |
|
m > 0 && (k[j] = k[j] || 0, k[j] += m, i.update(k, d({}, j, k[j])), g -= m); |
|
} |
|
if (g > 0) { |
|
var n = e.find(h, { |
|
type: "energy", |
|
x: a, |
|
y: b, |
|
resourceType: j |
|
}); |
|
if (n) i.update(n, d({}, j, n[j] + g)); else { |
|
var o; |
|
i.insert((o = { |
|
type: "energy", |
|
x: a, |
|
y: b, |
|
room: c |
|
}, d(o, j, g), d(o, "resourceType", j), o)); |
|
} |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
73: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
b.exports = function(b, c, g, h, i) { |
|
if (void 0 === i && (i = f.CREEP_CORPSE_RATE), /^arena/.test(b.room)) if (b.energy > 0 && a("./_create-energy")(b.x, b.y, b.room, b.energy, c, g), |
|
b.arenaRespawn) { |
|
var j = d.filter(c, { |
|
type: "portal" |
|
}), k = j[Math.floor(Math.random() * j.length)]; |
|
b.body.forEach(function(a) { |
|
return a.hits = 100; |
|
}), g.update(b, { |
|
spawning: !0, |
|
ticksToSpawn: 150, |
|
x: k.x, |
|
y: k.y, |
|
hits: 100 * b.body.length, |
|
body: b.body, |
|
energy: 0, |
|
energyCapacity: 50, |
|
ticksToLive: 1e4 |
|
}); |
|
} else g.remove(b._id); else { |
|
if (g.remove(b._id), delete c[b._id], i > 0) { |
|
var l = d.any(b.body, { |
|
type: f.CLAIM |
|
}) ? f.CREEP_CLAIM_LIFE_TIME : f.CREEP_LIFE_TIME, m = { |
|
energy: e.calcCreepCost(b.body) * i * b._ticksToLive / l |
|
}; |
|
b.body.forEach(function(a) { |
|
a.boost && (m[a.boost] = m[a.boost] || 0, m[a.boost] += f.LAB_BOOST_MINERAL * i * b._ticksToLive / l, |
|
m.energy += f.LAB_BOOST_ENERGY * i * b._ticksToLive / l); |
|
}), d.forEach(m, function(d, e) { |
|
d > 0 && a("./_create-energy")(b.x, b.y, b.room, Math.floor(d), c, g, e); |
|
}), f.RESOURCES_ALL.forEach(function(d) { |
|
b[d] > 0 && a("./_create-energy")(b.x, b.y, b.room, b[d], c, g, d); |
|
}); |
|
} |
|
h && "3" != b.user && "2" != b.user && h.inc("creepsLost", b.user, b.body.length); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"./_create-energy": 72, |
|
lodash: 60 |
|
} ], |
|
74: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../game/constants")), e = a("../../../utils"); |
|
b.exports = function(a) { |
|
for (var b = a.hits, c = a.body.length - 1; c >= 0; c--) a.body[c]._oldHits = a.body[c]._oldHits || a.body[c].hits, |
|
b > 100 ? a.body[c].hits = 100 : a.body[c].hits = b, b -= 100, 0 > b && (b = 0); |
|
a.energyCapacity = e.calcBodyEffectiveness(a.body, d.CARRY, "capacity", d.CARRY_CAPACITY, !0); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
75: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
a("../../../core/core"); |
|
b.exports = function(b, c, g, h, i, j, k, l) { |
|
if ("creep" == b.type && !b.spawning) { |
|
var m = g[c.id]; |
|
if (m && m != b && !(Math.abs(m.x - b.x) > 1 || Math.abs(m.y - b.y) > 1) && ("creep" != m.type || !m.spawning) && m.hits) { |
|
var n = d.find(g, { |
|
type: "rampart", |
|
x: m.x, |
|
y: m.y |
|
}); |
|
n && (m = n); |
|
var o = e.calcBodyEffectiveness(b.body, f.ATTACK, "attack", f.ATTACK_POWER); |
|
a("../_damage")(b, m, o, "melee", g, h, i, k, l), b._attack = !0; |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../core/core": 28, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../_damage": 64, |
|
lodash: 60 |
|
} ], |
|
76: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = (a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(a, b, c, f, g, h, i, j, k) { |
|
if ("creep" == a.type && !a.spawning) { |
|
var l = c[b.id]; |
|
if (l && "controller" == l.type && !(Math.abs(l.x - a.x) > 1 || Math.abs(l.y - a.y) > 1) && (l.user || l.reservation)) { |
|
var m = Math.floor(d.filter(a.body, function(a) { |
|
return a.hits > 0 && a.type == e.CLAIM; |
|
}).length * e.CONTROLLER_CLAIM_DOWNGRADE); |
|
if (m) { |
|
if (l.reservation) { |
|
var n = l.reservation.endTime - m; |
|
g.update(l, { |
|
reservation: { |
|
endTime: n |
|
} |
|
}); |
|
} |
|
if (l.user) { |
|
var o = l.downgradeTime - m; |
|
g.update(l, { |
|
downgradeTime: o, |
|
upgradeBlocked: k + e.CONTROLLER_ATTACK_BLOCKED_UPGRADE |
|
}); |
|
} |
|
a.actionLog.attack = { |
|
x: l.x, |
|
y: l.y |
|
}; |
|
} |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
77: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../config"), f = a("../../../utils"), g = a("../../../game/constants"), h = 0; |
|
b.exports = function(a, b, c, i, j, k, l, m, n) { |
|
if ("creep" == a.type && !(a.spawning || a.energy <= 0)) { |
|
var o = c[b.id]; |
|
if (o && "constructionSite" == o.type && g.CONSTRUCTION_COST[o.structureType] && !(Math.abs(o.x - a.x) > 3 || Math.abs(o.y - a.y) > 3 || d.any(c, { |
|
x: o.x, |
|
y: o.y, |
|
type: o.structureType |
|
}) || d.contains(g.OBSTACLE_OBJECT_TYPES, o.structureType) && d.any(c, function(a) { |
|
return a.x == o.x && a.y == o.y && d.contains(g.OBSTACLE_OBJECT_TYPES, a.type); |
|
}) || "extractor" != o.structureType && f.checkTerrain(i, o.x, o.y, g.TERRAIN_MASK_WALL))) { |
|
var p = d.filter(a.body, function(a) { |
|
return (a.hits > 0 || a._oldHits > 0) && a.type == g.WORK; |
|
}).length * g.BUILD_POWER || 0, q = o.progressTotal - o.progress, r = Math.min(p, q, a.energy), s = d.map(a.body, function(a) { |
|
return a.type == g.WORK && a.boost && g.BOOSTS[g.WORK][a.boost].build > 0 ? (g.BOOSTS[g.WORK][a.boost].build - 1) * g.BUILD_POWER : 0; |
|
}); |
|
s.sort(function(a, b) { |
|
return b - a; |
|
}), s = s.slice(0, r); |
|
var t = Math.min(Math.floor(r + d.sum(s)), q); |
|
if (!(o.progress + t >= o.progressTotal) || o.tutorial || f.checkControllerAvailability(o.structureType, c, l, 1)) if (o.progress += t, |
|
a.energy -= r, m.inc("energyConstruction", a.user, r), a.actionLog.build = { |
|
x: o.x, |
|
y: o.y |
|
}, j.update(a, { |
|
energy: a.energy |
|
}), o.progress < o.progressTotal) j.update(o, { |
|
progress: o.progress |
|
}); else { |
|
j.remove(o._id); |
|
var u = { |
|
type: o.structureType, |
|
x: o.x, |
|
y: o.y, |
|
room: o.room, |
|
notifyWhenAttacked: !0 |
|
}; |
|
if ("spawn" == o.structureType && d.extend(u, { |
|
name: o.name, |
|
user: o.user, |
|
energy: 0, |
|
energyCapacity: g.SPAWN_ENERGY_CAPACITY, |
|
hits: g.SPAWN_HITS, |
|
hitsMax: g.SPAWN_HITS |
|
}), "extension" == o.structureType && d.extend(u, { |
|
user: o.user, |
|
energy: 0, |
|
energyCapacity: 0, |
|
hits: g.EXTENSION_HITS, |
|
hitsMax: g.EXTENSION_HITS |
|
}), "link" == o.structureType && d.extend(u, { |
|
user: o.user, |
|
energy: 0, |
|
energyCapacity: g.LINK_CAPACITY, |
|
cooldown: 0, |
|
hits: g.LINK_HITS, |
|
hitsMax: g.LINK_HITS_MAX |
|
}), "storage" == o.structureType && d.extend(u, { |
|
user: o.user, |
|
energy: 0, |
|
energyCapacity: g.STORAGE_CAPACITY, |
|
hits: g.STORAGE_HITS, |
|
hitsMax: g.STORAGE_HITS |
|
}), "rampart" == o.structureType && d.extend(u, { |
|
user: o.user, |
|
hits: g.RAMPART_HITS, |
|
hitsMax: g.RAMPART_HITS, |
|
nextDecayTime: n + g.RAMPART_DECAY_TIME |
|
}), "road" == o.structureType) { |
|
var v = g.ROAD_HITS; |
|
(d.any(c, { |
|
x: o.x, |
|
y: o.y, |
|
type: "swamp" |
|
}) || f.checkTerrain(i, o.x, o.y, g.TERRAIN_MASK_SWAMP)) && (v *= g.CONSTRUCTION_COST_ROAD_SWAMP_RATIO), |
|
d.extend(u, { |
|
hits: v, |
|
hitsMax: v |
|
}); |
|
} |
|
"constructedWall" == o.structureType && d.extend(u, { |
|
hits: g.WALL_HITS, |
|
hitsMax: g.WALL_HITS_MAX |
|
}), "tower" == o.structureType && d.extend(u, { |
|
user: o.user, |
|
energy: 0, |
|
energyCapacity: g.TOWER_CAPACITY, |
|
hits: g.TOWER_HITS, |
|
hitsMax: g.TOWER_HITS |
|
}), "observer" == o.structureType && d.extend(u, { |
|
user: o.user, |
|
hits: g.OBSERVER_HITS, |
|
hitsMax: g.OBSERVER_HITS |
|
}), "extractor" == o.structureType && d.extend(u, { |
|
user: o.user, |
|
hits: g.EXTRACTOR_HITS, |
|
hitsMax: g.EXTRACTOR_HITS |
|
}), "lab" == o.structureType && d.extend(u, { |
|
user: o.user, |
|
hits: g.LAB_HITS, |
|
hitsMax: g.LAB_HITS, |
|
mineralAmount: 0, |
|
cooldown: 0, |
|
mineralType: null, |
|
mineralCapacity: g.LAB_MINERAL_CAPACITY, |
|
energy: 0, |
|
energyCapacity: g.LAB_ENERGY_CAPACITY |
|
}), "powerSpawn" == o.structureType && d.extend(u, { |
|
user: o.user, |
|
power: 0, |
|
powerCapacity: g.POWER_SPAWN_POWER_CAPACITY, |
|
energy: 0, |
|
energyCapacity: g.POWER_SPAWN_ENERGY_CAPACITY, |
|
hits: g.POWER_SPAWN_HITS, |
|
hitsMax: g.POWER_SPAWN_HITS |
|
}), "terminal" == o.structureType && d.extend(u, { |
|
user: o.user, |
|
energy: 0, |
|
energyCapacity: g.TERMINAL_CAPACITY, |
|
hits: g.TERMINAL_HITS, |
|
hitsMax: g.TERMINAL_HITS |
|
}), "container" == o.structureType && d.extend(u, { |
|
energy: 0, |
|
energyCapacity: g.CONTAINER_CAPACITY, |
|
hits: g.CONTAINER_HITS, |
|
hitsMax: g.CONTAINER_HITS, |
|
nextDecayTime: n + g.CONTAINER_DECAY_TIME |
|
}), "nuker" == o.structureType && d.extend(u, { |
|
user: o.user, |
|
energy: 0, |
|
energyCapacity: e.ptr ? 1 : g.NUKER_ENERGY_CAPACITY, |
|
G: 0, |
|
GCapacity: e.ptr ? 1 : g.NUKER_GHODIUM_CAPACITY, |
|
hits: g.NUKER_HITS, |
|
hitsMax: g.NUKER_HITS, |
|
cooldownTime: n + (e.ptr ? 100 : g.NUKER_COOLDOWN) |
|
}), j.insert(u), c["createdStructure" + h] = u, h++, delete c[b.id]; |
|
} |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../config": 25, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
78: [ function(a, b, c) { |
|
"use strict"; |
|
a("lodash"), a("../../../utils"), a("../../../game/constants"); |
|
b.exports = function(a, b, c, d, e, f, g, h, i) { |
|
if ("creep" == a.type && !a.spawning) { |
|
var j = c[b.id]; |
|
if (j && "controller" == j.type && !(Math.abs(j.x - a.x) > 1 || Math.abs(j.y - a.y) > 1 || j.bindUser && a.user != j.bindUser || j.level > 0)) { |
|
var k = 1; |
|
e.update(j, { |
|
user: a.user, |
|
level: k, |
|
progress: 0, |
|
downgradeTime: null, |
|
reservation: null |
|
}); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
79: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
b.exports = function(b, c, g, h, i, j, k, l) { |
|
if ("creep" == b.type && !b.spawning) { |
|
var m = g[c.id]; |
|
if (m && f.CONSTRUCTION_COST[m.type] && !(Math.abs(m.x - b.x) > 1 || Math.abs(m.y - b.y) > 1)) { |
|
var n = d.find(g, { |
|
type: "rampart", |
|
x: m.x, |
|
y: m.y |
|
}); |
|
n && (m = n); |
|
var o = e.calcBodyEffectiveness(b.body, f.WORK, "dismantle", f.DISMANTLE_POWER), p = Math.min(o, m.hits), q = Math.floor(p * f.DISMANTLE_COST); |
|
p && (b.energy += q, i.update(b, { |
|
energy: b.energy |
|
}), b.energy > b.energyCapacity && a("./drop")(b, { |
|
amount: b.energy - b.energyCapacity, |
|
resourceType: "energy" |
|
}, g, h, i), a("../_damage")(b, m, p, "melee", g, h, i, k, l)); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../_damage": 64, |
|
"./drop": 80, |
|
lodash: 60 |
|
} ], |
|
80: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b, c) { |
|
return b in a ? Object.defineProperty(a, b, { |
|
value: c, |
|
enumerable: !0, |
|
configurable: !0, |
|
writable: !0 |
|
}) : a[b] = c, a; |
|
} |
|
var e = a("lodash"), f = (a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(b, c, g, h, i) { |
|
"creep" == b.type && e.contains(f.RESOURCES_ALL, c.resourceType) && (b.spawning || b[c.resourceType] < c.amount || (c.amount > 0 && (b[c.resourceType] -= c.amount, |
|
a("./_create-energy")(b.x, b.y, b.room, c.amount, g, i, c.resourceType)), i.update(b, d({}, c.resourceType, b[c.resourceType])))); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"./_create-energy": 72, |
|
lodash: 60 |
|
} ], |
|
81: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b, c) { |
|
return b in a ? Object.defineProperty(a, b, { |
|
value: c, |
|
enumerable: !0, |
|
configurable: !0, |
|
writable: !0 |
|
}) : a[b] = c, a; |
|
} |
|
var e = a("lodash"), f = a("../../../utils"), g = a("../../../game/constants"); |
|
b.exports = function(b, c, h, i, j, k, l, m) { |
|
if ("creep" == b.type && !b.spawning) { |
|
var n = h[c.id]; |
|
if (n && !(Math.abs(n.x - b.x) > 1 || Math.abs(n.y - b.y) > 1)) { |
|
if ("source" == n.type) { |
|
if (!n.energy) return; |
|
if (l && (l.user && l.user != b.user || l.reservation && l.reservation.user != b.user)) return; |
|
var o = f.calcBodyEffectiveness(b.body, g.WORK, "harvest", g.HARVEST_POWER); |
|
if (o) { |
|
var p = Math.min(n.energy, o); |
|
n.energy -= p, b.energy += p; |
|
var q = (n.invaderHarvested || 0) + p; |
|
j.update(b, { |
|
energy: b.energy |
|
}), j.update(n, { |
|
energy: n.energy, |
|
invaderHarvested: q |
|
}); |
|
var r = f.calcResources(b); |
|
r > b.energyCapacity && a("./drop")(b, { |
|
amount: Math.min(b.energy, r - b.energyCapacity), |
|
resourceType: "energy" |
|
}, h, i, j), b.actionLog.harvest = { |
|
x: n.x, |
|
y: n.y |
|
}, m.inc("energyHarvested", b.user, p); |
|
} |
|
} |
|
if ("mineral" == n.type) { |
|
if (!n.mineralAmount) return; |
|
var s = e.find(h, function(a) { |
|
return a.type == g.STRUCTURE_EXTRACTOR && a.x == n.x && a.y == n.y; |
|
}); |
|
if (!s) return; |
|
if (s.user && s.user != b.user) return; |
|
if (!f.checkStructureAgainstController(s, h, l)) return; |
|
var o = f.calcBodyEffectiveness(b.body, g.WORK, "harvest", g.HARVEST_MINERAL_POWER); |
|
if (o) { |
|
var p = Math.min(n.mineralAmount, o); |
|
j.update(n, { |
|
mineralAmount: n.mineralAmount - p |
|
}), j.update(b, d({}, n.mineralType, (b[n.mineralType] || 0) + p)); |
|
var r = f.calcResources(b); |
|
r > b.energyCapacity && a("./drop")(b, { |
|
amount: Math.min(b[n.mineralType], r - b.energyCapacity), |
|
resourceType: n.mineralType |
|
}, h, i, j), b.actionLog.harvest = { |
|
x: n.x, |
|
y: n.y |
|
}; |
|
} |
|
} |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"./drop": 80, |
|
lodash: 60 |
|
} ], |
|
82: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../utils")), e = a("../../../game/constants"); |
|
b.exports = function(b, c, f, g, h) { |
|
function i(b) { |
|
a("./_recalc-body")(b); |
|
} |
|
if ("creep" == b.type && !b.spawning) { |
|
var j = f[c.id]; |
|
if (!(!j || "creep" != j.type || j.spawning || j.hits >= j.hitsMax || Math.abs(j.x - b.x) > 1 || Math.abs(j.y - b.y) > 1)) { |
|
var k = d.calcBodyEffectiveness(b.body, e.HEAL, "heal", e.HEAL_POWER); |
|
j.hits += k, j.hits > j.hitsMax && (j.hits = j.hitsMax), i(j), b.actionLog.heal = { |
|
x: j.x, |
|
y: j.y |
|
}, j.actionLog.healed = { |
|
x: b.x, |
|
y: b.y |
|
}, h.update(j, { |
|
hits: j.hits, |
|
body: j.body, |
|
energyCapacity: j.energyCapacity |
|
}); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"./_recalc-body": 74, |
|
lodash: 60 |
|
} ], |
|
83: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b) { |
|
return a[b] && (!f[b] || !e.any(f[b], function(b) { |
|
return !!a[b]; |
|
})); |
|
} |
|
var e = a("lodash"), f = { |
|
rangedHeal: [ "heal" ], |
|
dismantle: [ "attackController", "rangedHeal", "heal" ], |
|
repair: [ "dismantle", "attackController", "rangedHeal", "heal" ], |
|
build: [ "repair", "dismantle", "attackController", "rangedHeal", "heal" ], |
|
attack: [ "build", "repair", "dismantle", "attackController", "rangedHeal", "heal" ], |
|
harvest: [ "attack", "build", "repair", "dismantle", "attackController", "rangedHeal", "heal" ], |
|
rangedMassAttack: [ "build", "repair", "rangedHeal" ], |
|
rangedAttack: [ "rangedMassAttack", "build", "repair", "rangedHeal" ] |
|
}, g = [ "drop", "transfer", "pickup", "heal", "rangedHeal", "dismantle", "attack", "harvest", "move", "repair", "build", "rangedMassAttack", "rangedAttack", "suicide", "say", "claimController", "upgradeController", "reserveController", "attackController" ], h = { |
|
"_clear-newbie-walls": a("./_clear-newbie-walls.js"), |
|
"_create-energy": a("./_create-energy.js"), |
|
_die: a("./_die.js"), |
|
"_recalc-body": a("./_recalc-body.js"), |
|
attack: a("./attack.js"), |
|
attackController: a("./attackController.js"), |
|
build: a("./build.js"), |
|
claimController: a("./claimController.js"), |
|
dismantle: a("./dismantle.js"), |
|
drop: a("./drop.js"), |
|
harvest: a("./harvest.js"), |
|
heal: a("./heal.js"), |
|
intents: a("./intents.js"), |
|
move: a("./move.js"), |
|
pickup: a("./pickup.js"), |
|
rangedAttack: a("./rangedAttack.js"), |
|
rangedHeal: a("./rangedHeal.js"), |
|
rangedMassAttack: a("./rangedMassAttack.js"), |
|
repair: a("./repair.js"), |
|
reserveController: a("./reserveController.js"), |
|
say: a("./say.js"), |
|
suicide: a("./suicide.js"), |
|
tick: a("./tick.js"), |
|
transfer: a("./transfer.js"), |
|
upgradeController: a("./upgradeController.js") |
|
}; |
|
b.exports = function(a, b, c, e, f, i, j, k, l) { |
|
g.forEach(function(g) { |
|
d(b, g) && h[g](a, b[g], c, e, f, i, j, k, l); |
|
}); |
|
}; |
|
}, { |
|
"./_clear-newbie-walls.js": 71, |
|
"./_create-energy.js": 72, |
|
"./_die.js": 73, |
|
"./_recalc-body.js": 74, |
|
"./attack.js": 75, |
|
"./attackController.js": 76, |
|
"./build.js": 77, |
|
"./claimController.js": 78, |
|
"./dismantle.js": 79, |
|
"./drop.js": 80, |
|
"./harvest.js": 81, |
|
"./heal.js": 82, |
|
"./intents.js": 83, |
|
"./move.js": 84, |
|
"./pickup.js": 85, |
|
"./rangedAttack.js": 86, |
|
"./rangedHeal.js": 87, |
|
"./rangedMassAttack.js": 88, |
|
"./repair.js": 89, |
|
"./reserveController.js": 90, |
|
"./say.js": 91, |
|
"./suicide.js": 92, |
|
"./tick.js": 93, |
|
"./transfer.js": 94, |
|
"./upgradeController.js": 95, |
|
lodash: 60 |
|
} ], |
|
84: [ function(a, b, c) { |
|
"use strict"; |
|
var d = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), e = a("lodash"), f = a("../../../utils"), g = a("../../../game/constants"), h = a("../movement"); |
|
b.exports = function(b, c, i, j, k) { |
|
if ("creep" == b.type && !(b.spawning || b.fatigue > 0) && 0 != e.filter(b.body, function(a) { |
|
return a.hits > 0 && a.type == g.MOVE; |
|
}).length) { |
|
var l = f.getOffsetsByDirection(c.direction), m = null, n = !1; |
|
if (l) { |
|
var o = d(l, 2), p = o[0], q = o[1]; |
|
if (!(b.x + p < 0 || b.x + p > 49 || b.y + q < 0 || b.y + q > 49)) { |
|
var r = e.filter(i, { |
|
x: b.x + p, |
|
y: b.y + q |
|
}); |
|
r.forEach(function(a) { |
|
!b._attack && e.filter(b.body, function(a) { |
|
return a.hits > 0 && a.type == g.ATTACK; |
|
}).length > 0 && (e.contains(g.OBSTACLE_OBJECT_TYPES, a.type) || "rampart" == a.type) && b.user != a.user && a.hits ? m = a : (e.contains(g.OBSTACLE_OBJECT_TYPES, a.type) && "creep" != a.type || "rampart" == a.type && b.user != a.user) && (n = !0); |
|
}), m ? a("./attack")(b, { |
|
id: m._id, |
|
x: m.x, |
|
y: m.y |
|
}, i, j, k) : n || h.add(b, p, q); |
|
} |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../movement": 109, |
|
"./attack": 75, |
|
lodash: 60 |
|
} ], |
|
85: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b, c) { |
|
return b in a ? Object.defineProperty(a, b, { |
|
value: c, |
|
enumerable: !0, |
|
configurable: !0, |
|
writable: !0 |
|
}) : a[b] = c, a; |
|
} |
|
var e = (a("lodash"), a("../../../utils")); |
|
a("../../../game/constants"); |
|
b.exports = function(a, b, c, f, g) { |
|
if ("creep" == a.type) { |
|
var h = e.calcResources(a); |
|
if (!(a.spawning || h >= a.energyCapacity)) { |
|
var i = c[b.id]; |
|
if (i && "energy" == i.type && !(Math.abs(i.x - a.x) > 1 || Math.abs(i.y - a.y) > 1)) { |
|
var j = i.resourceType || "energy", k = Math.min(a.energyCapacity - h, i[j]); |
|
i[j] -= k, a[j] = a[j] || 0, a[j] += k, i[j] ? g.update(i, d({}, j, i[j])) : (g.remove(i._id), |
|
delete c[i._id]), g.update(a, d({}, j, a[j])); |
|
} |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
86: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
a("../../../core/core"); |
|
b.exports = function(b, c, g, h, i, j, k, l) { |
|
if ("creep" == b.type && !b.spawning) { |
|
var m = g[c.id]; |
|
if (m && m != b && !(Math.abs(m.x - b.x) > 3 || Math.abs(m.y - b.y) > 3) && ("creep" != m.type || !m.spawning) && m.hits) { |
|
var n = d.find(g, { |
|
type: "rampart", |
|
x: m.x, |
|
y: m.y |
|
}); |
|
n && (m = n); |
|
var o = e.calcBodyEffectiveness(b.body, f.RANGED_ATTACK, "rangedAttack", f.RANGED_ATTACK_POWER); |
|
a("../_damage")(b, m, o, "ranged", g, h, i, k, l); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../core/core": 28, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../_damage": 64, |
|
lodash: 60 |
|
} ], |
|
87: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
b.exports = function(a, b, c, g, h) { |
|
function i(a) { |
|
for (var b = a.hits, c = a.body.length - 1; c >= 0; c--) b > 100 ? a.body[c].hits = 100 : a.body[c].hits = b, |
|
b -= 100, 0 > b && (b = 0); |
|
a.energyCapacity = d.filter(a.body, function(a) { |
|
return a.hits > 0 && a.type == f.CARRY; |
|
}).length * f.CARRY_CAPACITY; |
|
} |
|
if ("creep" == a.type && !a.spawning) { |
|
var j = c[b.id]; |
|
if (!(!j || "creep" != j.type || j.spawning || j.hits >= j.hitsMax || Math.abs(j.x - a.x) > 3 || Math.abs(j.y - a.y) > 3)) { |
|
var k = e.calcBodyEffectiveness(a.body, f.HEAL, "rangedHeal", f.RANGED_HEAL_POWER); |
|
j.hits += k, j.hits > j.hitsMax && (j.hits = j.hitsMax), i(j), a.actionLog.rangedHeal = { |
|
x: j.x, |
|
y: j.y |
|
}, j.actionLog.healed = { |
|
x: a.x, |
|
y: a.y |
|
}, h.update(j, { |
|
hits: j.hits, |
|
body: j.body, |
|
energyCapacity: j.energyCapacity |
|
}); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
88: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
a("../../../core/core"); |
|
b.exports = function(b, c, g, h, i, j, k, l) { |
|
if ("creep" == b.type && !b.spawning) { |
|
var m = e.calcBodyEffectiveness(b.body, f.RANGED_ATTACK, "rangedMassAttack", f.RANGED_ATTACK_POWER); |
|
if (0 != m) { |
|
var n = d.filter(g, function(a) { |
|
return (!d.isUndefined(a.user) || "powerBank" == a.type) && a.user != b.user && a.x >= b.x - 3 && a.x <= b.x + 3 && a.y >= b.y - 3 && a.y <= b.y + 3; |
|
}), o = { |
|
1: 1, |
|
2: .4, |
|
3: .1 |
|
}; |
|
for (var p in n) { |
|
var q = n[p]; |
|
if (("rampart" == q.type || !d.find(g, { |
|
type: "rampart", |
|
x: q.x, |
|
y: q.y |
|
})) && q.hits) { |
|
var r = Math.max(Math.abs(b.x - q.x), Math.abs(b.y - q.y)), s = Math.round(m * o[r]); |
|
a("../_damage")(b, q, s, "ranged", g, h, i, k, l); |
|
} |
|
} |
|
b.actionLog.rangedMassAttack = {}; |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../core/core": 28, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../_damage": 64, |
|
lodash: 60 |
|
} ], |
|
89: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = (a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(a, b, c, f, g, h, i, j) { |
|
if ("creep" == a.type && !(a.spawning || a.energy <= 0)) { |
|
var k = c[b.id]; |
|
if (k && e.CONSTRUCTION_COST[k.type] && !(k.hits >= k.hitsMax) && !(Math.abs(k.x - a.x) > 3 || Math.abs(k.y - a.y) > 3) && k.hitsMax) { |
|
var l = d.filter(a.body, function(a) { |
|
return (a.hits > 0 || a._oldHits > 0) && a.type == e.WORK; |
|
}).length * e.REPAIR_POWER || 0, m = a.energy / e.REPAIR_COST, n = k.hitsMax - k.hits, o = Math.min(l, m, n), p = Math.min(a.energy, Math.ceil(o * e.REPAIR_COST)), q = d.map(a.body, function(a) { |
|
return a.type == e.WORK && a.boost && e.BOOSTS[e.WORK][a.boost].repair > 0 ? (e.BOOSTS[e.WORK][a.boost].repair - 1) * e.REPAIR_POWER : 0; |
|
}); |
|
q.sort(function(a, b) { |
|
return b - a; |
|
}), q = q.slice(0, o); |
|
var r = Math.min(Math.floor(o + d.sum(q)), n); |
|
r && (k.hits += r, a.energy -= p, j.inc("energyConstruction", a.user, p), k.hits > k.hitsMax && (k.hits = k.hitsMax), |
|
a.actionLog.repair = { |
|
x: k.x, |
|
y: k.y |
|
}, g.update(k, { |
|
hits: k.hits |
|
}), g.update(a, { |
|
energy: a.energy |
|
})); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
90: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = (a("../../../utils"), a("../../../game/constants")); |
|
a("../../../core/core"); |
|
b.exports = function(a, b, c, f, g, h, i, j, k) { |
|
if ("creep" == a.type && !a.spawning) { |
|
var l = c[b.id]; |
|
if (l && "controller" == l.type && !(Math.abs(l.x - a.x) > 1 || Math.abs(l.y - a.y) > 1 || l.user || l.reservation && l.reservation.user != a.user)) { |
|
var m = d.filter(a.body, function(a) { |
|
return a.hits > 0 && a.type == e.CLAIM; |
|
}).length * e.CONTROLLER_RESERVE; |
|
m && (l.reservation || (l.reservation = { |
|
user: a.user, |
|
endTime: k + 1 |
|
}), l.reservation.endTime += m, l.reservation.endTime > k + e.CONTROLLER_RESERVE_MAX || (a.actionLog.reserveController = { |
|
x: l.x, |
|
y: l.y |
|
}, g.update(l, { |
|
reservation: l.reservation |
|
}))); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../core/core": 28, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
91: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"); |
|
a("../../../utils"), a("../../../game/constants"); |
|
b.exports = function(a, b, c, e, f) { |
|
"creep" == a.type && (a.spawning || d.isString(b.message) && (a.actionLog.say = b.message.substring(0, 10))); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
92: [ function(a, b, c) { |
|
"use strict"; |
|
a("lodash"), a("../../../utils"), a("../../../game/constants"); |
|
b.exports = function(b, c, d, e, f, g, h, i) { |
|
"creep" == b.type && (b.spawning || a("./_die")(b, d, f, void 0, "2" == b.user ? 0 : void 0)); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"./_die": 73, |
|
lodash: 60 |
|
} ], |
|
93: [ function(a, b, c) { |
|
"use strict"; |
|
var d = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), e = a("lodash"), f = a("../../../utils"), g = a("../../../game/constants"), h = a("../movement"); |
|
b.exports = function(b, c, i, j, k, l, m, n) { |
|
if (b && "creep" == b.type) { |
|
if (b.spawning) { |
|
var o = e.find(c, { |
|
type: "spawn", |
|
x: b.x, |
|
y: b.y |
|
}); |
|
o ? o.spawning && o.spawning.name == b.name || a("../spawns/_born-creep")(o, b, c, i, j) : j.remove(b._id); |
|
} else { |
|
if (h.execute(b, j, l), (0 == b.x || 0 == b.y || 49 == b.x || 49 == b.y) && "2" != b.user && "3" != b.user) { |
|
var p = f.roomNameToXY(b.room), q = d(p, 2), r = q[0], s = q[1], t = b.x, u = b.y, v = b.room; |
|
0 == b.x ? (t = 49, v = f.getRoomNameFromXY(r - 1, s)) : 0 == b.y ? (u = 49, v = f.getRoomNameFromXY(r, s - 1)) : 49 == b.x ? (t = 0, |
|
v = f.getRoomNameFromXY(r + 1, s)) : 49 == b.y && (u = 0, v = f.getRoomNameFromXY(r, s + 1)), |
|
j.update(b, { |
|
interRoom: { |
|
room: v, |
|
x: t, |
|
y: u |
|
} |
|
}); |
|
} |
|
var w = e.find(c, function(a) { |
|
return "portal" == a.type && a.x == b.x && a.y == b.y; |
|
}); |
|
w && j.update(b, { |
|
interRoom: w.destination |
|
}), b.tutorial || (b.ageTime || (b.ageTime = n + (e.any(b.body, { |
|
type: g.CLAIM |
|
}) ? g.CREEP_CLAIM_LIFE_TIME : g.CREEP_LIFE_TIME), j.update(b, { |
|
ageTime: b.ageTime |
|
})), n >= b.ageTime - 1 && (g.RESOURCES_ALL.forEach(function(d) { |
|
var e = b[d]; |
|
e && a("./_create-energy")(b.x, b.y, b.room, e, c, j, d); |
|
}), j.remove(b._id), delete c[b._id])), e.isEqual(b.actionLog, b._actionLog) || j.update(b, { |
|
actionLog: b.actionLog |
|
}); |
|
} |
|
if (b.fatigue > 0) { |
|
var x = f.calcBodyEffectiveness(b.body, g.MOVE, "fatigue", 1); |
|
b.fatigue -= 2 * x, b.fatigue < 0 && (b.fatigue = 0), j.update(b._id, { |
|
fatigue: b.fatigue |
|
}); |
|
} |
|
/^arena/.test(b.room) && b.ticksToSpawn > 0 && (b.ticksToSpawn--, j.update(b, { |
|
ticksToSpawn: b.ticksToSpawn |
|
})), e.isNaN(b.hits) && a("./_die")(b, c, j, m); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../movement": 109, |
|
"../spawns/_born-creep": 124, |
|
"./_create-energy": 72, |
|
"./_die": 73, |
|
lodash: 60 |
|
} ], |
|
94: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b, c) { |
|
return b in a ? Object.defineProperty(a, b, { |
|
value: c, |
|
enumerable: !0, |
|
configurable: !0, |
|
writable: !0 |
|
}) : a[b] = c, a; |
|
} |
|
var e = a("lodash"), f = a("../../../utils"), g = a("../../../game/constants"); |
|
b.exports = function(a, b, c, h, i, j) { |
|
if ("creep" == a.type && e.contains(g.RESOURCES_ALL, b.resourceType) && !(a.spawning || a[b.resourceType] < b.amount || b.amount < 0)) { |
|
var k = c[b.id]; |
|
if (k && !(Math.abs(k.x - a.x) > 1 || Math.abs(k.y - a.y) > 1)) { |
|
if ("energy" == b.resourceType) { |
|
if (!e.contains([ "spawn", "creep", "extension", "link", "storage", "tower", "powerSpawn", "lab", "terminal", "container", "nuker" ], k.type)) return; |
|
} else if ("power" == b.resourceType) { |
|
if (!e.contains([ "creep", "storage", "powerSpawn", "terminal", "container" ], k.type)) return; |
|
} else if (!e.contains([ "creep", "storage", "lab", "terminal", "container", "nuker" ], k.type)) return; |
|
var l = b.amount; |
|
if ("lab" == k.type) { |
|
if (b.resourceType != g.RESOURCE_ENERGY && k.mineralType && k.mineralType != b.resourceType) return; |
|
var m = b.resourceType == g.RESOURCE_ENERGY ? "energyCapacity" : "mineralCapacity", n = b.resourceType == g.RESOURCE_ENERGY ? "energy" : "mineralAmount"; |
|
if (k[n] >= k[m]) return; |
|
k[n] + l > k[m] && (l = k[m] - k[n]), k[n] += l, i.update(k, d({}, n, k[n])), k.mineralAmount && !k.mineralType && i.update(k, { |
|
mineralType: b.resourceType |
|
}); |
|
} else { |
|
if ("powerSpawn" == k.type) { |
|
if (k[b.resourceType] >= k[b.resourceType + "Capacity"]) return; |
|
k[b.resourceType] + l > k[b.resourceType + "Capacity"] && (l = k[b.resourceType + "Capacity"] - k[b.resourceType]); |
|
} else if ("nuker" == k.type) { |
|
if (b.resourceType != g.RESOURCE_ENERGY && b.resourceType != g.RESOURCE_GHODIUM) return; |
|
if (k[b.resourceType] >= k[b.resourceType + "Capacity"]) return; |
|
k[b.resourceType] + l > k[b.resourceType + "Capacity"] && (l = k[b.resourceType + "Capacity"] - k[b.resourceType]); |
|
} else { |
|
var o = f.calcResources(k); |
|
if (o >= k.energyCapacity) return; |
|
o + l > k.energyCapacity && (l = k.energyCapacity - o); |
|
} |
|
k[b.resourceType] = k[b.resourceType] || 0, k[b.resourceType] += l, i.update(k, d({}, b.resourceType, k[b.resourceType])); |
|
} |
|
a[b.resourceType] -= l, i.update(a, d({}, b.resourceType, a[b.resourceType])); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
95: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = (a("../../../utils"), a("../../../game/constants")), f = a("../../../core/core"), g = a("../../../config"); |
|
b.exports = function(a, b, c, h, i, j, k, l, m) { |
|
if ("creep" == a.type && !(a.spawning || a.energy <= 0)) { |
|
var n = c[b.id]; |
|
if (n && "controller" == n.type && !(Math.abs(n.x - a.x) > 3 || Math.abs(n.y - a.y) > 3 || 0 == n.level || n.user != a.user || n.upgradeBlocked && n.upgradeBlocked > m)) { |
|
n._upgraded = n._upgraded || 0; |
|
var o = d.filter(a.body, function(a) { |
|
return (a.hits > 0 || a._oldHits > 0) && a.type == e.WORK; |
|
}).length * e.UPGRADE_CONTROLLER_POWER || 0, p = Math.min(o, a.energy), q = d.map(a.body, function(a) { |
|
return a.type == e.WORK && a.boost && e.BOOSTS[e.WORK][a.boost].upgradeController > 0 ? e.BOOSTS[e.WORK][a.boost].upgradeController - 1 : 0; |
|
}); |
|
if (8 == n.level) { |
|
if (n._upgraded >= e.CONTROLLER_MAX_UPGRADE_PER_TICK) return; |
|
p = Math.min(p, e.CONTROLLER_MAX_UPGRADE_PER_TICK - n._upgraded); |
|
} |
|
q.sort(function(a, b) { |
|
return b - a; |
|
}), q = q.slice(0, p); |
|
var r = Math.floor(p + d.sum(q)); |
|
if (n.level < 8) { |
|
var s = e.CONTROLLER_LEVELS[n.level]; |
|
g.ptr && (s = 1e3), n.tutorial && 1 == n.level && (s = 4), n.progress + r >= s ? (n.progress = n.progress + r - s, |
|
n.level++, f.sendNotification(n.user, "Your Controller in room " + n.room + " has been upgraded to level " + n.level + "."), |
|
8 == n.level && (n.progress = 0)) : n.progress += r; |
|
} |
|
j.inc && j.inc(n.user, "gcl", r), n._upgraded += p, l.inc("energyControl", a.user, p), |
|
a.energy -= p, a.actionLog.upgradeController = { |
|
x: n.x, |
|
y: n.y |
|
}, i.update(a, { |
|
energy: a.energy |
|
}), i.update(n, { |
|
level: n.level, |
|
progress: n.progress |
|
}); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../config": 25, |
|
"../../../core/core": 28, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
96: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b, c) { |
|
return b in a ? Object.defineProperty(a, b, { |
|
value: c, |
|
enumerable: !0, |
|
configurable: !0, |
|
writable: !0 |
|
}) : a[b] = c, a; |
|
} |
|
var e = a("lodash"), f = (a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(a, b, c, g) { |
|
if (a && "energy" == a.type) { |
|
var h = a.resourceType || "energy"; |
|
a[h] -= Math.ceil(a[h] / f.ENERGY_DECAY), a[h] <= 0 || !a[h] ? (e.isNaN(a[h]), g.remove(a._id), |
|
delete b[a._id]) : g.update(a, d({}, h, a[h])); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
97: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(a, b, c, e, f, g, h) { |
|
if (a && "extension" == a.type && g) { |
|
var i = d.EXTENSION_ENERGY_CAPACITY[g.level] || 0; |
|
i != a.energyCapacity && e.update(a, { |
|
energyCapacity: i |
|
}); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
98: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b, c) { |
|
return b in a ? Object.defineProperty(a, b, { |
|
value: c, |
|
enumerable: !0, |
|
configurable: !0, |
|
writable: !0 |
|
}) : a[b] = c, a; |
|
} |
|
var e = a("lodash"), f = a("../../../utils"), g = a("../../../game/constants"); |
|
b.exports = function(a, b, c, h, i) { |
|
if (e.contains(g.RESOURCES_ALL, b.resourceType)) { |
|
var j = c[b.id]; |
|
if (!(!j || "creep" != j.type || f.calcResources(j) >= j.energyCapacity || b.amount < 0 || Math.abs(j.x - a.x) > 1 || Math.abs(j.y - a.y) > 1)) { |
|
var k = b.amount; |
|
f.calcResources(j) + k > j.energyCapacity && (k = j.energyCapacity - f.calcResources(j)), |
|
a[b.resourceType] < k || (j[b.resourceType] = j[b.resourceType] || 0, j[b.resourceType] += k, |
|
a[b.resourceType] -= k, i.update(a, d({}, b.resourceType, a[b.resourceType])), i.update(j, d({}, b.resourceType, j[b.resourceType]))); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
99: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = (a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(a, b, c, f, g, h, i) { |
|
if (a && "keeperLair" == a.type && (a.nextSpawnTime || d.any(b, function(b) { |
|
return "creep" == b.type && "3" == b.user && b.name == "Keeper" + a._id; |
|
}) || f.update(a, { |
|
nextSpawnTime: i + e.ENERGY_REGEN_TIME |
|
}), a.nextSpawnTime && i >= a.nextSpawnTime - 1)) { |
|
for (var j = [], k = 0; 17 > k; k++) j.push({ |
|
type: e.TOUGH, |
|
hits: 100 |
|
}); |
|
for (var k = 0; 13 > k; k++) j.push({ |
|
type: e.MOVE, |
|
hits: 100 |
|
}); |
|
for (var k = 0; 10 > k; k++) j.push({ |
|
type: e.ATTACK, |
|
hits: 100 |
|
}), j.push({ |
|
type: e.RANGED_ATTACK, |
|
hits: 100 |
|
}); |
|
f.insert({ |
|
name: "Keeper" + a._id, |
|
x: a.x, |
|
y: a.y, |
|
body: j, |
|
energy: 0, |
|
energyCapacity: 0, |
|
type: "creep", |
|
room: a.room, |
|
user: "3", |
|
hits: 5e3, |
|
hitsMax: 5e3, |
|
spawning: !1, |
|
fatigue: 0 |
|
}), f.update(a, { |
|
nextSpawnTime: null |
|
}); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
100: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = (a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(b, c, f, g, h) { |
|
if (!(b.mineralAmount < e.LAB_BOOST_MINERAL || b.energy < e.LAB_BOOST_ENERGY)) { |
|
var i = f[c.id]; |
|
if (i && "creep" == i.type && !(Math.abs(i.x - b.x) > 1 || Math.abs(i.y - b.y) > 1)) { |
|
var j = d.filter(i.body, function(a) { |
|
return !a.boost && e.BOOSTS[a.type][b.mineralType]; |
|
}); |
|
if (j.length) { |
|
for (j[0].type != e.TOUGH && j.reverse(), c.bodyPartsCount && j.slice(0, c.bodyPartsCount); b.mineralAmount >= e.LAB_BOOST_MINERAL && b.energy >= e.LAB_BOOST_ENERGY && j.length; ) j[0].boost = b.mineralType, |
|
b.mineralAmount -= e.LAB_BOOST_MINERAL, b.energy -= e.LAB_BOOST_ENERGY, j.splice(0, 1); |
|
h.update(b, { |
|
mineralAmount: b.mineralAmount, |
|
energy: b.energy |
|
}), b.mineralAmount || h.update(b, { |
|
mineralType: null |
|
}), a("../creeps/_recalc-body")(i), h.update(i, { |
|
body: i.body, |
|
energyCapacity: i.energyCapacity |
|
}), i.actionLog.healed = { |
|
x: b.x, |
|
y: b.y |
|
}; |
|
} |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../creeps/_recalc-body": 74, |
|
lodash: 60 |
|
} ], |
|
101: [ function(a, b, c) { |
|
"use strict"; |
|
b.exports = function(b, c, d, e, f, g, h, i) { |
|
c.transfer && a("./transfer")(b, c.transfer, d, e, f, g, h, i), c.runReaction && a("./run-reaction")(b, c.runReaction, d, e, f, g, h, i), |
|
c.boostCreep && a("./boost-creep")(b, c.boostCreep, d, e, f, g, h, i); |
|
}; |
|
}, { |
|
"./boost-creep": 100, |
|
"./run-reaction": 102, |
|
"./transfer": 104 |
|
} ], |
|
102: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(a, b, c, e, f) { |
|
if (!(a.cooldown > 0)) { |
|
var g = c[b.lab1]; |
|
if (g && "lab" == g.type && !(g.mineralAmount < d.LAB_COOLDOWN) && !(Math.abs(g.x - a.x) > 2 || Math.abs(g.y - a.y) > 2)) { |
|
var h = c[b.lab2]; |
|
!h || "lab" != h.type || h.mineralAmount < d.LAB_COOLDOWN || Math.abs(h.x - a.x) > 2 || Math.abs(h.y - a.y) > 2 || a.mineralAmount > a.mineralCapacity - d.LAB_COOLDOWN || !d.REACTIONS[g.mineralType][h.mineralType] || a.mineralType && a.mineralType != d.REACTIONS[g.mineralType][h.mineralType] || (f.update(a, { |
|
mineralAmount: a.mineralAmount + d.LAB_COOLDOWN, |
|
cooldown: d.LAB_COOLDOWN |
|
}), a.mineralType || f.update(a, { |
|
mineralType: d.REACTIONS[g.mineralType][h.mineralType] |
|
}), f.update(g, { |
|
mineralAmount: g.mineralAmount - d.LAB_COOLDOWN |
|
}), g.mineralAmount || f.update(g, { |
|
mineralType: null |
|
}), f.update(h, { |
|
mineralAmount: h.mineralAmount - d.LAB_COOLDOWN |
|
}), h.mineralAmount || f.update(h, { |
|
mineralType: null |
|
}), a.actionLog.runReaction = { |
|
x1: g.x, |
|
y1: g.y, |
|
x2: h.x, |
|
y2: h.y |
|
}); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
103: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"); |
|
a("../../../utils"), a("../../../game/constants"), a("../movement"); |
|
b.exports = function(a, b, c, e, f, g, h) { |
|
a.cooldown > 0 ? (a.cooldown--, a.cooldown < 0 && (a.cooldown = 0), e.update(a, { |
|
cooldown: a.cooldown, |
|
actionLog: a.actionLog |
|
})) : d.isEqual(a._actionLog, a.actionLog) || e.update(a, { |
|
actionLog: a.actionLog |
|
}); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../movement": 109, |
|
lodash: 60 |
|
} ], |
|
104: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b, c) { |
|
return b in a ? Object.defineProperty(a, b, { |
|
value: c, |
|
enumerable: !0, |
|
configurable: !0, |
|
writable: !0 |
|
}) : a[b] = c, a; |
|
} |
|
var e = a("lodash"), f = a("../../../utils"), g = a("../../../game/constants"); |
|
b.exports = function(a, b, c, h, i) { |
|
if (e.contains(g.RESOURCES_ALL, b.resourceType)) { |
|
var j = c[b.id]; |
|
if (!(!j || "creep" != j.type || f.calcResources(j) >= j.energyCapacity || b.amount < 0 || Math.abs(j.x - a.x) > 1 || Math.abs(j.y - a.y) > 1)) { |
|
var k = b.amount, l = b.resourceType == g.RESOURCE_ENERGY ? "energy" : "mineralAmount"; |
|
f.calcResources(j) + k > j.energyCapacity && (k = j.energyCapacity - f.calcResources(j)), |
|
a[l] < k || (j[b.resourceType] = j[b.resourceType] || 0, j[b.resourceType] += k, |
|
a[l] -= k, !a.mineralAmount && a.mineralType && i.update(a, { |
|
mineralType: null |
|
}), i.update(a, d({}, l, a[l])), i.update(j, d({}, b.resourceType, j[b.resourceType]))); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
105: [ function(a, b, c) { |
|
"use strict"; |
|
b.exports = function(b, c, d, e, f, g, h, i) { |
|
c.transfer && a("./transfer")(b, c.transfer, d, e, f, g, h, i); |
|
}; |
|
}, { |
|
"./transfer": 107 |
|
} ], |
|
106: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"); |
|
a("../../../utils"), a("../../../game/constants"), a("../movement"); |
|
b.exports = function(a, b, c, e, f, g, h) { |
|
a && "link" == a.type && (a.cooldown > 0 ? (a.cooldown--, a.cooldown < 0 && (a.cooldown = 0), |
|
e.update(a, { |
|
cooldown: a.cooldown, |
|
actionLog: a.actionLog |
|
})) : d.isEqual(a._actionLog, a.actionLog) || e.update(a, { |
|
actionLog: a.actionLog |
|
})); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../movement": 109, |
|
lodash: 60 |
|
} ], |
|
107: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
b.exports = function(a, b, c, g, h, i, j) { |
|
if ("link" == a.type && !(a.energy < b.amount || b.amount < 0)) { |
|
var k = c[b.id]; |
|
if (k && d.contains([ "link", "creep" ], k.type)) { |
|
var l; |
|
if ("creep" == k.type) { |
|
if (Math.abs(k.x - a.x) > 1 || Math.abs(k.y - a.y) > 1) return; |
|
l = e.calcResources(k); |
|
} |
|
if ("link" == k.type) { |
|
if (a.cooldown > 0) return; |
|
if (!e.checkStructureAgainstController(a, c, j)) return; |
|
l = k.energy; |
|
} |
|
if (l != k.energyCapacity) { |
|
var m = b.amount; |
|
l + m > k.energyCapacity && (m = k.energyCapacity - l), k.energy += m, a.energy -= m, |
|
"link" == k.type && (k.energy -= Math.ceil(m * f.LINK_LOSS_RATIO), a.cooldown += f.LINK_COOLDOWN * Math.max(Math.abs(k.x - a.x), Math.abs(k.y - a.y)), |
|
a.actionLog.transferEnergy = { |
|
x: k.x, |
|
y: k.y |
|
}), h.update(a, { |
|
energy: a.energy, |
|
cooldown: a.cooldown, |
|
actionLog: a.actionLog |
|
}), h.update(k, { |
|
energy: k.energy |
|
}); |
|
} |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
108: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(a, b, c, e, f, g, h) { |
|
a.mineralAmount || (a.nextRegenerationTime || (a.nextRegenerationTime = h + d.MINERAL_REGEN_TIME, |
|
e.update(a, { |
|
nextRegenerationTime: a.nextRegenerationTime |
|
})), h >= a.nextRegenerationTime - 1 && e.update(a, { |
|
nextRegenerationTime: null, |
|
mineralAmount: Math.floor(d.MINERAL_MIN_AMOUNT[a.mineralType] * (1 + Math.random() * (d.MINERAL_RANDOM_FACTOR - 1))) |
|
})); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
109: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b, c) { |
|
return k.any(h, function(d) { |
|
return d.x == a && d.y == b && (k.contains(m.OBSTACLE_OBJECT_TYPES, d.type) && ("creep" != d.type || !f[d._id]) || "rampart" == d.type && d.user != c.user || "exit" == d.type && "2" != c.user && !/^arena/.test(c.room) || "constructionSite" == d.type && d.user == c.user && k.contains(m.OBSTACLE_OBJECT_TYPES, d.structureType)); |
|
}) || l.checkTerrain(i, a, b, m.TERRAIN_MASK_WALL); |
|
} |
|
var e, f, g, h, i, j = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), k = a("lodash"), l = a("../../utils"), m = a("../../game/constants"); |
|
c.init = function(a, b) { |
|
e = {}, f = {}, g = {}, h = a, i = b; |
|
}, c.add = function(a, b, c) { |
|
var d = a.x + b, f = a.y + c; |
|
d >= 50 && (d = 49), f >= 50 && (f = 49), 0 > d && (d = 0), 0 > f && (f = 0); |
|
var h = d + "," + f; |
|
e[h] = e[h] || [], e[h].push(a), g[h] = g[h] + 1 || 1; |
|
}, c.check = function() { |
|
function a(b) { |
|
var c = e[b]; |
|
if (f[e[b]._id] = null, delete e[b], c) { |
|
var d = c.x + "," + c.y; |
|
e[d] && a(d); |
|
} |
|
} |
|
var b = {}; |
|
for (var c in e) { |
|
var h, i = c.split(/,/), l = j(i, 2), n = l[0], o = l[1]; |
|
if (n = parseInt(n), o = parseInt(o), e[c].length > 1) { |
|
var p = k.map(e[c], function(a) { |
|
var b = k.filter(a.body, function(a) { |
|
return a.hits > 0 && a.type == m.MOVE; |
|
}).length, c = k.filter(a.body, function(a) { |
|
return a.type != m.MOVE && a.type != m.CARRY; |
|
}).length; |
|
c += Math.ceil(a.energy / m.CARRY_CAPACITY), c = c || 1; |
|
var d = a.x + "," + a.y, f = g[d] || 0; |
|
return e[d] && k.any(e[d], { |
|
x: n, |
|
y: o |
|
}) && (f = 100), { |
|
object: a, |
|
rate1: f, |
|
rate2: b / c |
|
}; |
|
}); |
|
p.sort(function(a, b) { |
|
return b.rate1 - a.rate1 != 0 ? b.rate1 - a.rate1 : b.rate2 - a.rate2; |
|
}), h = p[0].object; |
|
} else h = e[c][0]; |
|
f[h._id] = { |
|
x: n, |
|
y: o |
|
}, b[c] = h; |
|
} |
|
e = b; |
|
for (var c in e) { |
|
var q = c.split(/,/), r = j(q, 2), n = r[0], o = r[1]; |
|
n = parseInt(n), o = parseInt(o); |
|
var s = e[c], t = (n - s.x, o - s.y, d(n, o, s)); |
|
t && a(c); |
|
} |
|
}, c.execute = function(b, c, d) { |
|
var e = f[b._id]; |
|
if (e) { |
|
var g = k.filter(h, function(a) { |
|
return a.x == e.x && a.y == e.y; |
|
}), j = 2; |
|
(k.any(g, { |
|
type: "swamp" |
|
}) || l.checkTerrain(i, e.x, e.y, m.TERRAIN_MASK_SWAMP)) && (j = 10); |
|
var n = k.find(g, { |
|
type: "road" |
|
}); |
|
n && (j = 1, n.nextDecayTime -= m.ROAD_WEAROUT * b.body.length, c.update(n, { |
|
nextDecayTime: n.nextDecayTime |
|
})); |
|
var o = k.find(g, function(a) { |
|
return "constructionSite" == a.type && a.user != b.user; |
|
}); |
|
o && a("./construction-sites/remove")(o, h, c); |
|
var p = k(b.body).filter(function(a) { |
|
return a.type != m.MOVE && a.type != m.CARRY; |
|
}).size(), q = 0; |
|
m.RESOURCES_ALL.forEach(function(a) { |
|
q += b[a] || 0; |
|
}), p += Math.ceil(q / m.CARRY_CAPACITY), p *= j, c.update(b, { |
|
x: e.x, |
|
y: e.y, |
|
fatigue: p |
|
}); |
|
} |
|
}; |
|
}, { |
|
"../../game/constants": 40, |
|
"../../utils": 140, |
|
"./construction-sites/remove": 66, |
|
lodash: 60 |
|
} ], |
|
110: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../config")), e = a("../../../utils"), f = a("../../../game/constants"); |
|
b.exports = function(a, b, c, g, h, i, j, k, l, m) { |
|
e.checkStructureAgainstController(a, c, j) && (a.G < a.GCapacity || a.energy < a.energyCapacity || a.cooldownTime > l || b.x < 0 || b.y < 0 || b.x > 49 || b.y > 49 || m.novice && m.novice > Date.now() || (h.update(a, { |
|
energy: 0, |
|
G: 0, |
|
cooldownTime: l + (d.ptr ? 100 : f.NUKER_COOLDOWN) |
|
}), h.insert({ |
|
type: "nuke", |
|
room: b.roomName, |
|
x: b.x, |
|
y: b.y, |
|
landTime: l + (d.ptr ? 100 : f.NUKE_LAND_TIME), |
|
launchRoomName: a.room |
|
}))); |
|
}; |
|
}, { |
|
"../../../config": 25, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
111: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = (a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(b, c, f, g, h, i, j, k, l) { |
|
if (l.novice && l.novice > Date.now()) return g.remove(b._id), void delete c[b._id]; |
|
if (j == b.landTime - 1) { |
|
d.forEach(c, function(b) { |
|
b && ("creep" == b.type && a("../creeps/_die")(b, c, g, k, 0), ("constructionSite" == b.type || "energy" == b.type) && (g.remove(b._id), |
|
delete c[b._id])); |
|
}); |
|
for (var m = -4; 4 >= m; m++) for (var n = function(h) { |
|
var j = b.x + m, l = b.y + h, n = Math.max(Math.abs(m), Math.abs(h)), o = 0 == n ? e.NUKE_DAMAGE[0] : 1 == n ? e.NUKE_DAMAGE[1] : e.NUKE_DAMAGE[4], p = d.filter(c, { |
|
x: j, |
|
y: l |
|
}), q = d.find(p, { |
|
type: "rampart" |
|
}); |
|
if (q) { |
|
var r = q.hits; |
|
d.pull(p, q), a("../_damage")(b, q, o, "ranged", c, f, g, i, k), o -= r; |
|
} |
|
o > 0 && p.forEach(function(d) { |
|
a("../_damage")(b, d, o, "ranged", c, f, g, i, k); |
|
}); |
|
}, o = -4; 4 >= o; o++) n(o); |
|
} |
|
j >= b.landTime && (g.remove(b._id), delete c[b._id]); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../_damage": 64, |
|
"../creeps/_die": 73, |
|
lodash: 60 |
|
} ], |
|
112: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = (a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(a, b, c, f, g, h, i) { |
|
if (a.unstableDate && Date.now() > a.unstableDate && f.update(a, { |
|
decayTime: i + e.PORTAL_DECAY, |
|
unstableDate: null |
|
}), a.decayTime && i > a.decayTime) { |
|
f.remove(a._id), delete b[a._id]; |
|
var j = d.find(b, function(b) { |
|
return "constructedWall" == b.type && b.x == a.x + 1 && b.y == a.y + 1; |
|
}); |
|
j && (f.remove(j._id), delete b[j._id]); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
113: [ function(a, b, c) { |
|
"use strict"; |
|
b.exports = function(b, c, d, e, f, g, h, i, j) { |
|
c.processPower && a("./process-power")(b, c.createCreep, d, e, f, g, h, i); |
|
}; |
|
}, { |
|
"./process-power": 114 |
|
} ], |
|
114: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../utils")), e = a("../../../game/constants"); |
|
b.exports = function(a, b, c, f, g, h, i, j) { |
|
"powerSpawn" == a.type && d.checkStructureAgainstController(a, c, i) && (!a.power || a.energy < e.POWER_SPAWN_ENERGY_RATIO || (a.power--, |
|
a.energy -= e.POWER_SPAWN_ENERGY_RATIO, j.inc("powerProcessed", a.user, 1), g.update(a, { |
|
energy: a.energy, |
|
power: a.power |
|
}), h.inc && h.inc(a.user, "power", 1))); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
115: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(a, b, c, e, f, g, h) { |
|
if (a && "rampart" == a.type) { |
|
if (g) { |
|
var i = d.RAMPART_HITS_MAX[g.level] || 0; |
|
i != a.hitsMax && e.update(a, { |
|
hitsMax: i |
|
}); |
|
} |
|
(!a.nextDecayTime || h >= a.nextDecayTime - 1) && (a.hits = a.hits || 0, a.hits -= d.RAMPART_DECAY_AMOUNT, |
|
a.hits <= 0 ? (e.remove(a._id), delete b[a._id]) : (a.nextDecayTime = h + d.RAMPART_DECAY_TIME, |
|
e.update(a, { |
|
hits: a.hits, |
|
nextDecayTime: a.nextDecayTime |
|
}))); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
116: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
b.exports = function(a, b, c, g, h, i, j) { |
|
if (a && "road" == a.type && (!a.nextDecayTime || j >= a.nextDecayTime - 1)) { |
|
var k = f.ROAD_DECAY_AMOUNT; |
|
(d.any(b, function(b) { |
|
return b.x == a.x && b.y == a.y && "swamp" == b.type; |
|
}) || e.checkTerrain(c, a.x, a.y, f.TERRAIN_MASK_SWAMP)) && (k *= f.CONSTRUCTION_COST_ROAD_SWAMP_RATIO), |
|
a.hits -= k, a.hits <= 0 ? (g.remove(a._id), delete b[a._id]) : (a.nextDecayTime = j + f.ROAD_DECAY_TIME, |
|
g.update(a, { |
|
hits: a.hits, |
|
nextDecayTime: a.nextDecayTime |
|
})); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
117: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"), g = a("../../../config"), h = 0; |
|
b.exports = function(a, b, c, i, j, k) { |
|
if (!(a.x <= 0 || a.x >= 49 || a.y <= 0 || a.y >= 49) && f.CONSTRUCTION_COST[a.structureType]) { |
|
if (/^(W|E)/.test(a.roomName)) { |
|
if (k && (k.user && k.user != a.user || k.reservation && k.reservation.user != a.user)) return; |
|
if (!e.checkControllerAvailability(a.structureType, b, k)) return; |
|
} |
|
if (e.checkConstructionSite(b, a.structureType, a.x, a.y) && e.checkConstructionSite(c, a.structureType, a.x, a.y)) { |
|
var l = f.CONSTRUCTION_COST[a.structureType]; |
|
"road" == a.structureType && (d.any(b, { |
|
x: a.x, |
|
y: a.y, |
|
type: "swamp" |
|
}) || e.checkTerrain(c, a.x, a.y, f.TERRAIN_MASK_SWAMP)) && (l *= f.CONSTRUCTION_COST_ROAD_SWAMP_RATIO), |
|
g.ptr && (l = 1); |
|
var m = { |
|
structureType: a.structureType, |
|
x: a.x, |
|
y: a.y, |
|
type: "constructionSite", |
|
room: a.roomName, |
|
user: a.user, |
|
progress: 0, |
|
progressTotal: l |
|
}; |
|
"spawn" == a.structureType && (m.name = a.name), i.insert(m), b["_createdConstructionSite" + h] = m, |
|
h++; |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../config": 25, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
118: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = (a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(a, b) { |
|
var c = a.name.replace(/\|/g, "$VLINE$").replace(/~/g, "$TILDE$"); |
|
if (!d.any(b, function(b) { |
|
return b.user == a.user && d.any(b._parsed, function(a) { |
|
return a[0] == c; |
|
}); |
|
}) && a.color && d.contains(e.COLORS_ALL, a.color) && a.secondaryColor && d.contains(e.COLORS_ALL, a.secondaryColor) && !(a.x < 0 || a.x > 49 || a.y < 0 || a.y > 49)) { |
|
var f = d.find(b, { |
|
user: a.user |
|
}); |
|
f || (f = { |
|
user: a.user, |
|
room: a.roomName, |
|
_parsed: [] |
|
}, b.push(f)), f._modified = !0, f._parsed.push([ c, a.color, a.secondaryColor, a.x, a.y ]); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
119: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = (a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(b, c, f, g, h, i) { |
|
var j = c[b.id]; |
|
if (j && e.CONSTRUCTION_COST[j.type] && i && i.user == b.user && (j.type != e.STRUCTURE_WALL || !j.decayTime || j.user) && !d.any(c, function(a) { |
|
return "creep" == a.type && a.user != b.user; |
|
})) { |
|
if (g.remove(j._id), "spawn" == j.type && j.spawning) { |
|
var k = d.find(c, { |
|
user: j.user, |
|
name: j.spawning.name |
|
}); |
|
k && g.remove(k._id); |
|
} |
|
e.RESOURCES_ALL.forEach(function(b) { |
|
j[b] > 0 && a("../creeps/_create-energy")(j.x, j.y, j.room, j[b], c, g, b); |
|
}), "constructedWall" == j.type && j.decayTime && j.user && a("../creeps/_clear-newbie-walls")(c, g); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../creeps/_clear-newbie-walls": 71, |
|
"../creeps/_create-energy": 72, |
|
lodash: 60 |
|
} ], |
|
120: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
b.exports = function(a, b, c, g) { |
|
if ("3" == a.user) { |
|
var h, i; |
|
do h = Math.floor(48 * Math.random()) + 1, i = Math.floor(48 * Math.random()) + 1; while (d.any(b, function(a) { |
|
return d.contains(f.OBSTACLE_OBJECT_TYPES, a.type) && a.x == h && a.y == i; |
|
}) || e.checkTerrain(c, h, i, f.TERRAIN_MASK_WALL)); |
|
g.insert({ |
|
x: h, |
|
y: i, |
|
type: "energy", |
|
energy: 300, |
|
room: a.roomName |
|
}); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
121: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"); |
|
a("../../../core/core"); |
|
b.exports = function(b, c, e, f, g, h, i, j) { |
|
i.forEach(function(a) { |
|
a._parsed = a.data.split("|"), a._parsed = d.map(a._parsed, function(a) { |
|
return a.split("~"); |
|
}); |
|
}), b.removeFlag && d.forEach(b.removeFlag, function(b) { |
|
a("./remove-flag")(b, i); |
|
}), b.createFlag && d.forEach(b.createFlag, function(b) { |
|
a("./create-flag")(b, i); |
|
}), b.createConstructionSite && d.forEach(b.createConstructionSite, function(b) { |
|
a("./create-construction-site")(b, c, e, f, g, h); |
|
}), b.destroyStructure && d.forEach(b.destroyStructure, function(b) { |
|
a("./destroy-structure")(b, c, e, f, g, h); |
|
}), b.genEnergy && a("./gen-energy")(b.genEnergy, c, e, f, g, h), i.forEach(function(a) { |
|
if (a._modified) { |
|
var b = d.map(a._parsed, function(a) { |
|
return a.join("~"); |
|
}).join("|"); |
|
a._id ? j.update(a._id, { |
|
data: b |
|
}) : j.insert({ |
|
data: b, |
|
user: a.user, |
|
room: a.room |
|
}); |
|
} |
|
}); |
|
}; |
|
}, { |
|
"../../../core/core": 28, |
|
"./create-construction-site": 117, |
|
"./create-flag": 118, |
|
"./destroy-structure": 119, |
|
"./gen-energy": 120, |
|
"./remove-flag": 122, |
|
lodash: 60 |
|
} ], |
|
122: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"); |
|
a("../../../utils"), a("../../../game/constants"); |
|
b.exports = function(a, b) { |
|
var c = d.find(b, { |
|
user: a.user |
|
}); |
|
if (c) { |
|
var e = a.name.replace(/\|/g, "$VLINE$").replace(/~/g, "$TILDE$"); |
|
d.any(c._parsed, function(a) { |
|
return a[0] == e; |
|
}) && (c._modified = !0, d.remove(c._parsed, function(a) { |
|
return a[0] == e; |
|
})); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
123: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../utils"), a("../../../game/constants")); |
|
b.exports = function(a, b, c, e, f, g, h) { |
|
a && "source" == a.type && (a.energy < a.energyCapacity && (a.nextRegenerationTime || (a.nextRegenerationTime = h + d.ENERGY_REGEN_TIME, |
|
e.update(a, { |
|
nextRegenerationTime: a.nextRegenerationTime |
|
})), h >= a.nextRegenerationTime - 1 && e.update(a, { |
|
nextRegenerationTime: null, |
|
energy: a.energyCapacity |
|
})), g ? (g.user || g.reservation || a.energyCapacity == d.SOURCE_ENERGY_NEUTRAL_CAPACITY || e.update(a, { |
|
energyCapacity: d.SOURCE_ENERGY_NEUTRAL_CAPACITY, |
|
energy: Math.min(a.energy, d.SOURCE_ENERGY_NEUTRAL_CAPACITY) |
|
}), (g.user || g.reservation) && a.energyCapacity != d.SOURCE_ENERGY_CAPACITY && e.update(a, { |
|
energyCapacity: d.SOURCE_ENERGY_CAPACITY |
|
})) : a.energyCapacity != d.SOURCE_ENERGY_KEEPER_CAPACITY && e.update(a, { |
|
energyCapacity: d.SOURCE_ENERGY_KEEPER_CAPACITY |
|
})); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
124: [ function(a, b, c) { |
|
"use strict"; |
|
var d = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), e = a("lodash"), f = a("../../../utils"), g = a("../../../game/constants"); |
|
b.exports = function(a, b, c, h, i) { |
|
for (var j, k, l, m = function(a) { |
|
return e.contains(g.OBSTACLE_OBJECT_TYPES, a.type) && a.x == j && a.y == k; |
|
}, n = 1; 8 >= n; n++) { |
|
var o = f.getOffsetsByDirection(n), p = d(o, 2), q = p[0], r = p[1]; |
|
if (j = a.x + q, k = a.y + r, l = e.any(c, m) || f.checkTerrain(h, j, k, g.TERRAIN_MASK_WALL), |
|
!l) break; |
|
} |
|
return l || i.update(b, { |
|
x: j, |
|
y: k, |
|
spawning: !1 |
|
}), !l; |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
125: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"); |
|
a("../../../game/constants"); |
|
b.exports = function(a, b, c, f, g) { |
|
var h = d.filter(b, function(b) { |
|
return "spawn" == b.type && b.user == a.user && !b.off; |
|
}), i = d.filter(b, function(b) { |
|
return "extension" == b.type && b.user == a.user && !b.off; |
|
}), j = d.sum(i, "energy") + d.sum(h, "energy"); |
|
return c > j ? !1 : (i.sort(e.comparatorDistance(a)), h.forEach(function(a) { |
|
var b = Math.min(c, a.energy); |
|
a.energy -= b, c -= b, f.update(a, { |
|
energy: a.energy |
|
}); |
|
}), i.forEach(function(a) { |
|
if (!(0 >= c)) { |
|
var b = Math.min(c, a.energy); |
|
a.energy -= b, c -= b, f.update(a, { |
|
energy: a.energy |
|
}); |
|
} |
|
}), !0); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
126: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
b.exports = function(b, c, g, h, i, j, k, l) { |
|
if (!b.spawning && "spawn" == b.type && e.checkStructureAgainstController(b, g, k)) { |
|
c.body = c.body.slice(0, f.MAX_CREEP_SIZE); |
|
var m = e.calcCreepCost(c.body), n = a("./_charge-energy")(b, g, m, i, k); |
|
if (n) { |
|
l.inc("energyCreeps", b.user, m), l.inc("creepsProduced", b.user, c.body.length), |
|
i.update(b, { |
|
spawning: { |
|
name: c.name, |
|
needTime: f.CREEP_SPAWN_TIME * c.body.length, |
|
remainingTime: f.CREEP_SPAWN_TIME * c.body.length |
|
} |
|
}); |
|
var o = [], p = 0; |
|
c.body.forEach(function(a) { |
|
d.contains(f.BODYPARTS_ALL, a) && o.push({ |
|
type: a, |
|
hits: 100 |
|
}), a == f.CARRY && (p += f.CARRY_CAPACITY); |
|
}); |
|
var q = { |
|
name: c.name, |
|
x: b.x, |
|
y: b.y, |
|
body: o, |
|
energy: 0, |
|
energyCapacity: p, |
|
type: "creep", |
|
room: b.room, |
|
user: b.user, |
|
hits: 100 * o.length, |
|
hitsMax: 100 * o.length, |
|
spawning: !0, |
|
fatigue: 0, |
|
notifyWhenAttacked: !0 |
|
}; |
|
b.tutorial && (q.tutorial = !0), i.insert(q); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"./_charge-energy": 125, |
|
lodash: 60 |
|
} ], |
|
127: [ function(a, b, c) { |
|
"use strict"; |
|
b.exports = function(b, c, d, e, f, g, h, i, j) { |
|
c.createCreep && a("./create-creep")(b, c.createCreep, d, e, f, g, h, i), c.transferEnergy && a("./transfer-energy")(b, c.transferEnergy, d, e, f, g, h), |
|
c.renewCreep && a("./renew-creep")(b, c.renewCreep, d, e, f, g, h, i, j), c.recycleCreep && a("./recycle-creep")(b, c.recycleCreep, d, e, f, g, h, i, j); |
|
}; |
|
}, { |
|
"./create-creep": 126, |
|
"./recycle-creep": 128, |
|
"./renew-creep": 129, |
|
"./transfer-energy": 131 |
|
} ], |
|
128: [ function(a, b, c) { |
|
"use strict"; |
|
a("lodash"), a("../../../utils"), a("../../../game/constants"); |
|
b.exports = function(b, c, d, e, f, g, h, i, j) { |
|
if ("spawn" == b.type) { |
|
var k = d[c.id]; |
|
k && "creep" == k.type && k.user == b.user && (Math.abs(k.x - b.x) > 1 || Math.abs(k.y - b.y) > 1 || a("../creeps/_die")(k, d, f, void 0, 1)); |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../creeps/_die": 73, |
|
lodash: 60 |
|
} ], |
|
129: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
b.exports = function(b, c, g, h, i, j, k, l, m) { |
|
if ("spawn" == b.type && !b.spawning) { |
|
var n = g[c.id]; |
|
if (n && "creep" == n.type && n.user == b.user && !(Math.abs(n.x - b.x) > 1 || Math.abs(n.y - b.y) > 1 || d.filter(n.body, function(a) { |
|
return a.type == f.CLAIM; |
|
}).length > 0)) { |
|
var o = Math.floor(f.CREEP_LIFE_TIME / f.CREEP_SPAWN_TIME / n.body.length); |
|
if (!(n.ageTime + o > m + f.CREEP_LIFE_TIME)) { |
|
var p = Math.ceil(e.calcCreepCost(n.body) / f.CREEP_SPAWN_TIME / n.body.length), q = a("./_charge-energy")(b, g, p, i, k); |
|
q && (l.inc("energyCreeps", b.user, p), n.ageTime += o, n.actionLog.healed = { |
|
x: b.x, |
|
y: b.y |
|
}, i.update(n, { |
|
ageTime: n.ageTime |
|
}), d.any(n.body, function(a) { |
|
return !!a.boost; |
|
}) && (n.body.forEach(function(a) { |
|
a.boost = null; |
|
}), a("../creeps/_recalc-body")(n), i.update(n, { |
|
body: n.body, |
|
energyCapacity: n.energyCapacity |
|
}))); |
|
} |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../creeps/_recalc-body": 74, |
|
"./_charge-energy": 125, |
|
lodash: 60 |
|
} ], |
|
130: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
b.exports = function(b, c, g, h, i, j, k) { |
|
if (b && "spawn" == b.type) { |
|
if (b.spawning) if (b.spawning.remainingTime--, b.spawning.remainingTime <= 0) { |
|
var l = d.find(c, { |
|
type: "creep", |
|
name: b.spawning.name, |
|
x: b.x, |
|
y: b.y |
|
}), m = a("./_born-creep")(b, l, c, g, h); |
|
m ? h.update(b, { |
|
spawning: null |
|
}) : h.update(b, { |
|
spawning: { |
|
remainingTime: 0 |
|
} |
|
}); |
|
} else h.update(b, { |
|
spawning: { |
|
remainingTime: b.spawning.remainingTime |
|
} |
|
}); |
|
if (j && !(j.level < 1) && j.user == b.user) { |
|
var n = d.filter(c, { |
|
type: "spawn" |
|
}); |
|
n.length > f.CONTROLLER_STRUCTURES.spawn[j.level] && (n.sort(e.comparatorDistance(j)), |
|
n = d.take(n, f.CONTROLLER_STRUCTURES.spawn[j.level]), !d.contains(n, b)) || !b.tutorial && k < f.SPAWN_ENERGY_CAPACITY && b.energy < f.SPAWN_ENERGY_CAPACITY && (b.energy++, |
|
h.update(b, { |
|
energy: b.energy |
|
})); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"./_born-creep": 124, |
|
lodash: 60 |
|
} ], |
|
131: [ function(a, b, c) { |
|
"use strict"; |
|
a("lodash"), a("../../../utils"), a("../../../game/constants"); |
|
b.exports = function(a, b, c, d, e) { |
|
if ("spawn" == a.type) { |
|
var f = c[b.id]; |
|
if (!(!f || "creep" != f.type || f.energy >= f.energyCapacity || b.amount < 0 || Math.abs(f.x - a.x) > 1 || Math.abs(f.y - a.y) > 1)) { |
|
var g = b.amount; |
|
f.energy + g > f.energyCapacity && (g = f.energyCapacity - f.energy), a.energy < g || (f.energy += g, |
|
a.energy -= g, e.update(a, { |
|
energy: a.energy |
|
}), e.update(f, { |
|
energy: f.energy |
|
})); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
132: [ function(a, b, c) { |
|
"use strict"; |
|
var d = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), e = a("lodash"), f = a("../../../utils"), g = a("../../../game/constants"); |
|
b.exports = function(a, b, c, h, i) { |
|
if (/^(W|E)\d+(N|S)\d+$/.test(b.targetRoomName)) { |
|
var j = f.roomNameToXY(a.room), k = d(j, 2), l = k[0], m = k[1], n = f.roomNameToXY(b.targetRoomName), o = d(n, 2), p = o[0], q = o[1]; |
|
if (e.contains(g.RESOURCES_ALL, b.resourceType) && b.amount && a[b.resourceType] && !(a[b.resourceType] < b.amount)) { |
|
var r = Math.max(Math.abs(p - l), Math.abs(q - m)); |
|
b.resourceType != g.RESOURCE_ENERGY && a.energy < Math.round(g.TERMINAL_SEND_COST * r * b.amount) || b.resourceType == g.RESOURCE_ENERGY && a.energy < b.amount + Math.round(g.TERMINAL_SEND_COST * r * b.amount) || i.update(a, { |
|
send: b |
|
}); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
133: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"), e = a("../../../utils"), f = a("../../../game/constants"); |
|
a("../../../core/core"); |
|
b.exports = function(b, c, g, h, i, j, k, l) { |
|
if ("tower" == b.type && !b.spawning) { |
|
var m = g[c.id]; |
|
if (m && m != b && ("creep" != m.type || !m.spawning) && m.hits && !(b.energy < f.TOWER_ENERGY_COST)) { |
|
var n = d.find(g, { |
|
type: "rampart", |
|
x: m.x, |
|
y: m.y |
|
}); |
|
n && (m = n); |
|
var o = Math.max(Math.abs(m.x - b.x), Math.abs(m.y - b.y)), p = f.TOWER_POWER_ATTACK; |
|
o > f.TOWER_OPTIMAL_RANGE && (o > f.TOWER_FALLOFF_RANGE && (o = f.TOWER_FALLOFF_RANGE), |
|
p -= p * f.TOWER_FALLOFF * (o - f.TOWER_OPTIMAL_RANGE) / (f.TOWER_FALLOFF_RANGE - f.TOWER_OPTIMAL_RANGE)), |
|
p = Math.floor(p), p && (a("../_damage")(b, m, p, "ranged", g, h, i, k, l), b.energy -= f.TOWER_ENERGY_COST, |
|
i.update(b, { |
|
energy: b.energy |
|
}), b.actionLog.attack = { |
|
x: m.x, |
|
y: m.y |
|
}, m.actionLog && (m.actionLog.attacked = { |
|
x: b.x, |
|
y: b.y |
|
}), m.notifyWhenAttacked && e.sendAttackingNotification(m, k)); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../core/core": 28, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../_damage": 64, |
|
lodash: 60 |
|
} ], |
|
134: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../utils"), a("../../../game/constants")); |
|
a("../../../core/core"); |
|
b.exports = function(b, c, e, f, g, h, i, j) { |
|
if ("tower" == b.type && !b.spawning) { |
|
var k = e[c.id]; |
|
if (k && "creep" == k.type && !k.spawning && !(k.hits >= k.hitsMax || b.energy < d.TOWER_ENERGY_COST)) { |
|
var l = Math.max(Math.abs(k.x - b.x), Math.abs(k.y - b.y)), m = d.TOWER_POWER_HEAL; |
|
l > d.TOWER_OPTIMAL_RANGE && (l > d.TOWER_FALLOFF_RANGE && (l = d.TOWER_FALLOFF_RANGE), |
|
m -= m * d.TOWER_FALLOFF * (l - d.TOWER_OPTIMAL_RANGE) / (d.TOWER_FALLOFF_RANGE - d.TOWER_OPTIMAL_RANGE)), |
|
m = Math.floor(m), m && (k.hits += m, k.hits > k.hitsMax && (k.hits = k.hitsMax), |
|
a("../creeps/_recalc-body")(k), g.update(k, { |
|
hits: k.hits, |
|
body: k.body, |
|
energyCapacity: k.energyCapacity |
|
}), b.energy -= d.TOWER_ENERGY_COST, g.update(b, { |
|
energy: b.energy |
|
}), b.actionLog.heal = { |
|
x: k.x, |
|
y: k.y |
|
}, k.actionLog.healed = { |
|
x: b.x, |
|
y: b.y |
|
}); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../core/core": 28, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../creeps/_recalc-body": 74, |
|
lodash: 60 |
|
} ], |
|
135: [ function(a, b, c) { |
|
"use strict"; |
|
b.exports = function(b, c, d, e, f, g, h, i) { |
|
c.transfer && a("./transfer")(b, c.transfer, d, e, f, g, h, i), c.heal ? a("./heal")(b, c.heal, d, e, f, g, h, i) : c.repair ? a("./repair")(b, c.repair, d, e, f, g, h, i) : c.attack && a("./attack")(b, c.attack, d, e, f, g, h, i); |
|
}; |
|
}, { |
|
"./attack": 133, |
|
"./heal": 134, |
|
"./repair": 136, |
|
"./transfer": 138 |
|
} ], |
|
136: [ function(a, b, c) { |
|
"use strict"; |
|
var d = (a("lodash"), a("../../../utils"), a("../../../game/constants")); |
|
a("../../../core/core"); |
|
b.exports = function(a, b, c, e, f, g, h, i) { |
|
if ("tower" == a.type && !a.spawning) { |
|
var j = c[b.id]; |
|
if (j && d.CONSTRUCTION_COST[j.type] && !(j.hits >= j.hitsMax) && !(a.energy < d.TOWER_ENERGY_COST)) { |
|
var k = Math.max(Math.abs(j.x - a.x), Math.abs(j.y - a.y)), l = d.TOWER_POWER_REPAIR; |
|
k > d.TOWER_OPTIMAL_RANGE && (k > d.TOWER_FALLOFF_RANGE && (k = d.TOWER_FALLOFF_RANGE), |
|
l -= l * d.TOWER_FALLOFF * (k - d.TOWER_OPTIMAL_RANGE) / (d.TOWER_FALLOFF_RANGE - d.TOWER_OPTIMAL_RANGE)), |
|
l = Math.floor(l), l && (j.hits += l, j.hits > j.hitsMax && (j.hits = j.hitsMax), |
|
f.update(j, { |
|
hits: j.hits |
|
}), a.energy -= d.TOWER_ENERGY_COST, a.actionLog.repair = { |
|
x: j.x, |
|
y: j.y |
|
}, f.update(a, { |
|
energy: a.energy |
|
}), i.inc("energyConstruction", a.user, d.TOWER_ENERGY_COST)); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../core/core": 28, |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
137: [ function(a, b, c) { |
|
"use strict"; |
|
var d = a("lodash"); |
|
a("../../../utils"), a("../../../game/constants"), a("../movement"); |
|
b.exports = function(a, b, c, e, f, g, h) { |
|
a && "tower" == a.type && (d.isEqual(a._actionLog, a.actionLog) || e.update(a, { |
|
actionLog: a.actionLog |
|
})); |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
"../movement": 109, |
|
lodash: 60 |
|
} ], |
|
138: [ function(a, b, c) { |
|
"use strict"; |
|
a("lodash"), a("../../../utils"), a("../../../game/constants"); |
|
b.exports = function(a, b, c, d, e, f, g) { |
|
if ("tower" == a.type && !(a.energy < b.amount || b.amount < 0)) { |
|
var h = c[b.id]; |
|
if (h && "creep" == h.type && !(Math.abs(h.x - a.x) > 1 || Math.abs(h.y - a.y) > 1) && h.energy != h.energyCapacity) { |
|
var i = b.amount; |
|
h.energy + i > h.energyCapacity && (i = h.energyCapacity - h.energy), h.energy += i, |
|
a.energy -= i, e.update(a, { |
|
energy: a.energy |
|
}), e.update(h, { |
|
energy: h.energy |
|
}); |
|
} |
|
} |
|
}; |
|
}, { |
|
"../../../game/constants": 40, |
|
"../../../utils": 140, |
|
lodash: 60 |
|
} ], |
|
139: [ function(a, b, c) { |
|
"use strict"; |
|
function d(a, b) { |
|
function c(c) { |
|
i.mark("endMakeRuntime:" + c.username), c.console && e.sendConsoleMessages(a, c.console); |
|
var d = []; |
|
return c.memory && d.push(e.saveUserMemory(a, c.memory, b)), c.intents && d.push(e.saveUserIntents(a, c.intents)), |
|
f.all(d).then(function() { |
|
return i.mark("saveUser:" + c.username), c.error ? f.reject(c.error) : void 0; |
|
}); |
|
} |
|
return i.setNow(), e.makeRuntime(a, b, i).then(c, c); |
|
} |
|
var e = a("./core/core"), f = a("q"), g = (a("./game/constants"), a("lodash"), a("util"), |
|
0), h = a("./utils"), i = h.getTimelineStats("runner"); |
|
e.connect("runner").then(function() { |
|
function a() { |
|
var c, f; |
|
g++, "undefined" == typeof self, b.fetch().then(function(a) { |
|
c = f = a; |
|
var b, e = c.match(/^SourceKeeper:(.*)$/); |
|
return e && (c = "3", b = e[1]), e = c.match(/^Invader:(.*)$/), e && (c = "2", b = e[1]), |
|
d(c, b); |
|
})["catch"](function(a) { |
|
return e.sendConsoleError(c, a); |
|
}).then(function() { |
|
return b.markDone(f); |
|
})["catch"](function(a) {})["finally"](function() { |
|
e.flushTimelineStats(i.getStats()), setTimeout(a, 0); |
|
}); |
|
} |
|
var b = e.queue.create("users", !0); |
|
a(); |
|
})["catch"](function(a) {}), "undefined " == typeof self && setInterval(function() { |
|
var a = f.getUnhandledReasons(); |
|
a.forEach(function(a) {}), f.resetUnhandledRejections(); |
|
}, 1e3); |
|
}, { |
|
"./core/core": 28, |
|
"./game/constants": 40, |
|
"./utils": 140, |
|
lodash: 60, |
|
q: 61, |
|
util: 144 |
|
} ], |
|
140: [ function(require, module, exports) { |
|
"use strict"; |
|
function _defineProperty(a, b, c) { |
|
return b in a ? Object.defineProperty(a, b, { |
|
value: c, |
|
enumerable: !0, |
|
configurable: !0, |
|
writable: !0 |
|
}) : a[b] = c, a; |
|
} |
|
var _slicedToArray = function() { |
|
function a(a, b) { |
|
var c = [], d = !0, e = !1, f = void 0; |
|
try { |
|
for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), |
|
!b || c.length !== b); d = !0) ; |
|
} catch (i) { |
|
e = !0, f = i; |
|
} finally { |
|
try { |
|
!d && h["return"] && h["return"](); |
|
} finally { |
|
if (e) throw f; |
|
} |
|
} |
|
return c; |
|
} |
|
return function(b, c) { |
|
if (Array.isArray(b)) return b; |
|
if (Symbol.iterator in Object(b)) return a(b, c); |
|
throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
}; |
|
}(), _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(a) { |
|
return typeof a; |
|
} : function(a) { |
|
return a && "function" == typeof Symbol && a.constructor === Symbol ? "symbol" : typeof a; |
|
}, _offsetsByDirection, _ = require("lodash"), C = require("./game/constants"), offsetsByDirection = (_offsetsByDirection = {}, |
|
_defineProperty(_offsetsByDirection, C.TOP, [ 0, -1 ]), _defineProperty(_offsetsByDirection, C.TOP_RIGHT, [ 1, -1 ]), |
|
_defineProperty(_offsetsByDirection, C.RIGHT, [ 1, 0 ]), _defineProperty(_offsetsByDirection, C.BOTTOM_RIGHT, [ 1, 1 ]), |
|
_defineProperty(_offsetsByDirection, C.BOTTOM, [ 0, 1 ]), _defineProperty(_offsetsByDirection, C.BOTTOM_LEFT, [ -1, 1 ]), |
|
_defineProperty(_offsetsByDirection, C.LEFT, [ -1, 0 ]), _defineProperty(_offsetsByDirection, C.TOP_LEFT, [ -1, -1 ]), |
|
_offsetsByDirection); |
|
exports.fetchXYArguments = function(a, b, c) { |
|
var d, e, f; |
|
if (_.isUndefined(b) || !_.isNumber(b)) { |
|
if (!_.isObject(a)) return [ void 0, void 0, void 0 ]; |
|
a instanceof c.RoomPosition && (d = a.x, e = a.y, f = a.roomName), a.pos && a.pos instanceof c.RoomPosition && (d = a.pos.x, |
|
e = a.pos.y, f = a.pos.roomName); |
|
} else d = a, e = b; |
|
return _.isNaN(d) && (d = void 0), _.isNaN(e) && (e = void 0), [ d, e, f ]; |
|
}, exports.getDirection = function(a, b) { |
|
var c = Math.abs(a), d = Math.abs(b); |
|
return c > 2 * d ? a > 0 ? C.RIGHT : C.LEFT : d > 2 * c ? b > 0 ? C.BOTTOM : C.TOP : a > 0 && b > 0 ? C.BOTTOM_RIGHT : a > 0 && 0 > b ? C.TOP_RIGHT : 0 > a && b > 0 ? C.BOTTOM_LEFT : 0 > a && 0 > b ? C.TOP_LEFT : void 0; |
|
}, exports.getOffsetsByDirection = function(a) { |
|
return !offsetsByDirection[a], offsetsByDirection[a]; |
|
}, exports.calcCreepCost = function(a) { |
|
var b = 0; |
|
return a.forEach(function(a) { |
|
b += _.isObject(a) ? C.BODYPART_COST[a.type] : C.BODYPART_COST[a]; |
|
}), b; |
|
}, exports.checkConstructionSite = function(a, b, c, d) { |
|
var e; |
|
if ("road" == b || 1 != c && 48 != c && 1 != d && 48 != d || (1 == c && (e = [ [ 0, d - 1 ], [ 0, d ], [ 0, d + 1 ] ]), |
|
48 == c && (e = [ [ 49, d - 1 ], [ 49, d ], [ 49, d + 1 ] ]), 1 == d && (e = [ [ c - 1, 0 ], [ c, 0 ], [ c + 1, 0 ] ]), |
|
48 == d && (e = [ [ c - 1, 49 ], [ c, 49 ], [ c + 1, 49 ] ])), _.isString(a) || a instanceof Uint8Array) { |
|
if (e) for (var f in e) if (!exports.checkTerrain(a, e[f][0], e[f][1], C.TERRAIN_MASK_WALL)) return !1; |
|
return "extractor" == b ? !0 : exports.checkTerrain(a, c, d, C.TERRAIN_MASK_WALL) ? !1 : !0; |
|
} |
|
if (a && _.isArray(a[0]) && _.isString(a[0][0])) { |
|
if (e) for (var f in e) if (!(a[e[f][1]][e[f][0]] & C.TERRAIN_MASK_WALL)) return !1; |
|
return "extractor" == b ? !0 : a[d][c] & C.TERRAIN_MASK_WALL ? !1 : !0; |
|
} |
|
return _.any(a, { |
|
x: c, |
|
y: d, |
|
type: b |
|
}) ? !1 : _.any(a, { |
|
x: c, |
|
y: d, |
|
type: "constructionSite" |
|
}) ? !1 : "extractor" == b ? _.any(a, { |
|
x: c, |
|
y: d, |
|
type: "mineral" |
|
}) && !_.any(a, { |
|
x: c, |
|
y: d, |
|
type: "extractor" |
|
}) : "rampart" != b && "road" != b && _.any(a, function(a) { |
|
return a.x == c && a.y == d && "rampart" != a.type && "road" != a.type && C.CONSTRUCTION_COST[a.type]; |
|
}) ? !1 : 0 >= c || 0 >= d || c >= 49 || d >= 49 ? !1 : "spawn" != b && "extension" != b || !_.any(a, function(a) { |
|
return "source" == a.type ? Math.abs(a.x - c) < 5 && Math.abs(a.y - d) < 5 : !1; |
|
}) ? !0 : !1; |
|
}, exports.getDiff = function(a, b) { |
|
function c(a) { |
|
var b = {}; |
|
return _.forEach(a, function(a) { |
|
return b[a._id] = a; |
|
}), b; |
|
} |
|
var d = {}, e = c(a), f = c(b); |
|
return _.forEach(a, function(a) { |
|
if (f[a._id]) { |
|
var b = f[a._id], c = d[a._id] = {}; |
|
for (var e in a) if ("_id" != e) if (_.isUndefined(b[e])) c[e] = null; else if (_typeof(a[e]) != _typeof(b[e]) || a[e] && !b[e]) c[e] = b[e]; else if (_.isObject(a[e])) { |
|
c[e] = {}; |
|
for (var g in a[e]) _.isEqual(a[e][g], b[e][g]) || (c[e][g] = b[e][g]); |
|
for (var g in b[e]) _.isUndefined(a[e][g]) && (c[e][g] = b[e][g]); |
|
_.size(c[e]) || delete d[a._id][e]; |
|
} else _.isEqual(a[e], b[e]) || (c[e] = b[e]); |
|
for (var e in b) _.isUndefined(a[e]) && (c[e] = b[e]); |
|
_.size(c) || delete d[a._id]; |
|
} else d[a._id] = null; |
|
}), _.forEach(b, function(a) { |
|
e[a._id] || (d[a._id] = a); |
|
}), d; |
|
}, exports.encodeTerrain = function(a) { |
|
for (var b = "", c = 0; 50 > c; c++) for (var d = 0; 50 > d; d++) { |
|
var e = _.filter(a, { |
|
x: d, |
|
y: c |
|
}), f = 0; |
|
_.any(e, { |
|
type: "wall" |
|
}) && (f |= C.TERRAIN_MASK_WALL), _.any(e, { |
|
type: "swamp" |
|
}) && (f |= C.TERRAIN_MASK_SWAMP), b += f; |
|
} |
|
return b; |
|
}, exports.decodeTerrain = function(a) { |
|
var b = []; |
|
for (var c in a) if ("terrain" == a[c].type) for (var d = 0; 50 > d; d++) for (var e = 0; 50 > e; e++) { |
|
var f = a[c].terrain.charAt(50 * d + e); |
|
f & C.TERRAIN_MASK_WALL && b.push({ |
|
room: a[c].room, |
|
x: e, |
|
y: d, |
|
type: "wall" |
|
}), f & C.TERRAIN_MASK_SWAMP && b.push({ |
|
room: a[c].room, |
|
x: e, |
|
y: d, |
|
type: "swamp" |
|
}); |
|
} |
|
return b; |
|
}, exports.decodeTerrainByRoom = function(a) { |
|
var b = { |
|
spatial: {} |
|
}; |
|
for (var c in a) if ("terrain" == a[c].type) { |
|
b[a[c].room] = b[a[c].room] || [], b.spatial[a[c].room] = new Array(50); |
|
for (var d = 0; 50 > d; d++) { |
|
b.spatial[a[c].room][d] = new Array(50); |
|
for (var e = 0; 50 > e; e++) { |
|
var f = a[c].terrain.charAt(50 * d + e); |
|
b.spatial[a[c].room][d][e] = f; |
|
} |
|
} |
|
} |
|
return b; |
|
}, exports.checkTerrain = function(a, b, c, d) { |
|
var e = a instanceof Uint8Array ? a[50 * c + b] : Number(a.charAt(50 * c + b)); |
|
return (e & d) > 0; |
|
}, exports.checkControllerAvailability = function(a, b, c, d) { |
|
var e = 0; |
|
_.isObject(c) && c.level && (c.user || c.owner) && (e = c.level), _.isNumber(c) && (e = c), |
|
d = d || 0; |
|
var f = _(b).filter(function(b) { |
|
return b.type == a || "constructionSite" == b.type && b.structureType == a; |
|
}).size(), g = C.CONTROLLER_STRUCTURES[a][e] + d; |
|
return g > f; |
|
}, exports.getRoomNameFromXY = function(a, b) { |
|
return a = 0 > a ? "W" + (-a - 1) : "E" + a, b = 0 > b ? "N" + (-b - 1) : "S" + b, |
|
"" + a + b; |
|
}, exports.roomNameToXY = function(a) { |
|
a = a.toUpperCase(); |
|
var b = a.match(/^(\w)(\d+)(\w)(\d+)$/); |
|
if (!b) return [ void 0, void 0 ]; |
|
var c = _slicedToArray(b, 5), d = c[1], e = c[2], f = c[3], g = c[4]; |
|
return e = "W" == d ? -e - 1 : +e, g = "N" == f ? -g - 1 : +g, [ e, g ]; |
|
}, exports.comparatorDistance = function(a) { |
|
return a.pos && (a = a.pos), function(b, c) { |
|
b.pos && (b = b.pos), c.pos && (c = c.pos); |
|
var d = Math.max(Math.abs(b.x - a.x), Math.abs(b.y - a.y)), e = Math.max(Math.abs(c.x - a.x), Math.abs(c.y - a.y)); |
|
return d - e; |
|
}; |
|
}, exports.getTimelineStats = function(a) { |
|
a += Math.floor(1e5 * Math.random()); |
|
var b = Date.now(), c = []; |
|
return { |
|
mark: function(d) { |
|
c.push({ |
|
type: a, |
|
name: d, |
|
start: b, |
|
end: Date.now() |
|
}), this.setNow(); |
|
}, |
|
setNow: function() { |
|
b = Date.now(); |
|
}, |
|
getStats: function() { |
|
var a = c; |
|
return c = [], a; |
|
} |
|
}; |
|
}, exports.storeIntents = function(a, b, c) { |
|
var d = {}; |
|
for (var e in b) if ("notify" != e) if ("room" != e) { |
|
var f = c.userObjects[e] || c.roomObjects[e]; |
|
if (f) { |
|
var g = b[e]; |
|
d[f.room] = d[f.room] || {}; |
|
var h = d[f.room][e] = {}; |
|
g.transfer && (h.transfer = { |
|
id: "" + g.transfer.id, |
|
amount: parseInt(g.transfer.amount), |
|
resourceType: "" + g.transfer.resourceType |
|
}), e in c.userObjects && (g.move && (h.move = { |
|
direction: parseInt(g.move.direction) |
|
}), g.harvest && (h.harvest = { |
|
id: "" + g.harvest.id |
|
}), g.attack && (h.attack = { |
|
id: "" + g.attack.id, |
|
x: parseInt(g.attack.x), |
|
y: parseInt(g.attack.y) |
|
}), g.rangedAttack && (h.rangedAttack = { |
|
id: "" + g.rangedAttack.id |
|
}), g.rangedMassAttack && (h.rangedMassAttack = {}), g.heal && (h.heal = { |
|
id: "" + g.heal.id, |
|
x: parseInt(g.heal.x), |
|
y: parseInt(g.heal.y) |
|
}), g.rangedHeal && (h.rangedHeal = { |
|
id: "" + g.rangedHeal.id |
|
}), g.repair && (h.repair = { |
|
id: "" + g.repair.id, |
|
x: parseInt(g.repair.x), |
|
y: parseInt(g.repair.y) |
|
}), g.build && (h.build = { |
|
id: "" + g.build.id, |
|
x: parseInt(g.build.x), |
|
y: parseInt(g.build.y) |
|
}), g.transferEnergy && (h.transferEnergy = { |
|
id: "" + g.transferEnergy.id, |
|
amount: parseInt(g.transferEnergy.amount) |
|
}), g.drop && (h.drop = { |
|
amount: parseInt(g.drop.amount), |
|
resourceType: "" + g.drop.resourceType |
|
}), g.pickup && (h.pickup = { |
|
id: "" + g.pickup.id |
|
}), g.createCreep && (h.createCreep = { |
|
name: "" + g.createCreep.name, |
|
body: _.filter(g.createCreep.body, function(a) { |
|
return _.contains(C.BODYPARTS_ALL, a); |
|
}) |
|
}), g.renewCreep && (h.renewCreep = { |
|
id: "" + g.renewCreep.id |
|
}), g.recycleCreep && (h.recycleCreep = { |
|
id: "" + g.recycleCreep.id |
|
}), g.suicide && (h.suicide = {}), g.remove && (h.remove = {}), g.unclaim && (h.unclaim = {}), |
|
g.say && (h.say = { |
|
message: g.say.message.substring(0, 10) |
|
}), g.claimController && (h.claimController = { |
|
id: "" + g.claimController.id |
|
}), g.attackController && (h.attackController = { |
|
id: "" + g.attackController.id |
|
}), g.unclaimController && (h.unclaimController = { |
|
id: "" + g.unclaimController.id |
|
}), g.upgradeController && (h.upgradeController = { |
|
id: "" + g.upgradeController.id |
|
}), g.reserveController && (h.reserveController = { |
|
id: "" + g.reserveController.id |
|
}), g.notifyWhenAttacked && (h.notifyWhenAttacked = { |
|
enabled: !!g.notifyWhenAttacked.enabled |
|
}), g.setPosition && (h.setPosition = { |
|
x: parseInt(g.setPosition.x), |
|
y: parseInt(g.setPosition.y), |
|
roomName: "" + g.setPosition.roomName |
|
}), g.setColor && (h.setColor = { |
|
color: "" + g.setColor.color, |
|
secondaryColor: "" + g.setColor.secondaryColor |
|
}), g.destroy && (h.destroy = {}), g.observeRoom && (h.observeRoom = { |
|
roomName: "" + g.observeRoom.roomName |
|
}), g.processPower && (h.processPower = {}), g.dismantle && (h.dismantle = { |
|
id: "" + g.dismantle.id |
|
}), g.runReaction && (h.runReaction = { |
|
lab1: "" + g.runReaction.lab1, |
|
lab2: "" + g.runReaction.lab2 |
|
}), g.boostCreep && (h.boostCreep = { |
|
id: "" + g.boostCreep.id, |
|
bodyPartsCount: parseInt(g.boostCreep.bodyPartsCount) |
|
}), g.send && (h.send = { |
|
targetRoomName: "" + g.send.targetRoomName, |
|
resourceType: "" + g.send.resourceType, |
|
amount: parseInt(g.send.amount), |
|
description: ("" + (g.send.description || "")).substring(0, 100) |
|
}), g.launchNuke && (h.launchNuke = { |
|
roomName: "" + g.launchNuke.roomName, |
|
x: parseInt(g.launchNuke.x), |
|
y: parseInt(g.launchNuke.y) |
|
})); |
|
} |
|
} else { |
|
var i = b.room; |
|
i.createFlag && _.forEach(i.createFlag, function(b) { |
|
d[b.roomName] = d[b.roomName] || {}; |
|
var c = d[b.roomName].room = d[b.roomName].room || {}; |
|
c.createFlag = c.createFlag || [], c.createFlag.push({ |
|
x: parseInt(b.x), |
|
y: parseInt(b.y), |
|
name: "" + b.name, |
|
color: +b.color, |
|
secondaryColor: +b.secondaryColor, |
|
roomName: b.roomName, |
|
user: a |
|
}); |
|
}), i.createConstructionSite && _.forEach(i.createConstructionSite, function(b) { |
|
d[b.roomName] = d[b.roomName] || {}; |
|
var c = d[b.roomName].room = d[b.roomName].room || {}; |
|
c.createConstructionSite = c.createConstructionSite || [], c.createConstructionSite.push({ |
|
x: parseInt(b.x), |
|
y: parseInt(b.y), |
|
structureType: "" + b.structureType, |
|
name: "" + b.name, |
|
roomName: "" + b.roomName, |
|
user: a |
|
}); |
|
}), i.destroyStructure && _.forEach(i.destroyStructure, function(b) { |
|
d[b.roomName] = d[b.roomName] || {}; |
|
var c = d[b.roomName].room = d[b.roomName].room || {}; |
|
c.destroyStructure = c.destroyStructure || [], c.destroyStructure.push({ |
|
roomName: "" + b.roomName, |
|
id: "" + b.id, |
|
user: a |
|
}); |
|
}), i.removeFlag && _.forEach(i.removeFlag, function(b) { |
|
d[b.roomName] = d[b.roomName] || {}; |
|
var c = d[b.roomName].room = d[b.roomName].room || {}; |
|
c.removeFlag = c.removeFlag || [], c.removeFlag.push({ |
|
roomName: "" + b.roomName, |
|
name: "" + b.name, |
|
user: a |
|
}); |
|
}); |
|
} else d.notify = [], _.isArray(b.notify) && b.notify.forEach(function(a) { |
|
d.notify.push({ |
|
message: ("" + a.message).substring(0, 1e3), |
|
groupInterval: +a.groupInterval |
|
}); |
|
}); |
|
return d; |
|
}, exports.sendAttackingNotification = function(a, b) { |
|
var c, d = require("./core/core"); |
|
c = "creep" == a.type ? "creep " + a.name : "spawn" == a.type ? "spawn " + a.name : a.type + " #" + a._id; |
|
var e = a.user ? a.user : b ? b.user : null; |
|
e && d.sendNotification(e, "Your " + c + " in room " + a.room + " is under attack!"); |
|
}, exports.checkStructureAgainstController = function(a, b, c) { |
|
if (!a.user) return !0; |
|
if (!c || c.level < 1 || a.user && c.user != a.user) return !1; |
|
if (1 == C.CONTROLLER_STRUCTURES[a.type][8]) return 0 != C.CONTROLLER_STRUCTURES[a.type][c.level]; |
|
var d = _.filter(b, { |
|
type: a.type, |
|
user: a.user |
|
}); |
|
return d.length > C.CONTROLLER_STRUCTURES[a.type][c.level] && (d.sort(exports.comparatorDistance(c)), |
|
d = _.take(d, C.CONTROLLER_STRUCTURES[a.type][c.level]), !_.contains(d, a)) ? !1 : !0; |
|
}, exports.defineGameObjectProperties = function(obj, dataFn, properties) { |
|
var propertiesInfo = {}; |
|
for (var name in properties) eval("\n propertiesInfo['" + name + "'] = {\n enumerable: true,\n get() {\n if(!this['_" + name + "']) {\n this['_" + name + "'] = properties['" + name + "'](dataFn(this.id));\n }\n return this['_" + name + "'];\n }\n }"); |
|
Object.defineProperties(obj, propertiesInfo), obj.toJSON = function() { |
|
var a = {}; |
|
for (var b in this) "_" == b[0] || _.contains([ "toJSON", "toString" ], b) || (a[b] = this[b]); |
|
return a; |
|
}; |
|
}, exports.serializePath = function(a) { |
|
if (!_.isArray(a)) throw new Error("path is not an array"); |
|
var b = ""; |
|
if (!a.length) return b; |
|
if (a[0].x < 0 || a[0].y < 0) throw new Error("path coordinates cannot be negative"); |
|
b += a[0].x > 9 ? a[0].x : "0" + a[0].x, b += a[0].y > 9 ? a[0].y : "0" + a[0].y; |
|
for (var c = 0; c < a.length; c++) b += a[c].direction; |
|
return b; |
|
}, exports.deserializePath = function(a) { |
|
if (!_.isString(a)) throw new Error("`path` is not a string"); |
|
var b = []; |
|
if (!a.length) return b; |
|
var c, d, e, f, g; |
|
if (c = parseInt(a.substring(0, 2)), d = parseInt(a.substring(2, 4)), _.isNaN(c) || _.isNaN(d)) throw new Error("`path` is not a valid serialized path string"); |
|
for (var h = 4; h < a.length; h++) { |
|
if (e = parseInt(a.charAt(h)), !offsetsByDirection[e]) throw new Error("`path` is not a valid serialized path string"); |
|
f = offsetsByDirection[e][0], g = offsetsByDirection[e][1], h > 4 && (c += f, d += g), |
|
b.push({ |
|
x: c, |
|
y: d, |
|
dx: f, |
|
dy: g, |
|
direction: e |
|
}); |
|
} |
|
return b; |
|
}, exports.calcResources = function(a) { |
|
return _.sum(C.RESOURCES_ALL, function(b) { |
|
return "object" == _typeof(a[b]) ? a[b].amount : a[b] || 0; |
|
}); |
|
}, exports.calcBodyEffectiveness = function(a, b, c, d, e) { |
|
var f = 0; |
|
return a.forEach(function(a) { |
|
if ((a.hits || !e && a._oldHits) && a.type == b) { |
|
var g = d; |
|
a.boost && C.BOOSTS[b][a.boost] && C.BOOSTS[b][a.boost][c] && (g *= C.BOOSTS[b][a.boost][c]), |
|
f += g; |
|
} |
|
}), f; |
|
}; |
|
}, { |
|
"./core/core": 28, |
|
"./game/constants": 40, |
|
lodash: 60 |
|
} ], |
|
141: [ function(a, b, c) { |
|
"function" == typeof Object.create ? b.exports = function(a, b) { |
|
a.super_ = b, a.prototype = Object.create(b.prototype, { |
|
constructor: { |
|
value: a, |
|
enumerable: !1, |
|
writable: !0, |
|
configurable: !0 |
|
} |
|
}); |
|
} : b.exports = function(a, b) { |
|
a.super_ = b; |
|
var c = function() {}; |
|
c.prototype = b.prototype, a.prototype = new c(), a.prototype.constructor = a; |
|
}; |
|
}, {} ], |
|
142: [ function(a, b, c) { |
|
function d() { |
|
k = !1, h.length ? j = h.concat(j) : l = -1, j.length && e(); |
|
} |
|
function e() { |
|
if (!k) { |
|
var a = setTimeout(d); |
|
k = !0; |
|
for (var b = j.length; b; ) { |
|
for (h = j, j = []; ++l < b; ) h && h[l].run(); |
|
l = -1, b = j.length; |
|
} |
|
h = null, k = !1, clearTimeout(a); |
|
} |
|
} |
|
function f(a, b) { |
|
this.fun = a, this.array = b; |
|
} |
|
function g() {} |
|
var h, i = b.exports = {}, j = [], k = !1, l = -1; |
|
i.nextTick = function(a) { |
|
var b = new Array(arguments.length - 1); |
|
if (arguments.length > 1) for (var c = 1; c < arguments.length; c++) b[c - 1] = arguments[c]; |
|
j.push(new f(a, b)), 1 !== j.length || k || setTimeout(e, 0); |
|
}, f.prototype.run = function() { |
|
this.fun.apply(null, this.array); |
|
}, i.title = "browser", i.browser = !0, i.env = {}, i.argv = [], i.version = "", |
|
i.versions = {}, i.on = g, i.addListener = g, i.once = g, i.off = g, i.removeListener = g, |
|
i.removeAllListeners = g, i.emit = g, i.binding = function(a) { |
|
throw new Error("process.binding is not supported"); |
|
}, i.cwd = function() { |
|
return "/"; |
|
}, i.chdir = function(a) { |
|
throw new Error("process.chdir is not supported"); |
|
}, i.umask = function() { |
|
return 0; |
|
}; |
|
}, {} ], |
|
143: [ function(a, b, c) { |
|
b.exports = function(a) { |
|
return a && "object" == typeof a && "function" == typeof a.copy && "function" == typeof a.fill && "function" == typeof a.readUInt8; |
|
}; |
|
}, {} ], |
|
144: [ function(a, b, c) { |
|
(function(b, d) { |
|
function e(a, b) { |
|
var d = { |
|
seen: [], |
|
stylize: g |
|
}; |
|
return arguments.length >= 3 && (d.depth = arguments[2]), arguments.length >= 4 && (d.colors = arguments[3]), |
|
p(b) ? d.showHidden = b : b && c._extend(d, b), v(d.showHidden) && (d.showHidden = !1), |
|
v(d.depth) && (d.depth = 2), v(d.colors) && (d.colors = !1), v(d.customInspect) && (d.customInspect = !0), |
|
d.colors && (d.stylize = f), i(d, a, d.depth); |
|
} |
|
function f(a, b) { |
|
var c = e.styles[b]; |
|
return c ? "[" + e.colors[c][0] + "m" + a + "[" + e.colors[c][1] + "m" : a; |
|
} |
|
function g(a, b) { |
|
return a; |
|
} |
|
function h(a) { |
|
var b = {}; |
|
return a.forEach(function(a, c) { |
|
b[a] = !0; |
|
}), b; |
|
} |
|
function i(a, b, d) { |
|
if (a.customInspect && b && A(b.inspect) && b.inspect !== c.inspect && (!b.constructor || b.constructor.prototype !== b)) { |
|
var e = b.inspect(d, a); |
|
return t(e) || (e = i(a, e, d)), e; |
|
} |
|
var f = j(a, b); |
|
if (f) return f; |
|
var g = Object.keys(b), p = h(g); |
|
if (a.showHidden && (g = Object.getOwnPropertyNames(b)), z(b) && (g.indexOf("message") >= 0 || g.indexOf("description") >= 0)) return k(b); |
|
if (0 === g.length) { |
|
if (A(b)) { |
|
var q = b.name ? ": " + b.name : ""; |
|
return a.stylize("[Function" + q + "]", "special"); |
|
} |
|
if (w(b)) return a.stylize(RegExp.prototype.toString.call(b), "regexp"); |
|
if (y(b)) return a.stylize(Date.prototype.toString.call(b), "date"); |
|
if (z(b)) return k(b); |
|
} |
|
var r = "", s = !1, u = [ "{", "}" ]; |
|
if (o(b) && (s = !0, u = [ "[", "]" ]), A(b)) { |
|
var v = b.name ? ": " + b.name : ""; |
|
r = " [Function" + v + "]"; |
|
} |
|
if (w(b) && (r = " " + RegExp.prototype.toString.call(b)), y(b) && (r = " " + Date.prototype.toUTCString.call(b)), |
|
z(b) && (r = " " + k(b)), 0 === g.length && (!s || 0 == b.length)) return u[0] + r + u[1]; |
|
if (0 > d) return w(b) ? a.stylize(RegExp.prototype.toString.call(b), "regexp") : a.stylize("[Object]", "special"); |
|
a.seen.push(b); |
|
var x; |
|
return x = s ? l(a, b, d, p, g) : g.map(function(c) { |
|
return m(a, b, d, p, c, s); |
|
}), a.seen.pop(), n(x, r, u); |
|
} |
|
function j(a, b) { |
|
if (v(b)) return a.stylize("undefined", "undefined"); |
|
if (t(b)) { |
|
var c = "'" + JSON.stringify(b).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; |
|
return a.stylize(c, "string"); |
|
} |
|
return s(b) ? a.stylize("" + b, "number") : p(b) ? a.stylize("" + b, "boolean") : q(b) ? a.stylize("null", "null") : void 0; |
|
} |
|
function k(a) { |
|
return "[" + Error.prototype.toString.call(a) + "]"; |
|
} |
|
function l(a, b, c, d, e) { |
|
for (var f = [], g = 0, h = b.length; h > g; ++g) D(b, String(g)) ? f.push(m(a, b, c, d, String(g), !0)) : f.push(""); |
|
return e.forEach(function(e) { |
|
e.match(/^\d+$/) || f.push(m(a, b, c, d, e, !0)); |
|
}), f; |
|
} |
|
function m(a, b, c, d, e, f) { |
|
var g, h, j; |
|
if (j = Object.getOwnPropertyDescriptor(b, e) || { |
|
value: b[e] |
|
}, j.get ? h = j.set ? a.stylize("[Getter/Setter]", "special") : a.stylize("[Getter]", "special") : j.set && (h = a.stylize("[Setter]", "special")), |
|
D(d, e) || (g = "[" + e + "]"), h || (a.seen.indexOf(j.value) < 0 ? (h = q(c) ? i(a, j.value, null) : i(a, j.value, c - 1), |
|
h.indexOf("\n") > -1 && (h = f ? h.split("\n").map(function(a) { |
|
return " " + a; |
|
}).join("\n").substr(2) : "\n" + h.split("\n").map(function(a) { |
|
return " " + a; |
|
}).join("\n"))) : h = a.stylize("[Circular]", "special")), v(g)) { |
|
if (f && e.match(/^\d+$/)) return h; |
|
g = JSON.stringify("" + e), g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? (g = g.substr(1, g.length - 2), |
|
g = a.stylize(g, "name")) : (g = g.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"), |
|
g = a.stylize(g, "string")); |
|
} |
|
return g + ": " + h; |
|
} |
|
function n(a, b, c) { |
|
var d = 0, e = a.reduce(function(a, b) { |
|
return d++, b.indexOf("\n") >= 0 && d++, a + b.replace(/\u001b\[\d\d?m/g, "").length + 1; |
|
}, 0); |
|
return e > 60 ? c[0] + ("" === b ? "" : b + "\n ") + " " + a.join(",\n ") + " " + c[1] : c[0] + b + " " + a.join(", ") + " " + c[1]; |
|
} |
|
function o(a) { |
|
return Array.isArray(a); |
|
} |
|
function p(a) { |
|
return "boolean" == typeof a; |
|
} |
|
function q(a) { |
|
return null === a; |
|
} |
|
function r(a) { |
|
return null == a; |
|
} |
|
function s(a) { |
|
return "number" == typeof a; |
|
} |
|
function t(a) { |
|
return "string" == typeof a; |
|
} |
|
function u(a) { |
|
return "symbol" == typeof a; |
|
} |
|
function v(a) { |
|
return void 0 === a; |
|
} |
|
function w(a) { |
|
return x(a) && "[object RegExp]" === C(a); |
|
} |
|
function x(a) { |
|
return "object" == typeof a && null !== a; |
|
} |
|
function y(a) { |
|
return x(a) && "[object Date]" === C(a); |
|
} |
|
function z(a) { |
|
return x(a) && ("[object Error]" === C(a) || a instanceof Error); |
|
} |
|
function A(a) { |
|
return "function" == typeof a; |
|
} |
|
function B(a) { |
|
return null === a || "boolean" == typeof a || "number" == typeof a || "string" == typeof a || "symbol" == typeof a || "undefined" == typeof a; |
|
} |
|
function C(a) { |
|
return Object.prototype.toString.call(a); |
|
} |
|
function D(a, b) { |
|
return Object.prototype.hasOwnProperty.call(a, b); |
|
} |
|
var E = /%[sdj%]/g; |
|
c.format = function(a) { |
|
if (!t(a)) { |
|
for (var b = [], c = 0; c < arguments.length; c++) b.push(e(arguments[c])); |
|
return b.join(" "); |
|
} |
|
for (var c = 1, d = arguments, f = d.length, g = String(a).replace(E, function(a) { |
|
if ("%%" === a) return "%"; |
|
if (c >= f) return a; |
|
switch (a) { |
|
case "%s": |
|
return String(d[c++]); |
|
|
|
case "%d": |
|
return Number(d[c++]); |
|
|
|
case "%j": |
|
try { |
|
return JSON.stringify(d[c++]); |
|
} catch (b) { |
|
return "[Circular]"; |
|
} |
|
|
|
default: |
|
return a; |
|
} |
|
}), h = d[c]; f > c; h = d[++c]) g += q(h) || !x(h) ? " " + h : " " + e(h); |
|
return g; |
|
}, c.deprecate = function(a, e) { |
|
function f() { |
|
if (!g) { |
|
if (b.throwDeprecation) throw new Error(e); |
|
b.traceDeprecation, g = !0; |
|
} |
|
return a.apply(this, arguments); |
|
} |
|
if (v(d.process)) return function() { |
|
return c.deprecate(a, e).apply(this, arguments); |
|
}; |
|
if (b.noDeprecation === !0) return a; |
|
var g = !1; |
|
return f; |
|
}; |
|
var F, G = {}; |
|
c.debuglog = function(a) { |
|
if (v(F) && (F = b.env.NODE_DEBUG || ""), a = a.toUpperCase(), !G[a]) if (new RegExp("\\b" + a + "\\b", "i").test(F)) { |
|
b.pid; |
|
G[a] = function() { |
|
c.format.apply(c, arguments); |
|
}; |
|
} else G[a] = function() {}; |
|
return G[a]; |
|
}, c.inspect = e, e.colors = { |
|
bold: [ 1, 22 ], |
|
italic: [ 3, 23 ], |
|
underline: [ 4, 24 ], |
|
inverse: [ 7, 27 ], |
|
white: [ 37, 39 ], |
|
grey: [ 90, 39 ], |
|
black: [ 30, 39 ], |
|
blue: [ 34, 39 ], |
|
cyan: [ 36, 39 ], |
|
green: [ 32, 39 ], |
|
magenta: [ 35, 39 ], |
|
red: [ 31, 39 ], |
|
yellow: [ 33, 39 ] |
|
}, e.styles = { |
|
special: "cyan", |
|
number: "yellow", |
|
"boolean": "yellow", |
|
undefined: "grey", |
|
"null": "bold", |
|
string: "green", |
|
date: "magenta", |
|
regexp: "red" |
|
}, c.isArray = o, c.isBoolean = p, c.isNull = q, c.isNullOrUndefined = r, c.isNumber = s, |
|
c.isString = t, c.isSymbol = u, c.isUndefined = v, c.isRegExp = w, c.isObject = x, |
|
c.isDate = y, c.isError = z, c.isFunction = A, c.isPrimitive = B, c.isBuffer = a("./support/isBuffer"); |
|
c.log = function() {}, c.inherits = a("inherits"), c._extend = function(a, b) { |
|
if (!b || !x(b)) return a; |
|
for (var c = Object.keys(b), d = c.length; d--; ) a[c[d]] = b[c[d]]; |
|
return a; |
|
}; |
|
}).call(this, a("_process"), "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); |
|
}, { |
|
"./support/isBuffer": 143, |
|
_process: 142, |
|
inherits: 141 |
|
} ], |
|
145: [ function(a, b, c) { |
|
var d = []; |
|
self.onmessage = function(b) { |
|
if ("launch" == b.data.type) { |
|
switch (b.data.name) { |
|
case "main": |
|
a("../.engine/main.js"); |
|
break; |
|
|
|
case "runner": |
|
a("../.engine/runner.js"); |
|
break; |
|
|
|
case "processor": |
|
a("../.engine/processor.js"); |
|
break; |
|
|
|
case "runtime": |
|
a("../.engine/core/runtime.js"); |
|
} |
|
d.forEach(function(a) { |
|
self.onmessage(a); |
|
}); |
|
} else d.push(b); |
|
}; |
|
}, { |
|
"../.engine/core/runtime.js": 37, |
|
"../.engine/main.js": 59, |
|
"../.engine/processor.js": 62, |
|
"../.engine/runner.js": 139 |
|
} ] |
|
}, {}, [ 145 ]); |