@@ -9,9 +9,7 @@ | |||
}, | |||
"plugins": [ | |||
"flowtype", | |||
"prettier", | |||
"react" | |||
"prettier" | |||
], | |||
// Map from global var to bool specifying if it can be redefined | |||
@@ -133,7 +131,6 @@ | |||
"no-shadow": [2,{"builtinGlobals":true,"hoist":"all"}], | |||
"no-undef-init": 2, | |||
"no-undef": 1, | |||
"no-undefined": 1, | |||
"no-unused-vars": [1, {"args": "none"}], | |||
"no-use-before-define": 2, | |||
"no-mixed-requires": [2,false], | |||
@@ -170,27 +167,6 @@ | |||
"arrow-parens": [2,"as-needed"], | |||
"arrow-spacing": [2,{"before":true,"after":true}], | |||
"no-const-assign": 2, | |||
"no-var": 2, | |||
// React Plugin | |||
// The following rules are made available via `eslint-plugin-react`. | |||
"react/display-name": 0, | |||
"react/jsx-boolean-value": 0, | |||
"react/jsx-no-comment-textnodes": 1, | |||
"react/jsx-no-duplicate-props": 2, | |||
"react/jsx-no-undef": 1, | |||
"react/jsx-sort-props": 0, | |||
"react/jsx-uses-react": 1, | |||
"react/jsx-uses-vars": 1, | |||
"react/no-did-mount-set-state": 1, | |||
"react/no-did-update-set-state": 1, | |||
"react/no-multi-comp": 0, | |||
"react/no-string-refs": 1, | |||
"react/no-unknown-property": 0, | |||
"react/prop-types": 0, | |||
"react/react-in-jsx-scope": 1, | |||
"react/self-closing-comp": 1, | |||
"react/wrap-multilines": 0 | |||
"no-var": 2 | |||
} | |||
} |
@@ -0,0 +1,166 @@ | |||
{ | |||
"root": true, | |||
"parser": "babel-eslint", | |||
"env": { | |||
"es6": true, | |||
"node": true | |||
}, | |||
"plugins": [ | |||
"prettier" | |||
], | |||
// Map from global var to bool specifying if it can be redefined | |||
"globals": { | |||
"__DEV__": true, | |||
"__dirname": false, | |||
"__fbBatchedBridgeConfig": false, | |||
"alert": false, | |||
"cancelAnimationFrame": false, | |||
"cancelIdleCallback": false, | |||
"clearImmediate": true, | |||
"clearInterval": false, | |||
"clearTimeout": false, | |||
"console": false, | |||
"document": false, | |||
"escape": false, | |||
"Event": false, | |||
"EventTarget": false, | |||
"exports": false, | |||
"fetch": false, | |||
"FormData": false, | |||
"global": false, | |||
"jest": false, | |||
"Map": true, | |||
"module": false, | |||
"navigator": false, | |||
"process": false, | |||
"Promise": true, | |||
"requestAnimationFrame": true, | |||
"requestIdleCallback": true, | |||
"require": false, | |||
"Set": true, | |||
"setImmediate": true, | |||
"setInterval": false, | |||
"setTimeout": false, | |||
"window": false, | |||
"XMLHttpRequest": false, | |||
"pit": false, | |||
"$": false, | |||
"define": false | |||
}, | |||
"rules": { | |||
"comma-dangle": [2,"never"], | |||
"no-cond-assign": [2,"always"], | |||
"no-console": 1, | |||
"no-constant-condition": 2, | |||
"no-control-regex": 2, | |||
"no-debugger": 1, | |||
"no-dupe-args": 2, | |||
"no-dupe-keys": 2, | |||
"no-duplicate-case": 2, | |||
"no-empty-character-class": 2, | |||
"no-empty": [2, { "allowEmptyCatch": true }], | |||
"no-ex-assign": 2, | |||
"no-extra-semi": 2, | |||
"no-func-assign": 2, | |||
"no-inner-declarations": [2,"functions"], | |||
"no-invalid-regexp": 2, | |||
"no-irregular-whitespace": 2, | |||
"no-negated-in-lhs": 2, | |||
"no-obj-calls": 2, | |||
"no-regex-spaces": 2, | |||
"no-sparse-arrays": 2, | |||
"no-unreachable": 1, | |||
"use-isnan": 2, | |||
"valid-typeof": 2, | |||
"block-scoped-var": 2, | |||
"curly": [2,"multi-or-nest"], | |||
"dot-notation": 2, | |||
"dot-location": [2,"property"], | |||
"eqeqeq": [2,"always", {"null": "ignore"}], | |||
"no-alert": 2, | |||
"no-caller": 2, | |||
"no-else-return": 2, | |||
"no-eq-null": 1, | |||
"no-eval": 2, | |||
"no-extend-native": 1, | |||
"no-fallthrough": 2, | |||
"no-floating-decimal": 2, | |||
"no-implied-eval": 2, | |||
"no-iterator": 2, | |||
"no-labels": 2, | |||
"no-lone-blocks": 2, | |||
"no-multi-spaces": 2, | |||
"no-native-reassign": 2, | |||
"no-new-func": 2, | |||
"no-new-wrappers": 2, | |||
"no-new": 2, | |||
"no-octal-escape": 2, | |||
"no-octal": 2, | |||
"no-process-env": 1, | |||
"no-proto": 2, | |||
"no-redeclare": 2, | |||
"no-return-assign": [2,"always"], | |||
"no-script-url": 2, | |||
"no-self-compare": 2, | |||
"no-sequences": 2, | |||
"no-throw-literal": 2, | |||
"no-unused-expressions": 2, | |||
"no-useless-call": 2, | |||
"no-void": 2, | |||
"no-with": 2, | |||
"wrap-iife": [2,"inside"], | |||
"yoda": [2,"never",{}], | |||
"strict": [2,"global"], | |||
"no-catch-shadow": 2, | |||
"no-delete-var": 2, | |||
"no-label-var": 2, | |||
"no-shadow-restricted-names": 2, | |||
"no-shadow": [2,{"builtinGlobals":true,"hoist":"all"}], | |||
"no-undef-init": 2, | |||
"no-undef": 1, | |||
"no-undefined": 1, | |||
"no-unused-vars": [1, {"args": "none"}], | |||
"no-use-before-define": 2, | |||
"no-mixed-requires": [2,false], | |||
"no-new-require": 2, | |||
"no-path-concat": 2, | |||
"brace-style": [2,"1tbs",{}], | |||
"camelcase": [1,{"properties":"never"}], | |||
"comma-spacing": [2,{"after":true}], | |||
"comma-style": 2, | |||
"eol-last": 2, | |||
"func-style": [1,"expression"], | |||
"indent": [2, "tab"], | |||
"key-spacing": [2,{"afterColon":true}], | |||
"new-parens": 2, | |||
"no-inline-comments": 2, | |||
"no-lonely-if": 2, | |||
"no-mixed-spaces-and-tabs": 2, | |||
"no-multiple-empty-lines": [2,{"max":1}], | |||
"no-nested-ternary": 1, | |||
"no-new-object": 2, | |||
"no-spaced-func": 2, | |||
"no-underscore-dangle": 1, | |||
"no-unneeded-ternary": 2, | |||
"object-curly-spacing": [2,"always",{"arraysInObjects":true,"objectsInObjects":true}], | |||
"padded-blocks": [2,"never"], | |||
"quote-props": [2,"as-needed"], | |||
"quotes": [2,"single","avoid-escape"], | |||
"semi-spacing": [2,{"after":true}], | |||
"semi": [2,"always"], | |||
"space-before-blocks": [2,"always"], | |||
"space-before-function-paren": [2,"always"], | |||
"space-infix-ops": 2, | |||
"keyword-spacing": [2,{"before":true,"after":true}], | |||
"arrow-parens": [2,"as-needed"], | |||
"arrow-spacing": [2,{"before":true,"after":true}], | |||
"no-const-assign": 2, | |||
"no-var": 2 | |||
} | |||
} |
@@ -54,9 +54,9 @@ define([ | |||
else { | |||
this.frameDelayCd = this.frameDelay; | |||
this.frame++; | |||
if (this.frame == this.frames) { | |||
if (this.frame === this.frames) { | |||
this.loopCounter++; | |||
if (this.loopCounter == this.loop) { | |||
if (this.loopCounter === this.loop) { | |||
this.destroyed = true; | |||
return; | |||
} | |||
@@ -59,9 +59,9 @@ define([ | |||
else { | |||
this.frameDelayCd = this.frameDelay; | |||
this.frame++; | |||
if (this.frame == this.frames) { | |||
if (this.frame === this.frames) { | |||
this.loopCounter++; | |||
if (this.loopCounter == this.loop) { | |||
if (this.loopCounter === this.loop) { | |||
if (this.destroyObject) | |||
this.obj.destroyed = true; | |||
else { | |||
@@ -23,7 +23,7 @@ define([ | |||
init: function (blueprint) { | |||
//Only allow one bumper at a time | |||
if (this.obj.components.filter(function (c) { | |||
c.type == this.type; | |||
c.type === this.type; | |||
}) > 1) | |||
return true; | |||
}, | |||
@@ -44,10 +44,10 @@ define([ | |||
this.updateCd = this.updateCdMax; | |||
this.durationCounter++; | |||
if (this.durationCounter == this.duration) { | |||
if (this.durationCounter === this.duration) { | |||
this.durationCounter = 0; | |||
this.direction *= -1; | |||
if ((this.direction == 1) && (!this.infinite)) | |||
if ((this.direction === 1) && (!this.infinite)) | |||
this.destroyed = true; | |||
else | |||
this.obj.dirty = true; | |||
@@ -24,7 +24,7 @@ define([ | |||
if (this.cd > 0) | |||
this.cd--; | |||
else if (this.cd == 0) { | |||
else if (this.cd === 0) { | |||
renderer.destroyObject({ | |||
sprite: chatSprite | |||
}); | |||
@@ -45,7 +45,7 @@ define([ | |||
} | |||
let color = this.color; | |||
if (msg[0] == '*') | |||
if (msg[0] === '*') | |||
color = 0xffeb38; | |||
let yOffset = (msg.split('\r\n').length - 1); | |||
@@ -33,13 +33,13 @@ define([ | |||
ownerId: null, | |||
init: function (blueprint) { | |||
if (this.ownerId != -1) { | |||
if (this.ownerId !== -1) { | |||
if (!window.player) { | |||
this.hideSprite(); | |||
return; | |||
} | |||
if (this.ownerId != window.player.serverId) { | |||
if (this.ownerId !== window.player.serverId) { | |||
this.hideSprite(); | |||
return; | |||
} | |||
@@ -46,7 +46,7 @@ define(components, function () { | |||
return { | |||
getTemplate: function (type) { | |||
if (type == 'lightpatch') | |||
if (type === 'lightpatch') | |||
type = 'lightPatch'; | |||
return templates[type]; | |||
@@ -33,7 +33,7 @@ define([ | |||
this.effects = this.effects | |||
.filter(function (e) { | |||
return (auras[e] != null); | |||
return (auras[e] !== null); | |||
}, this) | |||
.map(function (e) { | |||
return { | |||
@@ -54,7 +54,7 @@ define([ | |||
if (blueprint.addEffects) { | |||
blueprint.addEffects = blueprint.addEffects | |||
.filter(function (e) { | |||
return (auras[e] != null); | |||
return (auras[e] !== null); | |||
}) | |||
.map(function (e) { | |||
return { | |||
@@ -76,7 +76,7 @@ define([ | |||
if (blueprint.removeEffects) { | |||
blueprint.removeEffects.forEach(function (r) { | |||
let effect = this.effects.find(function (e) { | |||
return (e.name == r); | |||
return (e.name === r); | |||
}); | |||
if (!effect) | |||
@@ -88,7 +88,7 @@ define([ | |||
}); | |||
this.effects.spliceFirstWhere(function (e) { | |||
return (e.name == r); | |||
return (e.name === r); | |||
}); | |||
}, this); | |||
} | |||
@@ -18,7 +18,7 @@ define([ | |||
blueprint.updateList.forEach(function (q) { | |||
events.emit('onObtainEvent', q); | |||
this.list.spliceWhere(function (l) { | |||
return (l.id == q.id); | |||
return (l.id === q.id); | |||
}); | |||
this.list.push(q); | |||
}, this); | |||
@@ -28,7 +28,7 @@ define([ | |||
blueprint.removeList.forEach(function (q) { | |||
events.emit('onRemoveEvent', q.id); | |||
this.list.spliceWhere(function (l) { | |||
return (l.id == q.id); | |||
return (l.id === q.id); | |||
}); | |||
}, this); | |||
} | |||
@@ -17,7 +17,7 @@ define([ | |||
}, | |||
extend: function (msg) { | |||
if ((msg.width) && (msg.progress != 100)) { | |||
if ((msg.width) && (msg.progress !== 100)) { | |||
if (this.effect) | |||
this.effect.destroyed = true; | |||
@@ -46,7 +46,7 @@ define([ | |||
lineShrink: true | |||
}); | |||
} else { | |||
if ((msg.progress == 100) && (this.effect)) { | |||
if ((msg.progress === 100) && (this.effect)) { | |||
this.effect.destroyed = true; | |||
this.effect = null; | |||
} | |||
@@ -63,7 +63,7 @@ define([ | |||
}, | |||
onKeyDown: function (key) { | |||
if (key != 'g') | |||
if (key !== 'g') | |||
return; | |||
client.request({ | |||
@@ -26,17 +26,17 @@ define([ | |||
for (let i = 0; i < nLen; i++) { | |||
let nItem = newItems[i]; | |||
var nId = nItem.id; | |||
let nId = nItem.id; | |||
let findItem = items.find(function (item) { | |||
return (item.id == nId); | |||
return (item.id === nId); | |||
}); | |||
if (findItem) { | |||
if (!rerender) { | |||
rerender = ( | |||
(findItem.pos != nItem.pos) || | |||
(findItem.eq != nItem.eq) || | |||
(findItem.quantity != nItem.quantity) | |||
(findItem.pos !== nItem.pos) || | |||
(findItem.eq !== nItem.eq) || | |||
(findItem.quantity !== nItem.quantity) | |||
); | |||
} | |||
@@ -81,7 +81,7 @@ define([ | |||
}, | |||
canEquipItem: function (item) { | |||
return (this.equipItemErrors(item).length == 0); | |||
return (this.equipItemErrors(item).length === 0); | |||
} | |||
}; | |||
}); |
@@ -24,8 +24,8 @@ define([ | |||
let y = obj.y; | |||
let maxDistance = Math.sqrt(Math.pow(obj.width / 2, 2) + Math.pow(obj.height / 2, 2)); | |||
for (var i = 0; i < obj.width; i++) { | |||
for (var j = 0; j < obj.height; j++) { | |||
for (let i = 0; i < obj.width; i++) { | |||
for (let j = 0; j < obj.height; j++) { | |||
let distance = maxDistance - Math.sqrt(Math.pow((obj.width / 2) - i, 2) + Math.pow((obj.width / 2) - i, 2)); | |||
let alpha = distance / maxDistance; | |||
@@ -47,7 +47,7 @@ define([ | |||
} | |||
let rCount = ((obj.width * obj.height) / 10) + ~~(Math.random() + 2); | |||
for (var i = 0; i < rCount; i++) { | |||
for (let i = 0; i < rCount; i++) { | |||
let nx = x + 3 + ~~(Math.random() * (obj.width - 1)); | |||
let ny = y - 4 + ~~(Math.random() * (obj.height)); | |||
let w = 1 + ~~(Math.random() * 2); | |||
@@ -59,7 +59,7 @@ define([ | |||
}); | |||
this.rays.push(rContainer); | |||
for (var j = 0; j < h; j++) { | |||
for (let j = 0; j < h; j++) { | |||
let ray = renderer.buildObject({ | |||
x: nx, | |||
y: ny, | |||
@@ -59,7 +59,7 @@ define([ | |||
if (!this.shrinking) { | |||
this.ttl--; | |||
if (this.ttl == 0) { | |||
if (this.ttl === 0) { | |||
this.destroyed = true; | |||
return; | |||
} | |||
@@ -85,7 +85,7 @@ define([ | |||
); | |||
if (changeTo) { | |||
var linePercentage = this.linePercentage; | |||
let linePercentage = this.linePercentage; | |||
if (this.shrinking) | |||
linePercentage /= 1.5; | |||
else { | |||
@@ -64,13 +64,13 @@ define([ | |||
}, | |||
showPath: function (e) { | |||
if ((e.button != null) && (e.button != 0)) | |||
if ((e.button !== null) && (e.button !== 0)) | |||
return; | |||
let tileX = ~~(e.x / scale); | |||
let tileY = ~~(e.y / scale); | |||
if ((tileX == this.hoverTile.x) && (tileY == this.hoverTile.y)) | |||
if ((tileX === this.hoverTile.x) && (tileY === this.hoverTile.y)) | |||
return; | |||
events.emit('onChangeHoverTile', tileX, tileY); | |||
@@ -84,7 +84,7 @@ define([ | |||
queuePath: function (e) { | |||
this.mouseDown = false; | |||
if ((this.path.length == 0) || (e.down)) | |||
if ((this.path.length === 0) || (e.down)) | |||
return; | |||
client.request({ | |||
@@ -21,7 +21,7 @@ define([ | |||
}, | |||
update: function () { | |||
if (this.ttl != null) { | |||
if (this.ttl !== null) { | |||
this.ttl--; | |||
if (this.ttl <= 0) { | |||
if (this.destroyObject) | |||
@@ -28,7 +28,7 @@ define([ | |||
if (blueprint.untickNodes) { | |||
blueprint.untickNodes.forEach(function (n) { | |||
this.selected.spliceWhere(function (s) { | |||
return (s == n); | |||
return (s === n); | |||
}); | |||
}, this); | |||
@@ -38,7 +38,7 @@ define([ | |||
if (rerender) | |||
events.emit('onGetPassives', this.selected); | |||
if (blueprint.points != null) { | |||
if (blueprint.points !== null) { | |||
this.points = blueprint.points; | |||
events.emit('onGetPassivePoints', this.points); | |||
} | |||
@@ -77,12 +77,12 @@ define([ | |||
let x = this.obj.x; | |||
let y = this.obj.y; | |||
if (this.path.length == 0) { | |||
if (this.path.length === 0) { | |||
this.pathPos.x = round(x); | |||
this.pathPos.y = round(y); | |||
} | |||
if ((x == this.lastX) && (y == this.lastY)) | |||
if ((x === this.lastX) && (y === this.lastY)) | |||
return; | |||
this.lastX = x; | |||
@@ -91,7 +91,7 @@ define([ | |||
for (let i = 0; i < this.path.length; i++) { | |||
let p = this.path[i]; | |||
if ((p.x == x) && (p.y == y)) { | |||
if ((p.x === x) && (p.y === y)) { | |||
for (let j = 0; j <= i; j++) { | |||
renderer.destroyObject({ | |||
layerName: 'effects', | |||
@@ -33,7 +33,7 @@ define([ | |||
let obj = this.obj; | |||
let oldPos = this.oldPos; | |||
if ((oldPos.x == obj.x) && (oldPos.y == obj.y)) | |||
if ((oldPos.x === obj.x) && (oldPos.y === obj.y)) | |||
return; | |||
let dx = obj.x - oldPos.x; | |||
@@ -43,9 +43,9 @@ define([ | |||
if ((dx > 5) || (dy > 5)) | |||
instant = true; | |||
if (dx != 0) | |||
if (dx !== 0) | |||
dx = dx / Math.abs(dx); | |||
if (dy != 0) | |||
if (dy !== 0) | |||
dy = dy / Math.abs(dy); | |||
this.oldPos.x = this.obj.x; | |||
@@ -18,7 +18,7 @@ define([ | |||
blueprint.updateQuests.forEach(function (q) { | |||
events.emit('onUpdateQuest', q); | |||
let index = this.quests.firstIndex(function (qq) { | |||
return (qq.id == q.id); | |||
return (qq.id === q.id); | |||
}); | |||
this.quests.splice(index, 1, q); | |||
}, this); | |||
@@ -27,7 +27,7 @@ define([ | |||
blueprint.completeQuests.forEach(function (q) { | |||
events.emit('onCompleteQuest', q); | |||
this.quests.spliceWhere(function (qq) { | |||
return (qq.id == q); | |||
return (qq.id === q); | |||
}); | |||
}, this); | |||
} | |||
@@ -16,7 +16,7 @@ define([ | |||
extend: function (blueprint) { | |||
if (blueprint.modifyRep) { | |||
blueprint.modifyRep.forEach(function (m) { | |||
let exists = this.list.find(l => (l.id == m.id)); | |||
let exists = this.list.find(l => (l.id === m.id)); | |||
if (!exists) | |||
this.list.push(m); | |||
else { | |||
@@ -34,7 +34,7 @@ define([ | |||
let w = this.obj.width || 1; | |||
let h = this.obj.height || 1; | |||
let isFish = (this.nodeType == 'fish'); | |||
let isFish = (this.nodeType === 'fish'); | |||
for (let i = x; i < x + w; i++) { | |||
for (let j = y; j < y + h; j++) { | |||
@@ -16,7 +16,7 @@ define([ | |||
onKeyUp: function (key) { | |||
this.actions.forEach(function (a) { | |||
if (a.key != key) | |||
if (a.key !== key) | |||
return; | |||
client.request({ | |||
@@ -31,7 +31,7 @@ define([ | |||
if (blueprint.addActions) { | |||
blueprint.addActions.forEach(function (a) { | |||
let exists = this.actions.some(function (ta) { | |||
return ((ta.targetId == a.targetId) && (ta.cpn == a.cpn) && (ta.method == a.method)); | |||
return ((ta.targetId === a.targetId) && (ta.cpn === a.cpn) && (ta.method === a.method)); | |||
}); | |||
if (exists) | |||
return; | |||
@@ -45,7 +45,7 @@ define([ | |||
if (blueprint.removeActions) { | |||
blueprint.removeActions.forEach(function (a) { | |||
this.actions.spliceWhere(function (ta) { | |||
return ((ta.targetId == a.targetId) && (ta.cpn == a.cpn) && (ta.method == a.method)); | |||
return ((ta.targetId === a.targetId) && (ta.cpn === a.cpn) && (ta.method === a.method)); | |||
}); | |||
}, this); | |||
@@ -63,7 +63,7 @@ define([ | |||
if (blueprint.removeSpells) { | |||
blueprint.removeSpells.forEach(function (spellId) { | |||
this.spells.spliceWhere(function (s) { | |||
return (s.id == spellId); | |||
return (s.id === spellId); | |||
}); | |||
}, this); | |||
@@ -73,7 +73,7 @@ define([ | |||
if (blueprint.getSpells) { | |||
blueprint.getSpells.forEach(function (s) { | |||
let existIndex = this.spells.firstIndex(function (spell) { | |||
return (spell.id == s.id); | |||
return (spell.id === s.id); | |||
}); | |||
if (existIndex > -1) { | |||
@@ -93,10 +93,10 @@ define([ | |||
}, | |||
getSpell: function (number) { | |||
let spellNumber = (number == ' ') ? 0 : number; | |||
let spellNumber = (number === ' ') ? 0 : number; | |||
let spell = this.spells.find(function (s) { | |||
return (s.id == spellNumber); | |||
return (s.id === spellNumber); | |||
}); | |||
if (!spell) | |||
return null; | |||
@@ -160,18 +160,18 @@ define([ | |||
}, | |||
onKeyDown: function (key) { | |||
if (key == 'b') { | |||
if (key === 'b') { | |||
this.build(); | |||
return; | |||
} else if (key == 'n') { | |||
} else if (key === 'n') { | |||
this.build(true); | |||
return; | |||
} | |||
if (key == 'shift') { | |||
if (key === 'shift') { | |||
this.shiftDown = true; | |||
return; | |||
} else if (key == 'tab') { | |||
} else if (key === 'tab') { | |||
this.tabTarget(); | |||
return; | |||
} | |||
@@ -199,7 +199,7 @@ define([ | |||
if (this.shiftDown) | |||
this.target = oldTarget; | |||
if ((target == this.obj) && (spell.noTargetSelf)) | |||
if ((target === this.obj) && (spell.noTargetSelf)) | |||
return; | |||
client.request({ | |||
@@ -217,7 +217,7 @@ define([ | |||
}, | |||
onKeyUp: function (key) { | |||
if (key == 'shift') { | |||
if (key === 'shift') { | |||
this.shiftDown = false; | |||
return; | |||
} | |||
@@ -243,7 +243,7 @@ define([ | |||
else { | |||
this.reticleCd = this.reticleCdMax; | |||
this.reticleState++; | |||
if (this.reticleState == 4) | |||
if (this.reticleState === 4) | |||
this.reticleState = 0; | |||
} | |||
@@ -275,7 +275,7 @@ define([ | |||
else { | |||
this.reticleCd = this.reticleCdMax; | |||
this.reticleState++; | |||
if (this.reticleState == 4) | |||
if (this.reticleState === 4) | |||
this.reticleState = 0; | |||
} | |||
@@ -15,7 +15,7 @@ define([ | |||
}, | |||
extend: function (blueprint) { | |||
if (blueprint.active != null) | |||
if (blueprint.active !== null) | |||
this.active = blueprint.active; | |||
if (blueprint.getItems) { | |||
@@ -25,10 +25,10 @@ define([ | |||
for (let i = 0; i < nLen; i++) { | |||
let nItem = newItems[i]; | |||
var nId = nItem.id; | |||
let nId = nItem.id; | |||
let findItem = items.find(function (item) { | |||
return (item.id == nId); | |||
return (item.id === nId); | |||
}); | |||
if (findItem) { | |||
$.extend(true, findItem, nItem); | |||
@@ -20,7 +20,7 @@ define([ | |||
events.emit('onGetStats', this.values); | |||
let serverId = this.obj.serverId; | |||
if (serverId != null) | |||
if (serverId !== null) | |||
events.emit('onGetPartyStats', serverId, this.values); | |||
let obj = this.obj; | |||
@@ -95,7 +95,7 @@ define([ | |||
events.emit('onGetStats', this.values); | |||
let serverId = this.obj.serverId; | |||
if (serverId != null) | |||
if (serverId !== null) | |||
events.emit('onGetPartyStats', serverId, this.values); | |||
this.updateHpSprite(); | |||
@@ -78,12 +78,12 @@ define([ | |||
isKeyDown: function (key, noConsume) { | |||
let down = this.keys[key]; | |||
if (down != null) { | |||
if (down !== null) { | |||
if (noConsume) | |||
return true; | |||
this.keys[key] = 2; | |||
return (down == 1); | |||
return (down === 1); | |||
} return false; | |||
}, | |||
getAxis: function (name) { | |||
@@ -93,14 +93,14 @@ define([ | |||
let result = 0; | |||
for (var i = 0; i < axis.negative.length; i++) { | |||
for (let i = 0; i < axis.negative.length; i++) { | |||
if (this.keys[axis.negative[i]]) { | |||
result--; | |||
break; | |||
} | |||
} | |||
for (var i = 0; i < axis.positive.length; i++) { | |||
for (let i = 0; i < axis.positive.length; i++) { | |||
if (this.keys[axis.positive[i]]) { | |||
result++; | |||
break; | |||
@@ -116,30 +116,30 @@ define([ | |||
if (!this.enabled) | |||
return; | |||
if (e.target != document.body) | |||
if (e.target !== document.body) | |||
return true; | |||
if ((e.keyCode == 9) || (e.keyCode == 8) || (e.keyCode == 122)) | |||
if ((e.keyCode === 9) || (e.keyCode === 8) || (e.keyCode === 122)) | |||
e.preventDefault(); | |||
let key = this.getMapping(e.which); | |||
if (this.keys[key] != null) | |||
if (this.keys[key] !== null) | |||
this.keys[key] = 2; | |||
else { | |||
this.keys[key] = 1; | |||
events.emit('onKeyDown', key); | |||
} | |||
if (key == 'backspace') | |||
if (key === 'backspace') | |||
return false; | |||
else if (e.key == 'F11') | |||
else if (e.key === 'F11') | |||
events.emit('onToggleFullscreen'); | |||
}, | |||
keyUp: function (e) { | |||
if (!this.enabled) | |||
return; | |||
if (e.target != document.body) | |||
if (e.target !== document.body) | |||
return; | |||
let key = this.getMapping(e.which); | |||
@@ -6,7 +6,7 @@ Array.prototype.firstIndex = function (callback, thisArg) { | |||
let k = 0; | |||
while (k < len) { | |||
var kValue; | |||
let kValue; | |||
if (k in O) { | |||
kValue = O[k]; | |||
@@ -28,7 +28,7 @@ Array.prototype.spliceWhere = function (callback, thisArg) { | |||
let k = 0; | |||
while (k < len) { | |||
var kValue; | |||
let kValue; | |||
if (k in O) { | |||
kValue = O[k]; | |||
@@ -50,7 +50,7 @@ Array.prototype.spliceFirstWhere = function (callback, thisArg) { | |||
let k = 0; | |||
while (k < len) { | |||
var kValue; | |||
let kValue; | |||
if (k in O) { | |||
kValue = O[k]; | |||
@@ -81,7 +81,7 @@ window._ = { | |||
for (let i = 0; i < w; i++) { | |||
let inner = []; | |||
for (let j = 0; j < h; j++) { | |||
if (def == 'array') | |||
if (def === 'array') | |||
inner.push([]); | |||
else | |||
inner.push(def); | |||
@@ -32,7 +32,7 @@ | |||
}); | |||
} | |||
var astar = { | |||
let astar = { | |||
/** | |||
* Perform an A* Search on a graph given a start and end node. | |||
* @param {Graph} graph | |||
@@ -76,7 +76,7 @@ | |||
if (!onWall) { | |||
if (distance) { | |||
if (currentNode.h == distance) | |||
if (currentNode.h === distance) | |||
return pathTo(currentNode); | |||
} else { | |||
// End case -- result has been found, return the traced path. | |||
@@ -280,7 +280,7 @@ | |||
GridNode.prototype.getCost = function (fromNeighbor) { | |||
// Take diagonal weight into consideration. | |||
if (fromNeighbor && fromNeighbor.x != this.x && fromNeighbor.y != this.y) | |||
if (fromNeighbor && fromNeighbor.x !== this.x && fromNeighbor.y !== this.y) | |||
return this.weight * 1.41421; | |||
return this.weight; | |||
@@ -371,7 +371,7 @@ | |||
let child1N = child2N - 1; | |||
// This is used to store the new position of the element, if any. | |||
let swap = null; | |||
var child1Score; | |||
let child1Score; | |||
// If the first child exists (is inside the array)... | |||
if (child1N < length) { | |||
// Look it up and compute its score. | |||
@@ -88,7 +88,7 @@ define([ | |||
for (let i = 0; i < cLen; i++) { | |||
let c = cell[i]; | |||
if (c.id != oId) { | |||
if (c.id !== oId) { | |||
//If we have toX and toY, check if the target cell doesn't contain the same obj (like a notice area) | |||
if ((c.width) && (toX)) { | |||
if ((toX < c.x) || (toY < c.y) || (toX >= c.x + c.width) || (toY >= c.y + c.height)) { | |||
@@ -206,7 +206,7 @@ define([ | |||
continue; | |||
let cell = row[j]; | |||
if (cell.length == 0) { | |||
if (cell.length === 0) { | |||
return { | |||
x: i, | |||
y: j | |||
@@ -262,13 +262,13 @@ define([ | |||
let node = this.graph.grid[x][y]; | |||
return ((!node) || (node.weight == 0)); | |||
return ((!node) || (node.weight === 0)); | |||
}, | |||
isCellOpen: function (x, y) { | |||
if ((x < 0) || (y < 0) || (x >= this.width) | (y >= this.height)) | |||
return true; | |||
return (this.cells[x][y].length == 0); | |||
return (this.cells[x][y].length === 0); | |||
}, | |||
hasLos: function (fromX, fromY, toX, toY) { | |||
if ((fromX < 0) || (fromY < 0) || (fromX >= this.width) | (fromY >= this.height) || (toX < 0) || (toY < 0) || (toX >= this.width) | (toY >= this.height)) | |||
@@ -304,7 +304,7 @@ define([ | |||
if (!graphGrid[x][y]) | |||
return false; | |||
else if ((x == toX) && (y == toY)) | |||
else if ((x === toX) && (y === toY)) | |||
return true; | |||
} | |||
@@ -331,7 +331,7 @@ define([ | |||
let x2 = toX + c; | |||
let y2 = toY + c; | |||
var lowX, lowY, highX, highY, incX, incY; | |||
let lowX, lowY, highX, highY, incX, incY; | |||
if (reverseX) { | |||
incX = -1; | |||
@@ -353,7 +353,7 @@ define([ | |||
highY = y2 + 1; | |||
} | |||
for (let i = lowX; i != highX; i += incX) { | |||
for (let i = lowX; i !== highX; i += incX) { | |||
if ((i < 0) || (i >= width)) | |||
continue; | |||
@@ -364,14 +364,14 @@ define([ | |||
if (!t) | |||
t = tried[i] = {}; | |||
for (let j = lowY; j != highY; j += incY) { | |||
for (let j = lowY; j !== highY; j += incY) { | |||
if (t[j]) | |||
continue; | |||
t[j] = 1; | |||
if ( | |||
((i == toX) && (j == toY)) || | |||
((i === toX) && (j === toY)) || | |||
((j < 0) || (j >= height)) || | |||
(row[j]) | |||
) | |||
@@ -383,7 +383,7 @@ define([ | |||
for (let k = 0; k < cLen; k++) { | |||
let aggro = cell[k].aggro; | |||
if (aggro) { | |||
blocking = aggro.list.some(a => a.obj == target); | |||
blocking = aggro.list.some(a => a.obj === target); | |||
if (blocking) | |||
break; | |||
} | |||
@@ -409,14 +409,14 @@ define([ | |||
let cell = this.cells[x][y]; | |||
let cLen = cell.length; | |||
if (cLen == 1) | |||
if (cLen === 1) | |||
return false; | |||
let found = false; | |||
for (let i = 0; i < cLen; i++) { | |||
let c = cell[i]; | |||
if (c.aggro) { | |||
if ((!found) && (c == obj)) | |||
if ((!found) && (c === obj)) | |||
found = true; | |||
else | |||
return true; | |||
@@ -51,7 +51,7 @@ define([ | |||
return; | |||
this.components.spliceWhere(function (c) { | |||
return (c == cpn); | |||
return (c === cpn); | |||
}); | |||
delete this[type]; | |||
@@ -99,7 +99,7 @@ define([ | |||
this.sprite.y -= (scale * 2); | |||
} | |||
if (oldY != this.sprite.y) | |||
if (oldY !== this.sprite.y) | |||
renderer.reorder(); | |||
this.sprite.scale.x = (this.flipX ? -scaleMult : scaleMult); | |||
@@ -110,7 +110,7 @@ define([ | |||
return; | |||
let yAdd = scale; | |||
if (i == 1) { | |||
if (i === 1) { | |||
yAdd *= -0.8; | |||
yAdd -= (this.chatter.msg.split('\r\n').length - 1) * scale * 0.8; | |||
} | |||
@@ -150,7 +150,7 @@ define([ | |||
if (this.pather) | |||
this.pather.onDeath(); | |||
for (var e in this.eventCallbacks) { | |||
for (let e in this.eventCallbacks) { | |||
this.eventCallbacks[e].forEach(function (c) { | |||
events.off(e, c); | |||
}, this); | |||
@@ -25,7 +25,7 @@ define([ | |||
//Get saved value for showNames, or use the value set above | |||
let showNames = window.localStorage.getItem('iwd_opt_shownames'); | |||
this.showNames = showNames ? (showNames == 'true') : this.showNames; | |||
this.showNames = showNames ? (showNames === 'true') : this.showNames; | |||
}, | |||
getLocation: function (x, y) { | |||
@@ -57,7 +57,7 @@ define([ | |||
let oLen = objects.length; | |||
let list = objects.filter(function (o) { | |||
if ((!o.stats) || (o.nonSelectable) || (o == window.player)) | |||
if ((!o.stats) || (o.nonSelectable) || (o === window.player)) | |||
return false; | |||
let dx = Math.abs(o.x - x); | |||
@@ -68,7 +68,7 @@ define([ | |||
} | |||
}); | |||
if (list.length == 0) | |||
if (list.length === 0) | |||
return null; | |||
list.sort(function (a, b) { | |||
@@ -78,13 +78,13 @@ define([ | |||
return (aDistance - bDistance); | |||
}); | |||
list = list.filter(o => ((o.aggro) && (o.aggro.faction != window.player.aggro.faction))); | |||
list = list.filter(o => ((o.aggro) && (o.aggro.faction !== window.player.aggro.faction))); | |||
if (!fromMob) | |||
return list[0]; | |||
let fromIndex = list.firstIndex(function (l) { | |||
return (l.id == fromMob.id); | |||
return (l.id === fromMob.id); | |||
}); | |||
if (reverse) | |||
@@ -101,9 +101,9 @@ define([ | |||
for (let i = 0; i < oLen; i++) { | |||
let o = objects[i]; | |||
if (oldZone == null) | |||
if (oldZone === null) | |||
o.destroy(); | |||
else if ((o.zoneId == oldZone) && (o.player == null)) | |||
else if ((o.zoneId === oldZone) && (o.player === null)) | |||
o.destroy(); | |||
} | |||
@@ -115,9 +115,9 @@ define([ | |||
//Things like attacks don't have ids | |||
let exists = null; | |||
if (obj.id != null) { | |||
if (obj.id !== null) { | |||
exists = this.objects.find(function (o) { | |||
return ((o.id == obj.id) && (!o.destroyed)); | |||
return ((o.id === obj.id) && (!o.destroyed)); | |||
}); | |||
} | |||
@@ -138,7 +138,7 @@ define([ | |||
let value = template[p]; | |||
let type = typeof (value); | |||
if (type == 'object') { | |||
if (type === 'object') { | |||
if (syncTypes.indexOf(p) > -1) | |||
obj[p] = value; | |||
} else | |||
@@ -161,14 +161,14 @@ define([ | |||
components.forEach(function (c) { | |||
//Map ids to objects | |||
let keys = Object.keys(c).filter(function (k) { | |||
return ((k.indexOf('id') == 0) && (k.length > 2)); | |||
return ((k.indexOf('id') === 0) && (k.length > 2)); | |||
}); | |||
keys.forEach(function (k) { | |||
let value = c[k]; | |||
let newKey = k.substr(2, k.length).toLowerCase(); | |||
c[newKey] = this.objects.find(function (o) { | |||
return (o.id == value); | |||
return (o.id === value); | |||
}); | |||
delete c[k]; | |||
}, this); | |||
@@ -208,14 +208,14 @@ define([ | |||
components.forEach(function (c) { | |||
//Map ids to objects | |||
let keys = Object.keys(c).filter(function (k) { | |||
return ((k.indexOf('id') == 0) && (k.length > 2)); | |||
return ((k.indexOf('id') === 0) && (k.length > 2)); | |||
}); | |||
keys.forEach(function (k) { | |||
let value = c[k]; | |||
let newKey = k.substr(2, k.length).toLowerCase(); | |||
c[newKey] = this.objects.find(function (o) { | |||
return (o.id == value); | |||
return (o.id === value); | |||
}); | |||
delete c[k]; | |||
}, this); | |||
@@ -240,14 +240,14 @@ define([ | |||
let value = template[p]; | |||
let type = typeof (value); | |||
if (type != 'object') | |||
if (type !== 'object') | |||
obj[p] = value; | |||
if ((p == 'x') || (p == 'y')) | |||
if ((p === 'x') || (p === 'y')) | |||
moved = true; | |||
if (sprite) { | |||
if (p == 'x') { | |||
if (p === 'x') { | |||
if (obj.x < oldX) | |||
obj.flipX = true; | |||
else if (obj.x > oldX) | |||
@@ -262,7 +262,7 @@ define([ | |||
if (((template.sheetName) || (template.cell)) && (sprite)) | |||
renderer.setSprite(obj); | |||
if (sprite) { | |||
if (template.hidden != null) { | |||
if (template.hidden !== null) { | |||
sprite.visible = !template.hidden; | |||
if (obj.nameSprite) | |||
obj.nameSprite.visible = this.showNames; | |||
@@ -273,7 +273,7 @@ define([ | |||
} | |||
} | |||
if ((template.x != 0) || (template.y != 0)) { | |||
if ((template.x !== 0) || (template.y !== 0)) { | |||
if (obj.stats) | |||
obj.stats.updateHpSprite(); | |||
} | |||
@@ -315,7 +315,7 @@ define([ | |||
}, | |||
onKeyDown: function (key) { | |||
if (key == 'v') { | |||
if (key === 'v') { | |||
this.showNames = !this.showNames; | |||
//Set new value in localStorage for showNames | |||
@@ -18,7 +18,7 @@ define([ | |||
for (let i = 0; i < lLen; i++) { | |||
let l = list[i]; | |||
if (l == cpn) { | |||
if (l === cpn) { | |||
list.splice(i, 1); | |||
return; | |||
} | |||
@@ -38,7 +38,7 @@ define([ | |||
let ntx = fx + (Math.cos(angle) * (divDistance * i)) + ~~(Math.random() * (maxDeviate * 2)) - maxDeviate; | |||
let nty = fy + (Math.sin(angle) * (divDistance * i)) + ~~(Math.random() * (maxDeviate * 2)) - maxDeviate; | |||
if (i == divisions - 1) { | |||
if (i === divisions - 1) { | |||
ntx = tx; | |||
nty = ty; | |||
} | |||
@@ -50,7 +50,7 @@ define([ | |||
for (let j = 0; j < steps; j++) { | |||
let alpha = 1; | |||
if ((config.colors) && (i == divisions - 1) && (j > (steps * 0.75))) | |||
if ((config.colors) && (i === divisions - 1) && (j > (steps * 0.75))) | |||
alpha = 1 - (j / steps); | |||
let c = (config.colors || [0xffeb38, 0xfaac45, 0xfafcfc])[~~(Math.random() * (config.colors ? config.colors.length : 3))]; | |||
@@ -102,7 +102,7 @@ define([ | |||
toHex: function rgbToHex (r, g, b) { | |||
let componentToHex = function (c) { | |||
let hex = c.toString(16); | |||
return hex.length == 1 ? '0' + hex : hex; | |||
return hex.length === 1 ? '0' + hex : hex; | |||
}; | |||
return '0x' + componentToHex(r) + componentToHex(g) + componentToHex(b); | |||
@@ -19,7 +19,7 @@ define([ | |||
onGetDamage: function (msg) { | |||
let target = objects.objects.find(function (o) { | |||
return (o.id == msg.id); | |||
return (o.id === msg.id); | |||
}); | |||
if (!target) | |||
return; | |||
@@ -74,7 +74,7 @@ define([ | |||
let l = list[i]; | |||
l.ttl--; | |||
if (l.ttl == 0) { | |||
if (l.ttl === 0) { | |||
renderer.destroyObject({ | |||
layerName: 'effects', | |||
sprite: l.sprite | |||
@@ -44,7 +44,7 @@ define([ | |||
let emitters = this.emitters; | |||
let eLen = emitters.length; | |||
for (let i = 0; i < eLen; i++) { | |||
var e = emitters[i]; | |||
let e = emitters[i]; | |||
let visible = null; | |||
let destroy = !e.emit; | |||
@@ -73,7 +73,7 @@ define([ | |||
let r = e.update((now - this.lastTick) * 0.001); | |||
r.forEach(function (rr) { | |||
if (e.blendMode == 'overlay') | |||
if (e.blendMode === 'overlay') | |||
rr.pluginName = 'picture'; | |||
}, this); | |||
} | |||
@@ -97,7 +97,7 @@ define([ | |||
let layers = this.layers; | |||
Object.keys(layers).forEach(function (l) { | |||
if (l == 'tileSprites') { | |||
if (l === 'tileSprites') { | |||
layers[l] = new pixi.Container(); | |||
layers[l].layer = 'tiles'; | |||
} else { | |||
@@ -155,16 +155,16 @@ define([ | |||
toggleScreen: function () { | |||
let screenMode = 0; | |||
let isFullscreen = (window.innerHeight == screen.height); | |||
let isFullscreen = (window.innerHeight === screen.height); | |||
if (isFullscreen) | |||
screenMode = 0; | |||
else | |||
screenMode = 1; | |||
if (screenMode == 0) { | |||
if (screenMode === 0) { | |||
(document.cancelFullscreen || document.msCancelFullscreen || document.mozCancelFullscreen || document.webkitCancelFullScreen).call(document); | |||
return 'Windowed'; | |||
} else if (screenMode == 1) { | |||
} else if (screenMode === 1) { | |||
let el = $('body')[0]; | |||
(el.requestFullscreen || el.msRequestFullscreen || el.mozRequestFullscreen || el.webkitRequestFullscreen).call(el); | |||
return 'Fullscreen'; | |||
@@ -188,7 +188,7 @@ define([ | |||
for (let j = 0; j < h; j++) { | |||
let ii = i / 10; | |||
let alpha = Math.sin(((j * 0.2) % 5) + Math.cos(ii % 8)); | |||
var tile = 5; | |||
let tile = 5; | |||
if (j < 7) | |||
tile = 5; | |||
else if (alpha < -0.2) | |||
@@ -200,13 +200,13 @@ define([ | |||
alpha = Math.random(); | |||
if (tile == 5) | |||
if (tile === 5) | |||
alpha *= 2; | |||
else if (tile == 3) | |||
else if (tile === 3) | |||
alpha *= 1; | |||
else if (tile == 4) | |||
else if (tile === 4) | |||
alpha *= 1; | |||
else if (tile == 53) | |||
else if (tile === 53) | |||
alpha *= 2; | |||
alpha = Math.min(Math.max(0.15, alpha), 0.65); | |||
@@ -221,20 +221,20 @@ define([ | |||
}[tile]; | |||
} | |||
var tile = new pixi.Sprite(this.getTexture('sprites', tile)); | |||
let sprite = new pixi.Sprite(this.getTexture('sprites', tile)); | |||
tile.alpha = alpha; | |||
tile.position.x = i * scale; | |||
tile.position.y = j * scale; | |||
tile.width = scale; | |||
tile.height = scale; | |||
sprite.alpha = alpha; | |||
sprite.position.x = i * scale; | |||
sprite.position.y = j * scale; | |||
sprite.width = scale; | |||
sprite.height = scale; | |||
if (Math.random() < 0.5) { | |||
tile.position.x += scale; | |||
tile.scale.x = -scaleMult; | |||
sprite.position.x += scale; | |||
sprite.scale.x = -scaleMult; | |||
} | |||
container.addChild(tile); | |||
container.addChild(sprite); | |||
} | |||
} | |||
}, | |||
@@ -296,13 +296,13 @@ define([ | |||
this.stage.addChild(container); | |||
this.stage.children.sort(function (a, b) { | |||
if (a.layer == 'hiders') | |||
if (a.layer === 'hiders') | |||
return 1; | |||
else if (b.layer == 'hiders') | |||
else if (b.layer === 'hiders') | |||
return -1; | |||
else if (a.layer == 'tiles') | |||
else if (a.layer === 'tiles') | |||
return -1; | |||
else if (b.layer == 'tiles') | |||
else if (b.layer === 'tiles') | |||
return 1; | |||
return 0; | |||
}, this); | |||
@@ -319,7 +319,7 @@ define([ | |||
let cx = c.x; | |||
if (c.scale.x < 0) | |||
cx -= scale; | |||
if ((cx == x) && (c.y == y)) { | |||
if ((cx === x) && (c.y === y)) { | |||
c.parent.removeChild(c); | |||
break; | |||
} | |||
@@ -386,14 +386,14 @@ define([ | |||
this.sprites = _.get2dArray(w, h, 'array'); | |||
this.stage.children.sort(function (a, b) { | |||
if (a.layer == 'tiles') | |||
if (a.layer === 'tiles') | |||
return -1; | |||
else if (b.layer == 'tiles') | |||
else if (b.layer === 'tiles') | |||
return 1; | |||
return 0; | |||
}, this); | |||
if (this.zoneId != null) | |||
if (this.zoneId !== null) | |||
events.emit('onRezone', this.zoneId); | |||
this.zoneId = msg.zoneId; | |||
@@ -419,11 +419,11 @@ define([ | |||
color: 0x2d2136, | |||
parent: h.container | |||
}); | |||
for (var i = h.x; i < h.x + h.width; i++) { | |||
for (var j = h.y; j < h.y + h.height; j++) { | |||
for (let i = h.x; i < h.x + h.width; i++) { | |||
for (let j = h.y; j < h.y + h.height; j++) { | |||
[hiddenTiles, hiddenWalls].forEach(function (k) { | |||
let cell = k[i][j]; | |||
if (cell == 0) | |||
if (cell === 0) | |||
return; | |||
let tile = this.buildTile(cell - 1, i, j); | |||
@@ -515,9 +515,9 @@ define([ | |||
let addedSprite = false; | |||
for (var i = lowX; i < highX; i++) { | |||
for (var j = lowY; j < highY; j++) { | |||
cell = map[i][j]; | |||
for (let i = lowX; i < highX; i++) { | |||
for (let j = lowY; j < highY; j++) { | |||
let cell = map[i][j]; | |||
if (!cell) | |||
continue; | |||
@@ -527,9 +527,9 @@ define([ | |||
else if (!cell.split) | |||
cell += ''; | |||
cell = cell.split(','); | |||
for (var k = 0; k < cell.length; k++) { | |||
for (let k = 0; k < cell.length; k++) { | |||
let c = cell[k]; | |||
if (c == 0) | |||
if (c === '0') | |||
continue; | |||
c--; | |||
@@ -550,7 +550,7 @@ define([ | |||
} else { | |||
tile.position.x = i * scale; | |||
tile.position.y = j * scale; | |||
if (flipped != '') | |||
if (flipped !== '') | |||
tile.position.x += scale; | |||
tile.visible = true; | |||
} | |||
@@ -565,15 +565,15 @@ define([ | |||
highX = Math.min(w - 1, highX + 10); | |||
highY = Math.min(h - 1, highY + 10); | |||
for (var i = lowX; i < highX; i++) { | |||
for (let i = lowX; i < highX; i++) { | |||
let outside = ((i >= x - sw) && (i < x + sw)); | |||
for (var j = lowY; j < highY; j++) { | |||
for (let j = lowY; j < highY; j++) { | |||
if ((outside) && (j >= y - sh) && (j < y + sh)) | |||
continue; | |||
let list = sprites[i][j]; | |||
let lLen = list.length; | |||
for (var k = 0; k < lLen; k++) { | |||
for (let k = 0; k < lLen; k++) { | |||
let sprite = list[k]; | |||
sprite.visible = false; | |||
spritePool.store(sprite); | |||
@@ -597,7 +597,7 @@ define([ | |||
let deltaX = this.moveTo.x - this.pos.x; | |||
let deltaY = this.moveTo.y - this.pos.y; | |||
if ((deltaX != 0) || (deltaY != 0)) { | |||
if ((deltaX !== 0) || (deltaY !== 0)) { | |||
let moveSpeed = this.moveSpeed; | |||
let distance = Math.max(Math.abs(deltaX), Math.abs(deltaY)); | |||
@@ -648,11 +648,11 @@ define([ | |||
let graphics = new pixi.Graphics(); | |||
let alpha = obj.alpha; | |||
if (alpha != null) | |||
if (alpha !== null) | |||
graphics.alpha = alpha; | |||
let fillAlpha = obj.fillAlpha; | |||
if (fillAlpha == null) | |||
if (fillAlpha === null) | |||
fillAlpha = 1; | |||
graphics.beginFill(obj.color || '0x48edff', fillAlpha); | |||
@@ -770,11 +770,6 @@ define([ | |||
}, | |||
setSprite: function (obj) { | |||
let cell = obj.cell; | |||
let y = ~~(cell / 8); | |||
let x = cell - (y * 8); | |||
let baseTex = this.textures[obj.sheetName]; | |||
obj.sprite.texture = this.getTexture(obj.sheetName, obj.cell, obj.sprite.width / scaleMult); | |||
}, | |||
@@ -14,7 +14,7 @@ define([ | |||
let list = this.pool[type]; | |||
if (!list) | |||
return null; | |||
else if (list.length == 0) | |||
else if (list.length === 0) | |||
return null; | |||
return list.pop(); | |||
}, | |||
@@ -117,7 +117,7 @@ define([ | |||
let tilesheet = [this.tiles, this.walls, this.objects][sheetNum]; | |||
let alpha = (tilesheet[tile] || tilesheet.default); | |||
if (tilesheet.max != null) { | |||
if (tilesheet.max !== null) { | |||
alpha = alpha + (Math.random() * (alpha * 0.2)); | |||
alpha = Math.min(1, alpha); | |||
} | |||
@@ -139,7 +139,7 @@ define([ | |||
} | |||
let tilesheet = [this.tilesNoFlip, this.wallsNoFlip, this.objectsNoFlip][sheetNum]; | |||
return (tilesheet.indexOf(tile) == -1); | |||
return (tilesheet.indexOf(tile) === -1); | |||
} | |||
}; | |||
}); |
@@ -59,7 +59,7 @@ define([ | |||
readyCount++; | |||
} | |||
if (readyCount == this.spriteNames.length) | |||
if (readyCount === this.spriteNames.length) | |||
this.onReady(); | |||
}, | |||
onReady: function () { | |||
@@ -9,7 +9,7 @@ define([ | |||
init: function (zone) { | |||
this.unload(); | |||
if (zone != 'fjolarok') | |||
if (zone !== 'fjolarok') | |||
return; | |||
this.addSound('fire.ogg', 123, 123); | |||
@@ -53,7 +53,7 @@ define([ | |||
let y = j * tileSize; | |||
let cell = map[i][j]; | |||
if (cell == 0) | |||
if (cell === 0) | |||
continue; | |||
cell--; | |||
@@ -56,13 +56,13 @@ define([ | |||
}); | |||
oList.spliceWhere(function (o) { | |||
return prepend.some(function (p) { | |||
return p == o; | |||
return p === o; | |||
}); | |||
}); | |||
oList.unshift.apply(oList, prepend); | |||
} | |||
for (var e in response) { | |||
for (let e in response) { | |||
let r = response[e]; | |||
//Certain messages expect to be performed last (because the object they act on hasn't been greated when they get queued) | |||
@@ -12,7 +12,7 @@ define([ | |||
for (let i = 0; i < this.queue.length; i++) { | |||
let q = this.queue[i]; | |||
if (q.event != event) | |||
if (q.event !== event) | |||
continue; | |||
this.queue.splice(i, 1); | |||
@@ -28,21 +28,21 @@ define([ | |||
clearQueue: function () { | |||
//Hack to allow the player list to persist | |||
this.queue.spliceWhere(function (q) { | |||
return ((q.event != 'onGetConnectedPlayer') && (q.event != 'onGetDisconnectedPlayer')); | |||
return ((q.event !== 'onGetConnectedPlayer') && (q.event !== 'onGetDisconnectedPlayer')); | |||
}); | |||
}, | |||
off: function (event, callback) { | |||
let list = this.events[event] || []; | |||
let lLen = list.length; | |||
for (let i = 0; i < lLen; i++) { | |||
if (list[i] == callback) { | |||
if (list[i] === callback) { | |||
list.splice(i, 1); | |||
i--; | |||
lLen--; | |||
} | |||
} | |||
if (lLen == 0) | |||
if (lLen === 0) | |||
delete this.events[event]; | |||
}, | |||
emit: function (event) { | |||
@@ -88,7 +88,7 @@ define([ | |||
}, | |||
onKeyDown: function (key) { | |||
if (key == 'esc') { | |||
if (key === 'esc') { | |||
this.uis.forEach(function (u) { | |||
if (!u.modal) | |||
return; | |||
@@ -81,7 +81,7 @@ define([ | |||
}) | |||
.forEach(function (c, i) { | |||
let name = c.name; | |||
if (c.level != null) | |||
if (c.level !== null) | |||
name += '<font class="color-yellowB"> (' + c.level + ')</font>'; | |||
let html = templateListItem | |||
@@ -92,7 +92,7 @@ define([ | |||
li.on('click', this.onCharacterClick.bind(this, c.name)); | |||
if (i == 0) | |||
if (i === 0) | |||
li.click(); | |||
}, this); | |||
}, | |||
@@ -129,7 +129,7 @@ define([ | |||
spriteY = -(spriteY * 8); | |||
let spritesheet = result.sheetName; | |||
if (spritesheet == 'characters') | |||
if (spritesheet === 'characters') | |||
spritesheet = '../../../images/characters.png'; | |||
this.find('.sprite') | |||
@@ -138,7 +138,7 @@ define([ | |||
this.find('.name').html(name); | |||
let stats = result.components.find(function (c) { | |||
return (c.type == 'stats'); | |||
return (c.type === 'stats'); | |||
}); | |||
if (stats) { | |||
this.find('.class').html( | |||
@@ -155,7 +155,7 @@ define([ | |||
this.selected = name; | |||
let prophecies = result.components.find(function (c) { | |||
return (c.type == 'prophecies'); | |||
return (c.type === 'prophecies'); | |||
}); | |||
if ((prophecies) && (prophecies.list.indexOf('hardcore') > -1)) | |||
@@ -180,7 +180,7 @@ define([ | |||
if (this.deleteCount < 3) { | |||
this.deleteCount++; | |||
this.setMessage('click delete ' + (4 - this.deleteCount) + ' more time' + ((this.deleteCount == 3) ? '' : 's') + ' to confirm'); | |||
this.setMessage('click delete ' + (4 - this.deleteCount) + ' more time' + ((this.deleteCount === 3) ? '' : 's') + ' to confirm'); | |||
this.find('.btnDelete') | |||
.removeClass('deleting') | |||
@@ -54,7 +54,7 @@ define([ | |||
}, | |||
onMouseDown: function (e) { | |||
if ((!this.el.is(':visible')) || (e.cancel) || (e.button == 2)) | |||
if ((!this.el.is(':visible')) || (e.cancel) || (e.button === 2)) | |||
return; | |||
this.el.hide(); | |||
@@ -94,7 +94,7 @@ define([ | |||
if (el.hasClass('active')) { | |||
this.prophecies.spliceWhere(function (p) { | |||
return (p == pName); | |||
return (p === pName); | |||
}); | |||
el.removeClass('active'); | |||
} else { | |||
@@ -22,7 +22,7 @@ define([ | |||
onGetDialogue: function (msg) { | |||
this.text.spliceWhere(function (t) { | |||
return (t.src == msg.src); | |||
return (t.src === msg.src); | |||
}); | |||
this.text.push(msg); | |||
@@ -31,7 +31,7 @@ define([ | |||
onRemoveDialogue: function (msg) { | |||
this.text.spliceWhere(function (t) { | |||
return (t.src == msg.src); | |||
return (t.src === msg.src); | |||
}); | |||
this.setText(); | |||
@@ -49,7 +49,7 @@ define([ | |||
this.find('.textBox').html(text); | |||
if (text != '') | |||
if (text !== '') | |||
this.show(); | |||
else | |||
@@ -53,16 +53,16 @@ define([ | |||
}, | |||
onKeyDown: function (key) { | |||
if (key == 'j') | |||
if (key === 'j') | |||
this.toggle(); | |||
else if (key == 'shift') { | |||
else if (key === 'shift') { | |||
this.shiftDown = true; | |||
if (this.hoverItem) | |||
this.onHoverItem(this.hoverEl, this.hoverItem, this.hoverCompare); | |||
} | |||
}, | |||
onKeyUp: function (key) { | |||
if (key == 'shift') { | |||
if (key === 'shift') { | |||
this.shiftDown = false; | |||
if (this.hoverItem) | |||
this.onHoverItem(this.hoverEl, this.hoverItem, null); | |||
@@ -105,12 +105,12 @@ define([ | |||
let slot = el.attr('slot'); | |||
let newItems = window.player.inventory.items.some(function (i) { | |||
let checkSlot = slot; | |||
if (slot.indexOf('finger') == 0) | |||
if (slot.indexOf('finger') === 0) | |||
slot = 'finger'; | |||
else if (slot == 'oneHanded') | |||
else if (slot === 'oneHanded') | |||
return ((['oneHanded', 'twoHanded'].indexOf(slot) > -1) && (i.isNew)); | |||
return ((i.slot == slot) && (i.isNew)); | |||
return ((i.slot === slot) && (i.isNew)); | |||
}); | |||
if (newItems) | |||
@@ -120,22 +120,22 @@ define([ | |||
items | |||
.filter(function (item) { | |||
let runeSlot = item.runeSlot; | |||
if ((runeSlot != null) && (item.slot)) | |||
if ((runeSlot !== null) && (item.slot)) | |||
skipSpellId = runeSlot; | |||
return (item.quickSlot != null || (item.eq && (item.slot || item.runeSlot != null))); | |||
return (item.quickSlot !== null || (item.eq && (item.slot || item.runeSlot !== null))); | |||
}, this) | |||
.forEach(function (item) { | |||
let imgX = -item.sprite[0] * 64; | |||
let imgY = -item.sprite[1] * 64; | |||
let slot = item.slot; | |||
if (item.runeSlot != null) { | |||
if (item.runeSlot !== null) { | |||
let runeSlot = item.runeSlot; | |||
if (runeSlot > skipSpellId) | |||
runeSlot--; | |||
slot = 'rune-' + runeSlot; | |||
} else if (item.quickSlot != null) | |||
} else if (item.quickSlot !== null) | |||
slot = 'quick-' + item.quickSlot; | |||
let spritesheet = item.spritesheet || '../../../images/items.png'; | |||
@@ -162,8 +162,8 @@ define([ | |||
el = $(el.currentTarget).parent(); | |||
let slot = el.attr('slot'); | |||
let isRune = (slot.indexOf('rune') == 0); | |||
const isConsumable = (slot.indexOf('quick') == 0); | |||
let isRune = (slot.indexOf('rune') === 0); | |||
const isConsumable = (slot.indexOf('quick') === 0); | |||
let container = this.find('.itemList') | |||
.empty() | |||
@@ -178,16 +178,16 @@ define([ | |||
else if (isConsumable) | |||
return (item.type === 'consumable'); | |||
let checkSlot = (slot.indexOf('finger') == 0) ? 'finger' : slot; | |||
if (slot == 'oneHanded') | |||
return ((!item.eq) && ((item.slot == 'oneHanded') || (item.slot == 'twoHanded'))); | |||
let checkSlot = (slot.indexOf('finger') === 0) ? 'finger' : slot; | |||
if (slot === 'oneHanded') | |||
return ((!item.eq) && ((item.slot === 'oneHanded') || (item.slot === 'twoHanded'))); | |||
return ((item.slot == checkSlot) && (!item.eq)); | |||
return ((item.slot === checkSlot) && (!item.eq)); | |||
}, this); | |||
items = items | |||
.filter(function (item, i) { | |||
return (items.firstIndex(f => f.name == item.name) == i); | |||
return (items.firstIndex(f => f.name === item.name) === i); | |||
}); | |||
items.splice(0, 0, { | |||
@@ -219,24 +219,24 @@ define([ | |||
.on('mouseleave', this.onHoverItem.bind(this, null, null)) | |||
.on('click', this.equipItem.bind(this, item, slot)); | |||
if (item == this.hoverCompare) | |||
if (item === this.hoverCompare) | |||
el.find('.icon').addClass('eq'); | |||
else if (item.isNew) | |||
el.find('.icon').addClass('new'); | |||
}, this); | |||
if (items.length == 0) | |||
if (items.length === 0) | |||
container.hide(); | |||
}, | |||
equipItem: function (item, slot) { | |||
let isNew = window.player.inventory.items.some(function (i) { | |||
return ((i.equipSlot == slot) && (i.isNew)); | |||
return ((i.equipSlot === slot) && (i.isNew)); | |||
}); | |||
if (!isNew) | |||
this.find('[slot="' + slot + '"] .info').html(''); | |||
if (item == this.hoverCompare) { | |||
if (item === this.hoverCompare) { | |||
this.find('.itemList').hide(); | |||
return; | |||
} | |||
@@ -271,7 +271,7 @@ define([ | |||
method = 'unlearnAbility'; | |||
data.itemId = this.hoverCompare.id; | |||
} | |||
} else if (item.slot == 'finger') { | |||
} else if (item.slot === 'finger') { | |||
data = { | |||
itemId: item.id, | |||
slot: slot | |||
@@ -401,7 +401,7 @@ define([ | |||
let value = newStats[s]; | |||
let isGap = false; | |||
if (label.indexOf('gap') == 0) { | |||
if (label.indexOf('gap') === 0) { | |||
isGap = true; | |||
label = ''; | |||
value = ''; | |||
@@ -410,9 +410,9 @@ define([ | |||
let row = $('<div class="stat"><font class="q0">' + label + '</font><font color="#999">' + value + '</font></div>') | |||
.appendTo(container); | |||
if (s == 'gold') | |||
if (s === 'gold') | |||
row.addClass('gold'); | |||
else if ((s == 'level') || (s == 'next level')) | |||
else if ((s === 'level') || (s === 'next level')) | |||
row.addClass('blueText'); | |||
if (isGap) | |||
@@ -34,7 +34,7 @@ define([ | |||
onRemoveEvent: function (id) { | |||
let l = this.list.spliceFirstWhere(function (l) { | |||
return (l.id == id); | |||
return (l.id === id); | |||
}); | |||
if (l) | |||
@@ -43,7 +43,7 @@ define([ | |||
onObtainEvent: function (event) { | |||
let exists = this.list.find(function (l) { | |||
return (l.id == event.id); | |||
return (l.id === event.id); | |||
}); | |||
if (exists) { | |||
exists.el.find('.name').html(event.name); | |||
@@ -68,7 +68,7 @@ define([ | |||
event: event | |||
}); | |||
var event = container.find('.event'); | |||
let event = container.find('.event'); | |||
event | |||
.sort(function (a, b) { | |||
@@ -81,7 +81,7 @@ define([ | |||
onUpdateEvent: function (event) { | |||
let e = this.list.find(function (l) { | |||
return (l.id == event.id); | |||
return (l.id === event.id); | |||
}); | |||
e.event.isReady = event.isReady; | |||
@@ -97,7 +97,7 @@ define([ | |||
onCompleteEvent: function (id) { | |||
let e = this.list.find(function (l) { | |||
return (l.id == id); | |||
return (l.id === id); | |||
}); | |||
if (!e) | |||
@@ -105,7 +105,7 @@ define([ | |||
e.el.remove(); | |||
this.list.spliceWhere(function (l) { | |||
return (l.id == id); | |||
return (l.id === id); | |||
}); | |||
} | |||
}; | |||
@@ -19,7 +19,7 @@ define([ | |||
}, | |||
onKeyDown: function (key) { | |||
if (key == 'h') | |||
if (key === 'h') | |||
this.toggle(); | |||
}, | |||
@@ -89,13 +89,13 @@ define([ | |||
let rendered = []; | |||
for (var i = 0; i < iLen; i++) { | |||
for (let i = 0; i < iLen; i++) { | |||
let item = items.find(function (item) { | |||
return ((item.pos != null) && (item.pos == i)); | |||
return ((item.pos !== null) && (item.pos === i)); | |||
}); | |||
if (!item) { | |||
var itemEl = $(tplItem) | |||
let itemEl = $(tplItem) | |||
.appendTo(container); | |||
itemEl | |||
@@ -112,7 +112,7 @@ define([ | |||
let imgX = -item.sprite[0] * 64; | |||
let imgY = -item.sprite[1] * 64; | |||
var itemEl = $(tplItem) | |||
let itemEl = $(tplItem) | |||
.appendTo(container); | |||
let spritesheet = item.spritesheet || '../../../images/items.png'; | |||
@@ -121,7 +121,7 @@ define([ | |||
spritesheet = '../../../images/materials.png'; | |||
else if (item.quest) | |||
spritesheet = '../../../images/questItems.png'; | |||
else if (item.type == 'consumable') | |||
else if (item.type === 'consumable') | |||
spritesheet = '../../../images/consumables.png'; | |||
} | |||
@@ -176,7 +176,7 @@ define([ | |||
}, | |||
onMouseDown: function (el, item, down, e) { | |||
if (e.button != 0) | |||
if (e.button !== 0) | |||
return; | |||
if (down) { | |||
@@ -193,7 +193,7 @@ define([ | |||
} else if (this.dragItem) { | |||
let method = 'moveItem'; | |||
if ((this.hoverCell) && (this.hoverCell[0] != this.dragItem[0])) { | |||
if ((this.hoverCell) && (this.hoverCell[0] !== this.dragItem[0])) { | |||
let placeholder = $('<div></div>') | |||
.insertAfter(this.dragItem); | |||
@@ -207,19 +207,19 @@ define([ | |||
}]; | |||
this.items.find(function (i) { | |||
return (i.id == this.dragItem.data('item').id); | |||
return (i.id === this.dragItem.data('item').id); | |||
}, this).pos = this.dragItem.index(); | |||
let hoverCellItem = this.hoverCell.data('item'); | |||
if (hoverCellItem) { | |||
if ((hoverCellItem.name != this.dragItem.data('item').name) || (!hoverCellItem.quantity)) { | |||
if ((hoverCellItem.name !== this.dragItem.data('item').name) || (!hoverCellItem.quantity)) { | |||
msgs.push({ | |||
id: hoverCellItem.id, | |||
pos: this.hoverCell.index() | |||
}); | |||
this.items.find(function (i) { | |||
return (i.id == hoverCellItem.id); | |||
return (i.id === hoverCellItem.id); | |||
}, this).pos = this.hoverCell.index(); | |||
} else { | |||
method = 'combineStacks'; | |||
@@ -325,9 +325,9 @@ define([ | |||
if (item.ability) | |||
config.push(menuItems.learn); | |||
else if (item.type == 'mtx') | |||
else if (item.type === 'mtx') | |||
config.push(menuItems.activate); | |||
else if ((item.type == 'toy') || (item.type == 'consumable')) | |||
else if ((item.type === 'toy') || (item.type === 'consumable')) | |||
config.push(menuItems.use); | |||
else if (item.slot) { | |||
config.push(menuItems.equip); | |||
@@ -381,7 +381,7 @@ define([ | |||
splitStackEnd: function (cancel, e) { | |||
let box = this.find('.split-box'); | |||
if ((cancel) || (!e) || (e.target != box.find('.btnSplit')[0])) { | |||
if ((cancel) || (!e) || (e.target !== box.find('.btnSplit')[0])) { | |||
if ((cancel) && (!$(e.target).hasClass('button'))) | |||
box.hide(); | |||
@@ -409,7 +409,7 @@ define([ | |||
let delta = e ? ((e.originalEvent.deltaY > 0) ? -1 : 1) : amount; | |||
if (this.shiftDown) | |||
delta *= 10; | |||
var amount = this.find('.split-box .amount'); | |||
let amount = this.find('.split-box .amount'); | |||
amount.val(Math.max(1, Math.min(item.quantity - 1, ~~amount.val() + delta))); | |||
}, | |||
@@ -417,7 +417,7 @@ define([ | |||
onEnterStackAmount: function (e) { | |||
let el = this.find('.split-box .amount'); | |||
let val = el.val(); | |||
if (val != ~~val) | |||
if (val !== ~~val) | |||
el.val(''); | |||
else if (val) { | |||
let item = this.find('.split-box').data('item'); | |||
@@ -474,24 +474,24 @@ define([ | |||
let compare = null; | |||
if (item.slot) { | |||
compare = this.items.find(function (i) { | |||
return ((i.eq) && (i.slot == item.slot)); | |||
return ((i.eq) && (i.slot === item.slot)); | |||
}); | |||
// check special cases for mismatched weapon/offhand scenarios (only valid when comparing) | |||
if ((!compare) && (this.shiftDown)) { | |||
let equippedTwoHanded = this.items.find(function (i) { | |||
return ((i.eq) && (i.slot == 'twoHanded')); | |||
return ((i.eq) && (i.slot === 'twoHanded')); | |||
}); | |||
let equippedOneHanded = this.items.find(function (i) { | |||
return ((i.eq) && (i.slot == 'oneHanded')); | |||
return ((i.eq) && (i.slot === 'oneHanded')); | |||
}); | |||
let equippedOffhand = this.items.find(function (i) { | |||
return ((i.eq) && (i.slot == 'offHand')); | |||
return ((i.eq) && (i.slot === 'offHand')); | |||
}); | |||
if (item.slot == 'twoHanded') { | |||
if (item.slot === 'twoHanded') { | |||
if (!equippedOneHanded) | |||
compare = equippedOffhand; | |||
else if (!equippedOffhand) | |||
@@ -510,11 +510,11 @@ define([ | |||
} | |||
} | |||
if (item.slot == 'oneHanded') | |||
if (item.slot === 'oneHanded') | |||
compare = equippedTwoHanded; | |||
// this case is kind of ugly, but we don't want to go in when comparing an offHand to (oneHanded + empty offHand) - that should just use the normal compare which is offHand to empty | |||
if ((item.slot == 'offHand') && (equippedTwoHanded)) { | |||
if ((item.slot === 'offHand') && (equippedTwoHanded)) { | |||
// since we're comparing an offhand to an equipped Twohander, we need to clone the 'spell' values over (setting damage to zero) so that we can properly display how much damage | |||
// the player would lose by switching to the offhand (which would remove the twoHander) | |||
// keep a reference to the original item for use in onHideToolTip | |||
@@ -544,11 +544,11 @@ define([ | |||
}, | |||
onDestroyItems: function (itemIds) { | |||
itemIds.forEach(function (id) { | |||
let item = this.items.find(i => i.id == id); | |||
if (item == this.hoverItem) | |||
let item = this.items.find(i => i.id === id); | |||
if (item === this.hoverItem) | |||
this.hideTooltip(); | |||
this.items.spliceWhere(i => i.id == id); | |||
this.items.spliceWhere(i => i.id === id); | |||
}, this); | |||
if (this.shown) | |||
@@ -586,18 +586,18 @@ define([ | |||
performItemAction: function (item, action) { | |||
if (!item) | |||
return; | |||
else if ((action == 'equip') && ((item.material) || (item.quest) || (item.type == 'mtx') || (!window.player.inventory.canEquipItem(item)))) | |||
else if ((action === 'equip') && ((item.material) || (item.quest) || (item.type === 'mtx') || (!window.player.inventory.canEquipItem(item)))) | |||
return; | |||
else if ((action == 'learnAbility') && (!window.player.inventory.canEquipItem(item))) | |||
else if ((action === 'learnAbility') && (!window.player.inventory.canEquipItem(item))) | |||
return; | |||
else if ((action == 'activateMtx') && (item.type != 'mtx')) | |||
else if ((action === 'activateMtx') && (item.type !== 'mtx')) | |||
return; | |||
let cpn = 'inventory'; | |||
if (action == 'equip') | |||
if (action === 'equip') | |||
cpn = 'equipment'; | |||
if (action == 'useItem') | |||
if (action === 'useItem') | |||
this.hide(); | |||
client.request({ | |||
@@ -624,21 +624,21 @@ define([ | |||
}, | |||
onKeyDown: function (key) { | |||
if (key == 'i') | |||
if (key === 'i') | |||
this.toggle(); | |||
else if (key == 'shift') { | |||
else if (key === 'shift') { | |||
this.shiftDown = true; | |||
if (this.hoverItem) | |||
this.onHover(); | |||
} else if (key == 'ctrl') | |||
} else if (key === 'ctrl') | |||
this.ctrlDown = true; | |||
}, | |||
onKeyUp: function (key) { | |||
if (key == 'shift') { | |||
if (key === 'shift') { | |||
this.shiftDown = false; | |||
if (this.hoverItem) | |||
this.onHover(); | |||
} else if (key == 'ctrl') | |||
} else if (key === 'ctrl') | |||
this.ctrlDown = false; | |||
} | |||
}; | |||
@@ -82,12 +82,12 @@ define([ | |||
let prophecyName = el.attr('prophecy'); | |||
let exists = this.prophecyFilter.some(function (p) { | |||
return (p == prophecyName); | |||
return (p === prophecyName); | |||
}, this); | |||
if (exists) { | |||
this.prophecyFilter.spliceWhere(function (p) { | |||
return (p == prophecyName); | |||
return (p === prophecyName); | |||
}, this); | |||
} else | |||
this.prophecyFilter.push(prophecyName); | |||
@@ -120,9 +120,9 @@ define([ | |||
this.offset = 0; | |||
let foundIndex = this.records.list.firstIndex(function (r) { | |||
return (r.name == window.player.name); | |||
return (r.name === window.player.name); | |||
}, this); | |||
if (foundIndex != -1) | |||
if (foundIndex !== -1) | |||
this.offset = ~~(foundIndex / this.pageSize); | |||
} | |||
@@ -133,17 +133,17 @@ define([ | |||
this.maxOffset = Math.ceil(result.length / this.pageSize) - 1; | |||
for (let i = 0; i < this.records.list.length; i++) { | |||
var r = this.records.list[i]; | |||
let r = this.records.list[i]; | |||
let html = '<div class="row"><div class="col">' + r.level + '</div><div class="col">' + r.name + '</div></div>'; | |||
let el = $(html) | |||
.appendTo(container); | |||
if (r.name == window.player.name) | |||
if (r.name === window.player.name) | |||
el.addClass('self'); | |||
else { | |||
let online = globals.onlineList.some(function (o) { | |||
return (o.name == r.name); | |||
return (o.name === r.name); | |||
}); | |||
if (online) | |||
el.addClass('online'); | |||
@@ -161,7 +161,7 @@ define([ | |||
updatePaging: function () { | |||
this.find('.buttons .btn').removeClass('disabled'); | |||
if (this.offset == 0) | |||
if (this.offset === 0) | |||
this.find('.btn-first, .btn-prev').addClass('disabled'); | |||
if (this.offset >= this.maxOffset) | |||
@@ -43,7 +43,7 @@ define([ | |||
}, | |||
onKeyDown: function (e) { | |||
if (e.keyCode == 13) | |||
if (e.keyCode === 13) | |||
this.onLoginClick(); | |||
}, | |||
onHandshake: function () { | |||
@@ -29,7 +29,7 @@ define([ | |||
return; | |||
let recipient = this.find('.txtRecipient').val(); | |||
if (recipient.length == 0) | |||
if (recipient.length === 0) | |||
return; | |||
client.request({ | |||
@@ -73,7 +73,7 @@ define([ | |||
spritesheet = '../../../images/materials.png'; | |||
else if (item.quest) | |||
spritesheet = '../../../images/questItems.png'; | |||
else if (item.type == 'consumable') | |||
else if (item.type === 'consumable') | |||
spritesheet = '../../../images/consumables.png'; | |||
let el = this.find('.item'); | |||
@@ -95,7 +95,7 @@ define([ | |||
let filter = el.attr('filter'); | |||
let method = (el.hasClass('active') ? 'show' : 'hide'); | |||
if (method == 'show') | |||
if (method === 'show') | |||
this.find('.list').addClass(filter); | |||
else | |||
this.find('.list').removeClass(filter); | |||
@@ -105,7 +105,7 @@ define([ | |||
}, | |||
onKeyDown: function (key, state) { | |||
if (key == 'enter') | |||
if (key === 'enter') | |||
this.toggle(true); | |||
}, | |||
@@ -135,7 +135,7 @@ define([ | |||
let el = $('<div class="list-message ' + m.class + '">' + message + '</div>') | |||
.appendTo(container); | |||
if (m.type != null) | |||
if (m.type !== null) | |||
el.addClass(m.type); | |||
else | |||
el.addClass('info'); | |||
@@ -147,7 +147,7 @@ define([ | |||
} | |||
if (m.type) { | |||
let isChannel = (['info', 'chat', 'loot', 'rep'].indexOf(m.type) == -1); | |||
let isChannel = (['info', 'chat', 'loot', 'rep'].indexOf(m.type) === -1); | |||
if (isChannel) { | |||
if (this.find('.filter[filter="' + m.type + '"]').hasClass('active')) | |||
el.show(); | |||
@@ -211,10 +211,10 @@ define([ | |||
}, | |||
sendChat: function (e) { | |||
if (e.which == 27) | |||
if (e.which === 27) | |||
this.toggle(false); | |||
if (e.which != 13) | |||
if (e.which !== 13) | |||
return; | |||
if (!this.el.hasClass('typing')) { | |||
@@ -231,7 +231,7 @@ define([ | |||
textbox.blur(); | |||
if (val.trim() == '') | |||
if (val.trim() === '') | |||
return; | |||
client.request({ | |||
@@ -32,7 +32,7 @@ define([ | |||
}, | |||
onKeyDown: function (key) { | |||
if (key == 'o') | |||
if (key === 'o') | |||
this.toggle(); | |||
}, | |||
@@ -54,7 +54,7 @@ define([ | |||
list.forEach(function (l) { | |||
let exists = onlineList.find(function (o) { | |||
return (o.name == l.name); | |||
return (o.name === l.name); | |||
}); | |||
if (exists) | |||
$.extend(true, exists, l); | |||
@@ -64,7 +64,7 @@ define([ | |||
onlineList | |||
.sort(function (a, b) { | |||
if (a.level == b.level) { | |||
if (a.level === b.level) { | |||
if (a.name > b.name) | |||
return 1; | |||
return -1; | |||
@@ -79,7 +79,7 @@ define([ | |||
let onlineList = this.onlineList; | |||
onlineList.spliceWhere(function (o) { | |||
return (o.name == name); | |||
return (o.name === name); | |||
}); | |||
if (this.shown) | |||
@@ -105,7 +105,7 @@ define([ | |||
}, | |||
showContext: function (char, e) { | |||
if (char.name != window.player.name) { | |||
if (char.name !== window.player.name) { | |||
events.emit('onContextMenu', [{ | |||
text: 'invite to party', | |||
callback: this.invite.bind(this, char.id) | |||
@@ -69,7 +69,7 @@ define([ | |||
}, | |||
onResize: function () { | |||
let isFullscreen = (window.innerHeight == screen.height); | |||
let isFullscreen = (window.innerHeight === screen.height); | |||
if (isFullscreen) | |||
this.el.find('.btnScreen').html('Windowed'); | |||
else | |||
@@ -95,7 +95,7 @@ define([ | |||
}, | |||
onKeyDown: function (key) { | |||
if (key == 'esc') | |||
if (key === 'esc') | |||
this.toggle(); | |||
} | |||
}; | |||
@@ -29,7 +29,7 @@ define([ | |||
if (!this.focusEl) | |||
return; | |||
if (focusEl[0] != this.focusEl[0]) | |||
if (focusEl[0] !== this.focusEl[0]) | |||
return; | |||
this.focusEl.css('z-index', this.lastZIndex); | |||
@@ -42,27 +42,27 @@ define([ | |||
msg = [msg]; | |||
msg.forEach(function (m) { | |||
if (party.indexOf(m.id) == -1) | |||
if (party.indexOf(m.id) === -1) | |||
return; | |||
let zone = m.zone; | |||
if (m.id == window.player.serverId) { | |||
if (m.id === window.player.serverId) { | |||
party.forEach(function (p) { | |||
let player = globals.onlineList.find(function (o) { | |||
return (o.id == p); | |||
return (o.id === p); | |||
}); | |||
let el = this.find('.member[memberId="' + p + '"]'); | |||
el.removeClass('differentZone'); | |||
if (player.zone != zone) | |||
if (player.zone !== zone) | |||
el.addClass('differentZone'); | |||
}, this); | |||
} else { | |||
let el = this.find('.member[memberId="' + m.id + '"]'); | |||
el.removeClass('differentZone'); | |||
if (m.zone != window.player.zone) | |||
if (m.zone !== window.player.zone) | |||
el.addClass('differentZone'); | |||
el.find('.txtLevel').html('level: ' + m.level); | |||
@@ -76,20 +76,20 @@ define([ | |||
return; | |||
let el = this.find('.member[memberId="' + id + '"]'); | |||
if (el.length == 0) | |||
if (el.length === 0) | |||
return; | |||
if ((stats.hp != null) && (stats.hpMax != null)) { | |||
if ((stats.hp !== null) && (stats.hpMax !== null)) { | |||
let hpPercentage = Math.min(100, (stats.hp / stats.hpMax) * 100); | |||
el.find('.statHp').css('width', hpPercentage + '%'); | |||
} | |||
if ((stats.mana != null) && (stats.manaMax != null)) { | |||
if ((stats.mana !== null) && (stats.manaMax !== null)) { | |||
let manaPercentage = Math.min((stats.mana / stats.manaMax) * 100, 100); | |||
el.find('.statMana').css('width', manaPercentage + '%'); | |||
} | |||
if (stats.level != null) | |||
if (stats.level !== null) | |||
el.find('.txtLevel').html('level: ' + stats.level); | |||
}, | |||
@@ -111,11 +111,11 @@ define([ | |||
return; | |||
party.forEach(function (p) { | |||
if (p == window.player.serverId) | |||
if (p === window.player.serverId) | |||
return; | |||
let player = globals.onlineList.find(function (o) { | |||
return (o.id == p); | |||
return (o.id === p); | |||
}); | |||
let name = player ? player.name : 'unknown'; | |||
let level = 'level: ' + (player ? player.level : '?'); | |||
@@ -129,12 +129,12 @@ define([ | |||
.attr('memberId', p) | |||
.on('contextmenu', this.showContext.bind(this, name, p)); | |||
if (player.zone != window.player.zone) | |||
if (player.zone !== window.player.zone) | |||
el.addClass('differentZone'); | |||
//Find stats | |||
let memberObj = objects.objects.find(function (o) { | |||
return (o.serverId == p); | |||
return (o.serverId === p); | |||
}); | |||
if ((memberObj) && (memberObj.stats)) | |||
this.onGetPartyStats(p, memberObj.stats.values); | |||
@@ -162,7 +162,7 @@ define([ | |||
this.destroyInvite(); | |||
let sourcePlayer = globals.onlineList.find(function (o) { | |||
return (o.id == sourceId); | |||
return (o.id === sourceId); | |||
}); | |||
let html = templateInvite | |||
@@ -72,12 +72,12 @@ define([ | |||
isKeyDown: function (key, noConsume) { | |||
let down = this.keys[key]; | |||
if (down != null) { | |||
if (down !== null) { | |||
if (noConsume) | |||
return true; | |||
this.keys[key] = 2; | |||
return (down == 1); | |||
return (down === 1); | |||
} return false; | |||
}, | |||
getAxis: function (name) { | |||
@@ -87,14 +87,14 @@ define([ | |||
let result = 0; | |||
for (var i = 0; i < axis.negative.length; i++) { | |||
for (let i = 0; i < axis.negative.length; i++) { | |||
if (this.keys[axis.negative[i]]) { | |||
result--; | |||
break; | |||
} | |||
} | |||
for (var i = 0; i < axis.positive.length; i++) { | |||
for (let i = 0; i < axis.positive.length; i++) { | |||
if (this.keys[axis.positive[i]]) { | |||
result++; | |||
break; | |||
@@ -110,30 +110,30 @@ define([ | |||
if (!this.enabled) | |||
return; | |||
if (e.target != document.body) | |||
if (e.target !== document.body) | |||
return true; | |||
if ((e.keyCode == 9) || (e.keyCode == 8) || (e.keyCode == 122)) | |||
if ((e.keyCode === 9) || (e.keyCode === 8) || (e.keyCode === 122)) | |||
e.preventDefault(); | |||
let key = this.getMapping(e.which); | |||
if (this.keys[key] != null) | |||
if (this.keys[key] !== null) | |||
this.keys[key] = 2; | |||
else { | |||
this.keys[key] = 1; | |||
events.emit('onKeyDown', key); | |||
} | |||
if (key == 'backspace') | |||
if (key === 'backspace') | |||
return false; | |||
else if (e.key == 'F11') | |||
else if (e.key === 'F11') | |||
events.emit('onToggleFullscreen'); | |||
}, | |||
keyUp: function (e) { | |||
if (!this.enabled) | |||
return; | |||
if (e.target != document.body) | |||
if (e.target !== document.body) | |||
return; | |||
let key = this.getMapping(e.which); | |||
@@ -101,10 +101,10 @@ define([ | |||
links.forEach(function (l) { | |||
let linked = ( | |||
nodes.find(function (n) { | |||
return (n.id == l.from.id); | |||
return (n.id === l.from.id); | |||
}).selected && | |||
nodes.find(function (n) { | |||
return (n.id == l.to.id); | |||
return (n.id === l.to.id); | |||
}).selected | |||
); | |||
this.renderers.line.call(this, l.from, l.to, linked); | |||
@@ -121,7 +121,7 @@ define([ | |||
if (this.shown) { | |||
//Calculate midpoint | |||
let start = this.data.nodes.find(function (n) { | |||
return (n.spiritStart == window.player.class); | |||
return (n.spiritStart === window.player.class); | |||
}); | |||
this.pos.x = start.pos.x * constants.gridSize; | |||
@@ -144,7 +144,7 @@ define([ | |||
}, | |||
onKeyDown: function (key) { | |||
if (key == 'p') | |||
if (key === 'p') | |||
this.toggle(); | |||
}, | |||
@@ -159,7 +159,7 @@ define([ | |||
node: function (node) { | |||
let color = (node.color >= 0) ? (node.color + 1) : -1; | |||
if (((!node.stats) || (Object.keys(node.stats).length == 0)) && (!node.spiritStart)) | |||
if (((!node.stats) || (Object.keys(node.stats).length === 0)) && (!node.spiritStart)) | |||
color = 0; | |||
if (node.spiritStart) { | |||
@@ -187,13 +187,13 @@ define([ | |||
let y = (node.pos.y * constants.gridSize) - ((size - constants.blockSize) / 2) - this.pos.y; | |||
let linked = this.data.links.some(function (l) { | |||
if ((l.from.id != node.id) && (l.to.id != node.id)) | |||
if ((l.from.id !== node.id) && (l.to.id !== node.id)) | |||
return false; | |||
return this.data.nodes.some(function (n) { | |||
return ( | |||
((n.id == l.from.id) && (n.selected)) || | |||
((n.id == l.to.id) && (n.selected)) | |||
((n.id === l.from.id) && (n.selected)) || | |||
((n.id === l.to.id) && (n.selected)) | |||
); | |||
}); | |||
}, this); | |||
@@ -232,11 +232,11 @@ define([ | |||
let halfSize = constants.blockSize / 2; | |||
fromNode = this.data.nodes.find(function (n) { | |||
return (n.id == fromNode.id); | |||
return (n.id === fromNode.id); | |||
}); | |||
toNode = this.data.nodes.find(function (n) { | |||
return (n.id == toNode.id); | |||
return (n.id === toNode.id); | |||
}); | |||
let fromX = (fromNode.pos.x * constants.gridSize) + halfSize - this.pos.x; | |||
@@ -262,7 +262,7 @@ define([ | |||
events: { | |||
onMouseMove: function (pos) { | |||
if ((this.mouse.x == pos.x) && (this.mouse.y == pos.y)) | |||
if ((this.mouse.x === pos.x) && (this.mouse.y === pos.y)) | |||
return; | |||
this.mouse = { | |||
@@ -277,8 +277,8 @@ define([ | |||
let node = this.hoverNode = this.data.nodes.find(function (n) { | |||
return ( | |||
(n.pos.x == cell.x) && | |||
(n.pos.y == cell.y) | |||
(n.pos.x === cell.x) && | |||
(n.pos.y === cell.y) | |||
); | |||
}); | |||
@@ -304,7 +304,7 @@ define([ | |||
.map(function (s) { | |||
let statName = statTranslations.translate(s); | |||
let statValue = node.stats[s]; | |||
let negative = ((statValue + '')[0] == '-'); | |||
let negative = ((statValue + '')[0] === '-'); | |||
if (percentageStats.indexOf(s) > -1) | |||
statValue += '%'; | |||
@@ -312,12 +312,12 @@ define([ | |||
}) | |||
.join('<br />'); | |||
if (node.spiritStart == window.player.class) | |||
if (node.spiritStart === window.player.class) | |||
text = 'Your starting node'; | |||
else if (node.spiritStart) | |||
text = 'Starting node for ' + node.spiritStart + ' spirits'; | |||
var pos = { | |||
let pos = { | |||
x: input.mouse.raw.clientX + 15, | |||
y: input.mouse.raw.clientY | |||
}; | |||
@@ -390,7 +390,7 @@ define([ | |||
onGetPassives: function (selected) { | |||
this.data.nodes.forEach(function (n) { | |||
n.selected = selected.some(function (s) { | |||
return (s == n.id); | |||
return (s === n.id); | |||
}); | |||
}); | |||
@@ -22,14 +22,14 @@ define([ | |||
onShowProgress: function (text, percentage) { | |||
let bar = this.bars.find(function (b) { | |||
return (b.text == text); | |||
return (b.text === text); | |||
}); | |||
if (bar) { | |||
if (percentage >= 100) { | |||
bar.el.remove(); | |||
this.bars.spliceWhere(function (b) { | |||
return (b == bar); | |||
return (b === bar); | |||
}); | |||
} else | |||
bar.el.find('.bar').css('width', percentage + '%'); | |||
@@ -86,7 +86,7 @@ define([ | |||
onUpdateQuest: function (quest) { | |||
let q = this.quests.find(function (q) { | |||
return (q.id == quest.id); | |||
return (q.id === quest.id); | |||
}); | |||
q.quest.isReady = quest.isReady; | |||
@@ -102,7 +102,7 @@ define([ | |||
onCompleteQuest: function (id) { | |||
let q = this.quests.find(function (q) { | |||
return (q.id == id); | |||
return (q.id === id); | |||
}); | |||
if (!q) | |||
@@ -110,7 +110,7 @@ define([ | |||
q.el.remove(); | |||
this.quests.spliceWhere(function (q) { | |||
return (q.id == id); | |||
return (q.id === id); | |||
}); | |||
} | |||
}; | |||
@@ -29,7 +29,7 @@ define([ | |||
this.find('.info .description').html(''); | |||
this.find('.bar-outer').hide(); | |||
if (list.length == 0) | |||
if (list.length === 0) | |||
this.find('.heading-bottom').html("you haven't discovered any factions yet"); | |||
else | |||
this.find('.heading-bottom').html('select a faction to see more info'); | |||
@@ -61,7 +61,7 @@ define([ | |||
let tier = faction.tier; | |||
let tiers = faction.tiers; | |||
let prevTier = tiers[tier]; | |||
let nextTier = (tier == tiers.length - 1) ? tiers[tiers.length - 1] : tiers[tier + 1]; | |||
let nextTier = (tier === tiers.length - 1) ? tiers[tiers.length - 1] : tiers[tier + 1]; | |||
let percentage = (rep - prevTier.rep) / (nextTier.rep - prevTier.rep) * 100; | |||
this.find('.bar-outer').show(); | |||
@@ -47,7 +47,7 @@ define([ | |||
this.find('.col-btn').removeClass('selected'); | |||
let action = el.attr('action'); | |||
let changed = (action != this.action); | |||
let changed = (action !== this.action); | |||
this.action = action; | |||
el.addClass('selected'); | |||
@@ -83,11 +83,11 @@ define([ | |||
zIndex: 9999999, | |||
top: 100 | |||
}; | |||
if (this.action == 'reroll') | |||
if (this.action === 'reroll') | |||
msg.msg = 'Item Reroll Succeeded'; | |||
else if (this.action == 'relevel') | |||
else if (this.action === 'relevel') | |||
msg.msg = 'Item Relevel Succeeded'; | |||
else if (this.action == 'reslot') | |||
else if (this.action === 'reslot') | |||
msg.msg = 'Item Reslot Succeeded'; | |||
result.addStatMsgs.forEach(function (a) { | |||
@@ -130,7 +130,7 @@ define([ | |||
this.offEvent(this.eventClickInv); | |||
return; | |||
} else if ((!msg.item.slot) || (msg.item.noAugment)) { | |||
var msg = { | |||
let msg = { | |||
msg: 'Incorrect Item Type', | |||
type: 'failure', | |||
zIndex: 9999999, | |||
@@ -140,7 +140,7 @@ define([ | |||
return; | |||
} else if (msg.item.eq) { | |||
var msg = { | |||
let msg = { | |||
msg: 'Cannot augment equipped items', | |||
type: 'failure', | |||
zIndex: 9999999, | |||
@@ -168,7 +168,7 @@ define([ | |||
reslot.removeClass('disabled'); | |||
let relevel = this.find('[action="relevel"]').addClass('disabled'); | |||
if (msg.item.slot == 'tool') | |||
if (msg.item.slot === 'tool') | |||
relevel.removeClass('disabled'); | |||
this.offEvent(this.eventClickInv); | |||
@@ -215,7 +215,7 @@ define([ | |||
let material = result.materials[0]; | |||
if (material) { | |||
let hasMaterials = window.player.inventory.items.find(function (i) { | |||
return (i.name == material.name); | |||
return (i.name === material.name); | |||
}); | |||
if (hasMaterials) { | |||
material.quantityText = hasMaterials.quantity + '/' + material.quantity; | |||
@@ -247,7 +247,7 @@ define([ | |||
spritesheet = '../../../images/materials.png'; | |||
else if (item.quest) | |||
spritesheet = '../../../images/questItems.png'; | |||
else if (item.type == 'consumable') | |||
else if (item.type === 'consumable') | |||
spritesheet = '../../../images/consumables.png'; | |||
let el = $(templateItem) | |||
@@ -309,7 +309,7 @@ define([ | |||
this.hide(); | |||
}, | |||
onKeyDown: function (key) { | |||
if (key == 'm') | |||
if (key === 'm') | |||
this.toggle(); | |||
} | |||
}; | |||
@@ -34,7 +34,7 @@ define([ | |||
let x = -(icon[0] * 64); | |||
let y = -(icon[1] * 64); | |||
let hotkey = (spells[i].id == 0) ? 'space' : spells[i].id; | |||
let hotkey = (spells[i].id === 0) ? 'space' : spells[i].id; | |||
let html = templateSpell | |||
.replace('$HOTKEY$', hotkey); | |||
@@ -69,7 +69,7 @@ define([ | |||
let cd = ~~((spell.cdMax * 350) / 1000); | |||
let values = Object.keys(spell.values).filter(function (v) { | |||
return ((v != 'damage') && (v != 'healing')); | |||
return ((v !== 'damage') && (v !== 'healing')); | |||
}).map(function (v) { | |||
return v + ': ' + spell.values[v]; | |||
}).join('<br />'); | |||
@@ -102,7 +102,7 @@ define([ | |||
onGetSpellCooldowns: function (options) { | |||
let spell = this.spells.find(function (s) { | |||
return (s.id == options.spell); | |||
return (s.id === options.spell); | |||
}); | |||
spell.ttl = options.cd; | |||
spell.ttlStart = +new Date(); | |||
@@ -39,7 +39,7 @@ define([ | |||
let remainder = iLen % 8; | |||
let startNoPad = ~~(iLen / 8); | |||
if (remainder == 0) | |||
if (remainder === 0) | |||
startNoPad--; | |||
startNoPad *= 8; | |||
@@ -58,7 +58,7 @@ define([ | |||
spritesheet = '../../../images/materials.png'; | |||
else if (item.quest) | |||
spritesheet = '../../../images/questItems.png'; | |||
else if (item.type == 'consumable') | |||
else if (item.type === 'consumable') | |||
spritesheet = '../../../images/consumables.png'; | |||
} | |||
@@ -79,7 +79,7 @@ define([ | |||
itemEl.addClass('new'); | |||
if (i >= startNoPad) { | |||
if (i == iLen - 1) | |||
if (i === iLen - 1) | |||
itemEl.css('margin', '0px 0px 0px 0px'); | |||
else | |||
itemEl.css('margin', '0px 8px 0px 0px'); | |||
@@ -123,7 +123,7 @@ define([ | |||
let compare = null; | |||
if (this.shiftDown) { | |||
compare = window.player.inventory.items.find(function (i) { | |||
return ((i.eq) && (i.slot == item.slot)); | |||
return ((i.eq) && (i.slot === item.slot)); | |||
}); | |||
} | |||
@@ -146,17 +146,17 @@ define([ | |||
//Sort by slot | |||
this.items.sort(function (a, b) { | |||
if (((a.material) && (b.material)) || ((a.quest) && (b.quest)) || ((a.slot != null) && (a.slot == b.slot))) { | |||
if (a.type == b.type) { | |||
if (((a.material) && (b.material)) || ((a.quest) && (b.quest)) || ((a.slot !== null) && (a.slot === b.slot))) { | |||
if (a.type === b.type) { | |||
if (a.name < b.name) | |||
return -1; | |||
else if (a.name == b.name) | |||
else if (a.name === b.name) | |||
return 0; | |||
else if (a.name > b.name) | |||
return 1; | |||
} else if ((a.type || '') < (b.type || '')) | |||
return -1; | |||
else if ((a.type || '') == (b.type || '')) | |||
else if ((a.type || '') === (b.type || '')) | |||
return 0; | |||
else if ((a.type || '') > (b.type || '')) | |||
return 1; | |||
@@ -181,11 +181,11 @@ define([ | |||
}, | |||
onDestroyStashItems: function (itemIds) { | |||
itemIds.forEach(function (id) { | |||
let item = this.items.find(i => i.id == id); | |||
if (item == this.hoverItem) | |||
let item = this.items.find(i => i.id === id); | |||
if (item === this.hoverItem) | |||
this.hideTooltip(); | |||
this.items.spliceWhere(i => i.id == id); | |||
this.items.spliceWhere(i => i.id === id); | |||
}, this); | |||
if (this.shown) | |||
@@ -233,17 +233,17 @@ define([ | |||
}, | |||
onKeyDown: function (key) { | |||
if (key == 'u') | |||
if (key === 'u') | |||
this.toggle(); | |||
else if (key == 'shift') { | |||
else if (key === 'shift') { | |||
this.shiftDown = true; | |||
if (this.hoverItem) | |||
this.onHover(); | |||
} else if ((key == 'esc') && (this.shown)) | |||
} else if ((key === 'esc') && (this.shown)) | |||
this.toggle(); | |||
}, | |||
onKeyUp: function (key) { | |||
if (key == 'shift') { | |||
if (key === 'shift') { | |||
this.shiftDown = false; | |||
if (this.hoverItem) | |||
this.onHover(); | |||
@@ -24,7 +24,7 @@ define([ | |||
let target = this.target; | |||
//This is kind of a hack. We check if the target has a prophecies component since we can't check for | |||
// target.player (only the logged-in player has a player component) | |||
if ((e.button != 2) || (!target) || (!target.dialogue) || (target == window.player) || (target.prophecies)) | |||
if ((e.button !== 2) || (!target) || (!target.dialogue) || (target === window.player) || (target.prophecies)) | |||
return; | |||
let context = [ | |||
@@ -67,7 +67,7 @@ define([ | |||
el.show(); | |||
} | |||
if ((e) && (e.button == 2) && (this.target)) | |||
if ((e) && (e.button === 2) && (this.target)) | |||
this.onContextMenu(e); | |||
}, | |||
@@ -93,7 +93,7 @@ define([ | |||
let stats = target.stats.values; | |||
if (stats.level != this.lastLevel) { | |||
if (stats.level !== this.lastLevel) { | |||
this.el.find('.infoLevel') | |||
.html('(' + stats.level + ')') | |||
.removeClass('high-level'); | |||
@@ -103,12 +103,12 @@ define([ | |||
this.el.find('.infoLevel').addClass('high-level'); | |||
} | |||
if (stats.hp != this.lastHp) { | |||
if (stats.hp !== this.lastHp) { | |||
this.buildBar(0, stats.hp, stats.hpMax); | |||
this.lastHp = stats.hp; | |||
} | |||
if (stats.mana != this.lastMana) { | |||
if (stats.mana !== this.lastMana) { | |||
this.buildBar(1, stats.mana, stats.manaMax); | |||
this.lastMana = stats.mana; | |||
} | |||
@@ -35,7 +35,7 @@ define([ | |||
html = '<font class="color-red">' + html + '</font>'; | |||
if (mob.aggro) { | |||
//TODO: Figure this out some other wayh since factions interact in different ways now | |||
if (mob.aggro.faction != window.player.aggro.faction) | |||
if (mob.aggro.faction !== window.player.aggro.faction) | |||
html += '<br />aggressive'; | |||
} | |||
html += '<br />hp: ' + Math.floor(mob.stats.values.hp) + '/' + Math.floor(mob.stats.values.hpMax); | |||
@@ -54,9 +54,9 @@ define([ | |||
this.el.hide(); | |||
} else { | |||
let values = mob.stats.values; | |||
if (values.hp != this.lastHp) | |||
if (values.hp !== this.lastHp) | |||
this.onMobHover(mob); | |||
else if (values.hpMax != this.lastHpMax) | |||
else if (values.hpMax !== this.lastHpMax) | |||
this.onMobHover(mob); | |||
} | |||
} | |||
@@ -53,9 +53,9 @@ define([ | |||
if ( | |||
(!this.item) || | |||
( | |||
(this.item != item) && | |||
(this.item !== item) && | |||
(this.item.refItem) && | |||
(this.item.refItem != item) | |||
(this.item.refItem !== item) | |||
) | |||
) | |||
return; | |||
@@ -73,9 +73,9 @@ define([ | |||
if ((compare) && (shiftDown)) { | |||
if (!item.eq) { | |||
let compareStats = compare.stats; | |||
for (var s in tempStats) { | |||
for (let s in tempStats) { | |||
if (compareStats[s]) { | |||
var delta = tempStats[s] - compareStats[s]; | |||
let delta = tempStats[s] - compareStats[s]; | |||
if (delta > 0) | |||
tempStats[s] = '+' + delta; | |||
else if (delta < 0) | |||
@@ -83,7 +83,7 @@ define([ | |||
} else | |||
tempStats[s] = '+' + tempStats[s]; | |||
} | |||
for (var s in compareStats) { | |||
for (let s in compareStats) { | |||
if (!tempStats[s]) | |||
tempStats[s] = -compareStats[s]; | |||
} | |||
@@ -102,7 +102,7 @@ define([ | |||
stats = Object.keys(tempStats) | |||
.map(function (s) { | |||
let isEnchanted = (s[0] == '_'); | |||
let isEnchanted = (s[0] === '_'); | |||
let statName = s; | |||
if (isEnchanted) | |||
statName = statName.substr(1); | |||
@@ -112,7 +112,7 @@ define([ | |||
if (percentageStats.indexOf(s) > -1) | |||
value += '%'; | |||
else if ((s.indexOf('element') == 0) && (s.indexOf('Resist') == -1)) | |||
else if ((s.indexOf('element') === 0) && (s.indexOf('Resist') === -1)) | |||
value += '%'; | |||
let row = value + ' ' + statName; | |||
@@ -135,9 +135,9 @@ define([ | |||
return (a.replace(' enchanted', '').length - b.replace(' enchanted', '').length); | |||
}) | |||
.sort(function (a, b) { | |||
if ((a.indexOf('enchanted') > -1) && (b.indexOf('enchanted') == -1)) | |||
if ((a.indexOf('enchanted') > -1) && (b.indexOf('enchanted') === -1)) | |||
return 1; | |||
else if ((a.indexOf('enchanted') == -1) && (b.indexOf('enchanted') > -1)) | |||
else if ((a.indexOf('enchanted') === -1) && (b.indexOf('enchanted') > -1)) | |||
return -1; | |||
return 0; | |||
}) | |||
@@ -150,7 +150,7 @@ define([ | |||
if (percentageStats.indexOf(stat) > -1) | |||
value += '%'; | |||
else if ((stat.indexOf('element') == 0) && (stat.indexOf('Resist') == -1)) | |||
else if ((stat.indexOf('element') === 0) && (stat.indexOf('Resist') === -1)) | |||
value += '%'; | |||
let row = value + ' ' + statName; | |||
@@ -190,7 +190,7 @@ define([ | |||
let abilityValues = ''; | |||
for (let p in item.spell.values) { | |||
if ((compare) && (shiftDown)) { | |||
var delta = item.spell.values[p] - compare.spell.values[p]; | |||
let delta = item.spell.values[p] - compare.spell.values[p]; | |||
// adjust by EPSILON to handle float point imprecision, otherwise 3.15 - 2 = 1.14 or 2 - 3.15 = -1.14 | |||
// have to move away from zero by EPSILON, not a simple add | |||
if (delta >= 0) | |||
@@ -238,7 +238,7 @@ define([ | |||
if ((!item.stats) || (!Object.keys(item.stats).length)) | |||
this.tooltip.children('.stats').hide(); | |||
if ((!item.type) || (item.type == item.name)) | |||
if ((!item.type) || (item.type === item.name)) | |||
this.tooltip.find('.type').hide(); | |||
else { | |||
this.tooltip.find('.type') | |||
@@ -285,7 +285,7 @@ define([ | |||
this.tooltip.find('.worth').html(item.worthText ? ('<br />value: ' + item.worthText) : ''); | |||
if ((item.effects) && (item.type != 'mtx')) { | |||
if ((item.effects) && (item.type !== 'mtx')) { | |||
let htmlEffects = ''; | |||
item.effects.forEach(function (e, i) { | |||
@@ -304,7 +304,7 @@ define([ | |||
} else | |||
this.find('.effects').hide(); | |||
if (item.type == 'Reward Card') { | |||
if (item.type === 'Reward Card') { | |||
this.find('.spellName') | |||
.html('Set Size: ' + item.setSize) | |||
.show(); | |||
@@ -26,7 +26,7 @@ define([ | |||
}, | |||
onHideTooltip: function (el) { | |||
if (this.hoverEl != el) | |||
if (this.hoverEl !== el) | |||
return; | |||
this.hoverEl = null; | |||
@@ -58,7 +58,7 @@ define([ | |||
}); | |||
} | |||
if ((zIndex) && (zIndex != 'auto')) | |||
if ((zIndex) && (zIndex !== 'auto')) | |||
this.tooltip.css('zIndex', zIndex); | |||
else | |||
this.tooltip.css('zIndex', ''); | |||
@@ -43,17 +43,17 @@ define([ | |||
let buyItems = itemList.items; | |||
buyItems.forEach(function (item) { | |||
if ((item == this.hoverItem)) | |||
if ((item === this.hoverItem)) | |||
this.onHover(null, item); | |||
}, this); | |||
let iLen = Math.max(buyItems.length, 50); | |||
for (var i = 0; i < iLen; i++) { | |||
var item = buyItems[i]; | |||
for (let i = 0; i < iLen; i++) { | |||
let item = buyItems[i]; | |||
if (action == 'sell') { | |||
if (action === 'sell') { | |||
item = buyItems.find(function (b) { | |||
return (b.pos == i); | |||
return (b.pos === i); | |||
}); | |||
} | |||
@@ -76,9 +76,9 @@ define([ | |||
spritesheet = '../../../images/materials.png'; | |||
else if (item.quest) | |||
spritesheet = '../../../images/questItems.png'; | |||
else if (item.type == 'consumable') | |||
else if (item.type === 'consumable') | |||
spritesheet = '../../../images/consumables.png'; | |||
else if (item.type == 'skin') { | |||
else if (item.type === 'skin') { | |||
offset = 4; | |||
size = 8; | |||
if (!item.spritesheet) | |||
@@ -102,11 +102,11 @@ define([ | |||
else if (item.eq) | |||
itemEl.find('.quantity').html('EQ'); | |||
if (action == 'buy') { | |||
if (action === 'buy') { | |||
let noAfford = false; | |||
if (item.worth.currency) { | |||
let currencyItems = window.player.inventory.items.find(function (i) { | |||
return (i.name == item.worth.currency); | |||
return (i.name === item.worth.currency); | |||
}); | |||
noAfford = ((!currencyItems) || (currencyItems.quantity < item.worth.amount)); | |||
} else | |||
@@ -165,10 +165,10 @@ define([ | |||
uiInventory.onHover(el, item, e); | |||
let canAfford = true; | |||
if (action == 'buy') { | |||
if (action === 'buy') { | |||
if (item.worth.currency) { | |||
let currencyItems = window.player.inventory.items.find(function (i) { | |||
return (i.name == item.worth.currency); | |||
return (i.name === item.worth.currency); | |||
}); | |||
canAfford = ((currencyItems) && (currencyItems.quantity >= item.worth.amount)); | |||
} else | |||
@@ -41,7 +41,7 @@ define([ | |||
el.on('click', this.setPreview.bind(this, l, el)); | |||
if (l.id == window.player.skinId) { | |||
if (l.id === window.player.skinId) { | |||
el.addClass('current'); | |||
this.setPreview(l, el); | |||
} | |||
@@ -28,7 +28,8 @@ define([ | |||
if (this.modal) | |||
this.el.addClass('modal'); | |||
this.postRender && this.postRender(); | |||
if (this.postRender) | |||
this.postRender(); | |||
if (this.centered) { | |||
this.centeredX = true; | |||
@@ -65,9 +66,9 @@ define([ | |||
return this.el.find(selector); | |||
}, | |||
center: function (x, y) { | |||
if (x == null) | |||
if (x === null) | |||
x = true; | |||
if (y == null) | |||
if (y === null) | |||
y = true; | |||
this.centeredX = x; | |||
@@ -130,16 +131,16 @@ define([ | |||
}, | |||
offEvent: function (eventCallback) { | |||
for (var e in this.eventCallbacks) { | |||
for (let e in this.eventCallbacks) { | |||
this.eventCallbacks[e].forEach(function (c) { | |||
if (c == eventCallback) | |||
if (c === eventCallback) | |||
events.off(e, c); | |||
}, this); | |||
} | |||
}, | |||
offEvents: function () { | |||
for (var e in this.eventCallbacks) { | |||
for (let e in this.eventCallbacks) { | |||
this.eventCallbacks[e].forEach(function (c) { | |||
events.off(e, c); | |||
}, this); | |||
@@ -79,7 +79,7 @@ Obj.defineProperty(Array.prototype, 'spliceFirstWhere', { | |||
Obj.defineProperty(Object.prototype, 'has', { | |||
enumerable: false, | |||
value: function (prop) { | |||
return (this.hasOwnProperty(prop) && this[prop] !== null); | |||
return (this.hasOwnProperty(prop) && this[prop] !== undefined && this[prop] !== null); | |||
} | |||
}); | |||