Browse Source

it runs!

tags/v0.2.1^2
Big Bad Waffle 5 years ago
parent
commit
268cb9960c
34 changed files with 105 additions and 119 deletions
  1. +3
    -3
      .eslintrc
  2. +4
    -4
      src/server/components/aggro.js
  3. +3
    -3
      src/server/components/auth.js
  4. +1
    -1
      src/server/components/chest.js
  5. +3
    -3
      src/server/components/dialogue.js
  6. +1
    -1
      src/server/components/door.js
  7. +3
    -3
      src/server/components/effects.js
  8. +8
    -8
      src/server/components/equipment.js
  9. +0
    -1
      src/server/components/extensions/socialCommands.js
  10. +3
    -3
      src/server/components/gatherer.js
  11. +13
    -13
      src/server/components/inventory.js
  12. +4
    -4
      src/server/components/mob.js
  13. +1
    -1
      src/server/components/prophecies.js
  14. +3
    -3
      src/server/components/reputation.js
  15. +6
    -6
      src/server/components/spellbook.js
  16. +5
    -5
      src/server/components/stats.js
  17. +1
    -1
      src/server/components/syncer.js
  18. +7
    -7
      src/server/components/trade.js
  19. +1
    -1
      src/server/components/wardrobe.js
  20. +1
    -1
      src/server/config/eventPhases/phaseModifyDialogue.js
  21. +1
    -1
      src/server/config/quests/templates/questKillX.js
  22. +1
    -1
      src/server/config/spells/spellTemplate.js
  23. +1
    -1
      src/server/events/events.js
  24. +1
    -1
      src/server/items/generators/quality.js
  25. +9
    -9
      src/server/items/generators/stats.js
  26. +1
    -1
      src/server/items/salvager.js
  27. +2
    -2
      src/server/misc/pathfinder.js
  28. +3
    -3
      src/server/objects/objBase.js
  29. +5
    -18
      src/server/objects/objects.js
  30. +3
    -3
      src/server/security/connections.js
  31. +3
    -3
      src/server/world/instancer.js
  32. +2
    -2
      src/server/world/map.js
  33. +1
    -1
      src/server/world/mobBuilder.js
  34. +1
    -1
      src/server/world/spawners.js

+ 3
- 3
.eslintrc View File

@@ -88,7 +88,7 @@
"curly": [2,"multi-or-nest"],
"dot-notation": 2,
"dot-location": [2,"property"],
"eqeqeq": [2,"smart"],
"eqeqeq": [2,"smart", {"null": "ignore"}],
"no-alert": 2,
"no-caller": 2,
"no-else-return": 2,
@@ -129,8 +129,8 @@
"no-shadow-restricted-names": 2,
"no-shadow": [2,{"builtinGlobals":true,"hoist":"all"}],
"no-undef-init": 2,
"no-undef": 2,
"no-undefined": 2,
"no-undef": 1,
"no-undefined": 1,
"no-unused-vars": 1,
"no-use-before-define": 2,
"no-mixed-requires": [2,false],


+ 4
- 4
src/server/components/aggro.js View File

@@ -18,7 +18,7 @@ module.exports = {
this.faction = blueprint.faction;

//TODO: Why don't we move if faction is null?
if (this.faction === null)
if (this.faction == null)
return;

if (this.physics.width > 0)
@@ -145,7 +145,7 @@ module.exports = {
return false;

let faction = target.aggro.faction;
if ((faction === null) || (!this.faction))
if ((faction == null) || (!this.faction))
return false;

let rep = this.obj.reputation;
@@ -254,7 +254,7 @@ module.exports = {
if (l.obj !== obj)
continue;

if (amount === null) {
if (amount == null) {
list.splice(i, 1);
obj.aggro.unAggro(this.obj);
break;
@@ -305,7 +305,7 @@ module.exports = {
if (this.ignoreList.some(o => o === obj))
continue;

if ((highest === null) || (l.threat > highest.threat)) {
if ((highest == null) || (l.threat > highest.threat)) {
highest = l;
closest = Math.max(Math.abs(x - obj.x), Math.abs(y - obj.y));
} else if (l.threat === highest.threat) {


+ 3
- 3
src/server/components/auth.js View File

@@ -23,7 +23,7 @@ module.exports = {
customChannels: [],

play: function (data) {
if (this.username === null)
if (this.username == null)
return;

let character = this.characters[data.data.name];
@@ -169,7 +169,7 @@ module.exports = {
},

getCharacterList: function (data) {
if (this.username === null)
if (this.username == null)
return;

io.get({
@@ -269,7 +269,7 @@ module.exports = {

fixes.fixStash(this.stash);

if (this.skins !== null) {
if (this.skins != null) {
this.verifySkin(character);
data.callback(character);
} else {


+ 1
- 1
src/server/components/chest.js View File

@@ -6,7 +6,7 @@ module.exports = {
ttl: -1,

init: function (blueprint) {
if (blueprint.ownerId !== null)
if (blueprint.ownerId != null)
this.ownerId = blueprint.ownerId;

if (blueprint.ttl)


+ 3
- 3
src/server/components/dialogue.js View File

@@ -21,14 +21,14 @@ module.exports = {

let target = msg.target;

if ((target === null) && (!msg.targetName))
if ((target == null) && (!msg.targetName))
return false;

if ((target !== null) && (target.id === null)) {
if ((target != null) && (target.id == null)) {
target = this.obj.instance.objects.objects.find(o => o.id === target);
if (!target)
return false;
} else if (msg.targetName !== null) {
} else if (msg.targetName != null) {
target = this.obj.instance.objects.objects.find(o => ((o.name) && (o.name.toLowerCase() === msg.targetName.toLowerCase())));
if (!target)
return false;


+ 1
- 1
src/server/components/door.js View File

@@ -99,7 +99,7 @@ module.exports = {
},

unlock: function (msg) {
if (msg.sourceId === null)
if (msg.sourceId == null)
return;

let obj = this.obj.instance.objects.objects.find(o => o.serverId === msg.sourceId);


+ 3
- 3
src/server/components/effects.js View File

@@ -37,7 +37,7 @@ module.exports = {
type: 'effects',
effects: this.effects
.map(e => e.save())
.filter(e => e !== null)
.filter(e => e != null)
};

return e;
@@ -52,7 +52,7 @@ module.exports = {
if ((effects.length > 0) && (effects[0].obj)) {
effects = effects
.map(e => e.simplify())
.filter(e => e !== null);
.filter(e => e != null);
}
e.effects = effects;

@@ -115,7 +115,7 @@ module.exports = {
},

canApplyEffect: function (type) {
if (this.ccResistances[type] === null)
if (this.ccResistances[type] == null)
return true;

let ccResistances = this.ccResistances;


+ 8
- 8
src/server/components/equipment.js View File

@@ -40,7 +40,7 @@ module.exports = {
}

let currentEqId = this.eq[item.slot];
if (currentEqId === null) {
if (currentEqId == null) {
this.equip(itemId);
return true;
}
@@ -65,15 +65,15 @@ module.exports = {
slot = item.equipSlot || item.slot;
if (slot === 'twoHanded') {
let currentEqId = this.eq.offHand;
if (currentEqId !== null)
if (currentEqId != null)
this.unequip(currentEqId);

slot = 'oneHanded';
} else if (slot === 'offHand') {
let currentEqId = this.eq.oneHanded;
if (currentEqId !== null) {
if (currentEqId != null) {
let currentEq = this.obj.inventory.findItem(currentEqId);
if ((currentEq !== null) && (currentEq.slot === 'twoHanded'))
if ((currentEq != null) && (currentEq.slot === 'twoHanded'))
this.unequip(currentEqId);
}
}
@@ -100,8 +100,8 @@ module.exports = {
this.obj.syncer.setArray(true, 'inventory', 'getItems', item);

if (slot === 'finger') {
let f1 = (this.eq['finger-1'] !== null);
let f2 = (this.eq['finger-2'] !== null);
let f1 = (this.eq['finger-1'] != null);
let f2 = (this.eq['finger-2'] != null);

if ((f1) && (f2))
slot = 'finger-1';
@@ -116,7 +116,7 @@ module.exports = {
let currentEq = this.obj.inventory.findItem(currentEqId);
if (currentEq === item)
return;
if (currentEqId !== null) {
if (currentEqId != null) {
spellId = currentEq.spellId;
this.unequip(currentEqId);
}
@@ -185,7 +185,7 @@ module.exports = {
itemId = itemId.itemId;
}

if (item.id === null)
if (item.id == null)
item = this.obj.inventory.findItem(itemId);

if (!item)


+ 0
- 1
src/server/components/extensions/socialCommands.js View File

@@ -151,7 +151,6 @@ module.exports = {
return;
}

let channels = obj.auth.customChannels;
channels.spliceWhere(c => (c === value));

let charname = obj.auth.charname;


+ 3
- 3
src/server/components/gatherer.js View File

@@ -16,7 +16,7 @@ module.exports = {
},

gather: function () {
if (this.gathering !== null)
if (this.gathering != null)
return;

let nodes = this.nodes;
@@ -230,7 +230,7 @@ module.exports = {
let success = true;
if (nodeType === 'fish') {
let rod = this.obj.equipment.eq.tool;
if (rod === null) {
if (rod == null) {
success = false;
msg = 'You need a fishing rod to fish';
}
@@ -289,7 +289,7 @@ module.exports = {

if (node.resourceNode.nodeType === 'fish') {
let rod = this.obj.equipment.eq.tool;
if (rod === null) {
if (rod == null) {
process.send({
method: 'events',
data: {


+ 13
- 13
src/server/components/inventory.js View File

@@ -24,8 +24,8 @@ module.exports = {

//Spells should be sorted so they're EQ'd in the right order
items.sort(function (a, b) {
let aId = (a.spellId !== null) ? ~~a.spellId : 9999;
let bId = (b.spellId !== null) ? ~~b.spellId : 9999;
let aId = (a.spellId != null) ? ~~a.spellId : 9999;
let bId = (b.spellId != null) ? ~~b.spellId : 9999;
return (aId - bId);
});

@@ -153,7 +153,7 @@ module.exports = {
},

learnAbility: function (itemId, runeSlot) {
if (itemId.itemId !== null) {
if (itemId.itemId != null) {
let msg = itemId;
itemId = msg.itemId;
runeSlot = msg.slot;
@@ -193,7 +193,7 @@ module.exports = {

if ((item.slot === 'twoHanded') || (item.slot === 'oneHanded'))
runeSlot = 0;
else if (runeSlot === null) {
else if (runeSlot == null) {
runeSlot = 4;
for (let i = 1; i <= 4; i++) {
if (!this.items.some(j => (j.runeSlot === i))) {
@@ -309,7 +309,7 @@ module.exports = {
},

unlearnAbility: function (itemId) {
if (itemId.itemId !== null)
if (itemId.itemId != null)
itemId = itemId.itemId;

let item = this.findItem(itemId);
@@ -496,7 +496,7 @@ module.exports = {
});
}

if ((item.pos === null) && (!item.eq)) {
if ((item.pos == null) && (!item.eq)) {
let pos = i;
for (let j = 0; j < iLen; j++) {
if (!items.some(fj => (fj.pos === j))) {
@@ -533,10 +533,10 @@ module.exports = {
},

resolveCallback: function (msg, result) {
let callbackId = (msg.callbackId !== null) ? msg.callbackId : msg;
let callbackId = (msg.callbackId != null) ? msg.callbackId : msg;
result = result || [];

if (callbackId === null)
if (callbackId == null)
return;

process.send({
@@ -550,7 +550,7 @@ module.exports = {
},

findItem: function (id) {
if (id === null)
if (id == null)
return null;

return this.items.find(i => i.id === id);
@@ -561,7 +561,7 @@ module.exports = {
return (
(i.spell) &&
(i.spell.rolls) &&
(i.spell.rolls.damage !== null) &&
(i.spell.rolls.damage != null) &&
((i.slot === 'twoHanded') || (i.slot === 'oneHanded'))
);
});
@@ -599,7 +599,7 @@ module.exports = {
},

createBag: function (x, y, items, ownerId) {
if (ownerId === null)
if (ownerId == null)
ownerId = -1;

let bagCell = 50;
@@ -656,7 +656,7 @@ module.exports = {
//We need to know if a mob dropped it for quest purposes
let fromMob = item.fromMob;

if (item.quality === null)
if (item.quality == null)
item.quality = 0;

//Players can't have fromMob items in their inventory but bags can (dropped by a mob)
@@ -713,7 +713,7 @@ module.exports = {
if (item.eq)
delete item.pos;

if ((item.pos === null) && (!item.eq)) {
if ((item.pos == null) && (!item.eq)) {
let pos = iLen;
for (let i = 0; i < iLen; i++) {
if (!items.some(fi => (fi.pos === i))) {


+ 4
- 4
src/server/components/mob.js View File

@@ -140,7 +140,7 @@ module.exports = {
target: target
});
//null means we don't have LoS
if (success !== null)
if (success != null)
return;
hasLos = false;
} else
@@ -159,17 +159,17 @@ module.exports = {
let newDistance = max(abs(targetPos.x - tx), abs(targetPos.y - ty));

if ((newDistance >= distance) && (newDistance > furthestRange)) {
if (hasLos === null)
if (hasLos == null)
hasLos = this.physics.hasLos(x, y, tx, ty);
if (hasLos) {
if (doesCollide === null)
if (doesCollide == null)
doesCollide = this.physics.mobsCollide(x, y, obj);
if (!doesCollide) {
obj.aggro.ignore(target);
return;
}
} else {
if (doesCollide === null)
if (doesCollide == null)
doesCollide = this.physics.mobsCollide(x, y, obj);
if (!doesCollide) {
obj.aggro.ignore(target);


+ 1
- 1
src/server/components/prophecies.js View File

@@ -12,7 +12,7 @@ module.exports = {
console.log(e);
}

if (template === null)
if (template == null)
return;
else if (this.list.some(l => (l.type === p)))
return;


+ 3
- 3
src/server/components/reputation.js View File

@@ -36,7 +36,7 @@ module.exports = {
factionBlueprint = factions.getFaction(factionId);
} catch (e) {}

if (factionBlueprint === null) {
if (factionBlueprint == null) {
console.log('No faction blueprint found');
return;
}
@@ -100,7 +100,7 @@ module.exports = {
},

getReputation: function (factionId, gain) {
let fullSync = (this.factions[factionId] === null);
let fullSync = (this.factions[factionId] == null);
let blueprint = this.getBlueprint(factionId);

let faction = this.list.find(l => l.id === factionId);
@@ -154,7 +154,7 @@ module.exports = {
if (this.list.some(l => l.id === factionId))
return;

let fullSync = (this.factions[factionId] === null);
let fullSync = (this.factions[factionId] == null);
let blueprint = this.getBlueprint(factionId);

if (!blueprint)


+ 6
- 6
src/server/components/spellbook.js View File

@@ -121,7 +121,7 @@ module.exports = {
if ((this.furthestRange === -1) || (builtSpell.range > this.furthestRange))
this.furthestRange = builtSpell.range;

if ((options.id === null) && (spellId === null)) {
if ((options.id == null) && (spellId == null)) {
spellId = 0;
this.spells.forEach(function (s) {
if (s.id >= spellId)
@@ -129,7 +129,7 @@ module.exports = {
});
}

builtSpell.id = (options.id === null) ? spellId : options.id;
builtSpell.id = (options.id == null) ? spellId : options.id;
this.spells.push(builtSpell);
this.spells.sort(function (a, b) {
return (a.id - b.id);
@@ -244,7 +244,7 @@ module.exports = {
return null;
},
cast: function (action, isAuto) {
if (action.spell === null) {
if (action.spell == null) {
this.auto = [];
return true;
}
@@ -267,7 +267,7 @@ module.exports = {

if ((!spell.aura) && (!spell.targetGround)) {
//Did we pass in the target id?
if ((action.target !== null) && (action.target.id === null)) {
if ((action.target != null) && (action.target.id == null)) {
action.target = this.objects.objects.find(o => o.id === action.target);
if (!action.target)
return false;
@@ -276,7 +276,7 @@ module.exports = {
if ((action.target === this.obj) && (spell.noTargetSelf))
action.target = null;

if ((action.target === null) || (!action.target.player)) {
if ((action.target == null) || (!action.target.player)) {
if (spell.autoTargetFollower) {
action.target = this.spells.find(s => (s.minions) && (s.minions.length > 0));
if (action.target)
@@ -326,7 +326,7 @@ module.exports = {
} else
this.obj.stats.addStat('manaReservePercent', -reserve.percentage);
}
} else if (spell.range !== null) {
} else if (spell.range != null) {
//Distance Check
let fromX = this.obj.x;
let fromY = this.obj.y;


+ 5
- 5
src/server/components/stats.js View File

@@ -483,9 +483,9 @@ module.exports = {

this.values.hp -= amount;
let recipients = [];
if (this.obj.serverId !== null)
if (this.obj.serverId != null)
recipients.push(this.obj.serverId);
if (source.serverId !== null)
if (source.serverId != null)
recipients.push(source.serverId);
if ((source.follower) && (source.follower.master.serverId))
recipients.push(source.follower.master.serverId);
@@ -573,7 +573,7 @@ module.exports = {
for (let i = 0; i < aLen; i++) {
let a = aggroList[i];

if ((!a.threat) || (a.obj.serverId === null))
if ((!a.threat) || (a.obj.serverId == null))
continue;

this.obj.inventory.dropBag(a.obj.serverId, killSource);
@@ -613,9 +613,9 @@ module.exports = {
values.hp = hpMax;

let recipients = [];
if (this.obj.serverId !== null)
if (this.obj.serverId != null)
recipients.push(this.obj.serverId);
if (source.serverId !== null)
if (source.serverId != null)
recipients.push(source.serverId);
if (recipients.length > 0) {
this.syncer.queue('onGetDamage', {


+ 1
- 1
src/server/components/syncer.js View File

@@ -98,7 +98,7 @@ module.exports = {
if (self)
o = this.oSelf;

if (o[property] === null)
if (o[property] == null)
o[property] = [];

o[property].push(value);


+ 7
- 7
src/server/components/trade.js View File

@@ -80,10 +80,10 @@ module.exports = {
startBuy: function (msg) {
let target = msg.target;

if ((target === null) && (!msg.targetName))
if ((target == null) && (!msg.targetName))
return false;

if ((target !== null) && (target.id === null))
if ((target != null) && (target.id == null))
target = this.obj.instance.objects.objects.find(o => o.id === target);
else if (msg.targetName)
target = this.obj.instance.objects.objects.find(o => ((o.name) && (o.name.toLowerCase() === msg.targetName.toLowerCase())));
@@ -276,12 +276,12 @@ module.exports = {
let target = msg.target;
let targetName = (msg.targetName || '').toLowerCase();

if ((target === null) && (!targetName))
if ((target == null) && (!targetName))
return false;

if ((target !== null) && (target.id === null))
if ((target != null) && (target.id == null))
target = this.obj.instance.objects.objects.find(o => o.id === target);
else if (targetName !== null)
else if (targetName != null)
target = this.obj.instance.objects.objects.find(o => ((o.name) && (o.name.toLowerCase() === targetName)));

this.target = null;
@@ -380,10 +380,10 @@ module.exports = {
},

resolveCallback: function (msg, result) {
let callbackId = (msg.callbackId !== null) ? msg.callbackId : msg;
let callbackId = (msg.callbackId != null) ? msg.callbackId : msg;
result = result || [];

if (callbackId === null)
if (callbackId == null)
return;

process.send({


+ 1
- 1
src/server/components/wardrobe.js View File

@@ -68,7 +68,7 @@ module.exports = {
},

open: function (msg) {
if (msg.sourceId === null)
if (msg.sourceId == null)
return;

let obj = this.obj.instance.objects.objects.find(o => o.serverId === msg.sourceId);


+ 1
- 1
src/server/config/eventPhases/phaseModifyDialogue.js View File

@@ -30,7 +30,7 @@ module.exports = {

if (!target)
continue;
else if (source === null) {
else if (source == null) {
delete dialogue[s];
continue;
}


+ 1
- 1
src/server/config/quests/templates/questKillX.js View File

@@ -27,7 +27,7 @@ module.exports = {
(m !== 'default') &&
(
(mobBlueprint.attackable) ||
(mobBlueprint.attackable === null)
(mobBlueprint.attackable == null)
) &&
(mobBlueprint.level <= ~~(this.obj.stats.values.level * 1.35)) &&
(mobCounts[m] > 1)


+ 1
- 1
src/server/config/spells/spellTemplate.js View File

@@ -28,7 +28,7 @@ module.exports = {
return true;
let inRange = true;
if (this.range !== null) {
if (this.range != null) {
let obj = this.obj;
let distance = Math.max(Math.abs(target.x - obj.x), Math.abs(target.y - obj.y));
inRange = (distance <= this.range);


+ 1
- 1
src/server/events/events.js View File

@@ -211,7 +211,7 @@ module.exports = {
}
}, -1);

if (n.desc !== null) {
if (n.desc != null) {
event.config.descTimer = n.desc;
this.setEventDescription(event.config.name);
}


+ 1
- 1
src/server/items/generators/quality.js View File

@@ -10,7 +10,7 @@ module.exports = {
magicFindMult: 7,

generate: function (item, blueprint) {
if (blueprint.quality !== null) {
if (blueprint.quality != null) {
item.quality = ~~blueprint.quality;
return;
}


+ 9
- 9
src/server/items/generators/stats.js View File

@@ -7,7 +7,7 @@ module.exports = {

if (calcPerfection)
return (calcPerfection / max);
else if (perfection === null)
else if (perfection == null)
return random.norm(1, max) * (blueprint.statMult.elementDmgPercent || 1);
return max * perfection * (blueprint.statMult.elementDmgPercent || 1);
},
@@ -21,7 +21,7 @@ module.exports = {

if (calcPerfection)
return (calcPerfection / max);
else if (perfection === null)
else if (perfection == null)
return random.norm(1, max) * (blueprint.statMult.addCritMultiplier || 1);
return max * perfection * (blueprint.statMult.addCritMultiplier || 1);
},
@@ -35,7 +35,7 @@ module.exports = {

if (calcPerfection)
return (calcPerfection / max);
else if (perfection === null)
else if (perfection == null)
return random.norm(1, max) * (blueprint.statMult.addCritChance || 1);
return max * perfection * (blueprint.statMult.addCritChance || 1);
},
@@ -49,7 +49,7 @@ module.exports = {

if (calcPerfection)
return (calcPerfection / max);
else if (perfection === null)
else if (perfection == null)
return random.norm(1, max) * (blueprint.statMult.vit || 1);
return max * perfection * (blueprint.statMult.vit || 1);
},
@@ -64,7 +64,7 @@ module.exports = {

if (calcPerfection)
return ((calcPerfection - min) / (max - min));
else if (perfection === null)
else if (perfection == null)
return random.norm(min, max) * (blueprint.statMult.mainStat || 1);
return (min + ((max - min) * perfection)) * (blueprint.statMult.mainStat || 1);
},
@@ -74,7 +74,7 @@ module.exports = {

if (calcPerfection)
return ((calcPerfection - min) / (max - min));
else if (perfection === null)
else if (perfection == null)
return random.norm(min, max) * blueprint.statMult.armor;
return (min + ((max - min) * perfection)) * (blueprint.statMult.armor || 1);
},
@@ -85,7 +85,7 @@ module.exports = {

if (calcPerfection)
return (calcPerfection / (100 * div));
else if (perfection === null)
else if (perfection == null)
return random.norm(1, 100) * (blueprint.statMult.elementResist || 1) * div;
return ~~((1 + (99 * perfection)) * (blueprint.statMult.elementResist || 1) * div);
},
@@ -98,7 +98,7 @@ module.exports = {

if (calcPerfection)
return (calcPerfection / max);
else if (perfection === null)
else if (perfection == null)
return random.norm(1, max) * (blueprint.statMult.regenHp || 1);
return max * perfection * (blueprint.statMult.regenHp || 1);
},
@@ -107,7 +107,7 @@ module.exports = {

if (calcPerfection)
return (calcPerfection / max);
else if (perfection === null)
else if (perfection == null)
return random.norm(1, max) * (blueprint.statMult.lvlRequire || 1);
return max * perfection * (blueprint.statMult.lvlRequire || 1);
}


+ 1
- 1
src/server/items/salvager.js View File

@@ -146,7 +146,7 @@ module.exports = {
if (m.qualityName) {
newItem.quality = item.quality;
newItem.name = m.qualityName[item.quality];
} else if (m.quality !== null)
} else if (m.quality != null)
newItem.quality = m.quality;

newItem.sprite = materialItems[newItem.name].sprite;


+ 2
- 2
src/server/misc/pathfinder.js View File

@@ -406,13 +406,13 @@
if (child2N < length) {
var child2 = this.content[child2N];
var child2Score = this.scoreFunction(child2);
if (child2Score < (swap === null ? elemScore : child1Score)) {
if (child2Score < (swap == null ? elemScore : child1Score)) {
swap = child2N;
}
}

// If the element needs to be moved, swap it, and continue.
if (swap !== null) {
if (swap != null) {
this.content[n] = this.content[swap];
this.content[swap] = element;
n = swap;


+ 3
- 3
src/server/objects/objBase.js View File

@@ -22,7 +22,7 @@ module.exports = {
this[cpn.type] = cpn;
}

if ((cpn.init) && (this.instance !== null))
if ((cpn.init) && (this.instance != null))
cpn.init(blueprint || {}, isTransfer);
else {
for (let p in blueprint)
@@ -103,7 +103,7 @@ module.exports = {

for (let p in o) {
let value = o[p];
if (value === null)
if (value == null)
continue;

let type = typeof (value);
@@ -186,7 +186,7 @@ module.exports = {
return this.actionQueue.splice(0, 1)[0];
},
clearQueue: function () {
if (this.serverId !== null) {
if (this.serverId != null) {
this.instance.syncer.queue('onClearQueue', {
id: this.id
}, [this.serverId]);


+ 5
- 18
src/server/objects/objects.js View File

@@ -144,24 +144,9 @@ module.exports = {
},

removeObject: function (obj, callback, useServerId) {
let objects = this.objects;
let oLen = objects.length;
let found = null;
for (let i = 0; i < oLen; i++) {
let o = objects[i];
let match = false;
if (useServerId)
match = (o.serverId === obj.id);
else
match = (o.id === obj.id);

if (match) {
o.destroy();
found = o;
objects.splice(i, 1);
break;
}
}
let found = this.objects.spliceFirstWhere(o => obj.id === (useServerId ? o.serverId : o.id));
if (!found)
return;

let physics = this.physics;
if (physics) {
@@ -171,6 +156,8 @@ module.exports = {
physics.removeRegion(found);
}

found.destroy();

if (callback)
callback(found);
},


+ 3
- 3
src/server/security/connections.js View File

@@ -19,7 +19,7 @@ module.exports = {

let sessionDuration = 0;

if (player.id !== null) {
if (player.id != null) {
if (player.social)
player.social.dc();
sessionDuration = ~~(((+new Date()) - player.player.sessionStart) / 1000);
@@ -49,7 +49,7 @@ module.exports = {
route: function (socket, msg) {
let player = null;

if (msg.id !== null) {
if (msg.id != null) {
player = this.players.find(p => p.id === msg.id);
let source = this.players.find(p => p.socket.id === socket.id);
if (!source)
@@ -94,7 +94,7 @@ module.exports = {
let keys = Object.keys(player);
keys.forEach(function (k) {
let val = player[k];
if ((val !== null) && (typeof (val) === 'object') && (val.type)) {
if ((val != null) && (typeof (val) === 'object') && (val.type)) {
let type = val.type;
if ((type !== 'player') && (type !== 'auth') && (type !== 'syncer'))
delete player[k];


+ 3
- 3
src/server/world/instancer.js View File

@@ -108,7 +108,7 @@ module.exports = {

let spawnPos = map.getSpawnPos(obj);

if ((!msg.keepPos) || (obj.x === null)) {
if ((!msg.keepPos) || (obj.x == null)) {
obj.x = spawnPos.x;
obj.y = spawnPos.y;
}
@@ -245,7 +245,7 @@ module.exports = {

instance.syncer.update();

if (instance.closeTtl !== null) {
if (instance.closeTtl != null) {
let hasPlayers = instance.objects.objects.some(o => o.player);
if (hasPlayers) {
delete instance.closeTtl;
@@ -310,7 +310,7 @@ module.exports = {
if (exists)
spawnPos = exists.map.getSpawnPos(obj);

if ((!msg.keepPos) || (obj.x === null)) {
if ((!msg.keepPos) || (obj.x == null)) {
obj.x = spawnPos.x;
obj.y = spawnPos.y;
}


+ 2
- 2
src/server/world/map.js View File

@@ -210,7 +210,7 @@ module.exports = {

let data = layer.data || layer.objects;
let firstItem = data[0];
if ((firstItem) && (firstItem.width !== null)) {
if ((firstItem) && (firstItem.width != null)) {
let info = {
map: this.name,
layer: layerName,
@@ -292,7 +292,7 @@ module.exports = {
let layer = this.layers;
if (this.oldLayers[layerName])
this.oldLayers[layerName][x][y] = cell;
layer[x][y] = (layer[x][y] === null) ? cell : layer[x][y] + ',' + cell;
layer[x][y] = (layer[x][y] == null) ? cell : layer[x][y] + ',' + cell;
} else if (layerName === 'hiddenWalls')
this.hiddenWalls[x][y] = cell;
else if (layerName === 'hiddenTiles')


+ 1
- 1
src/server/world/mobBuilder.js View File

@@ -29,7 +29,7 @@ module.exports = {

if (typeDefinition.sheetName)
mob.sheetName = typeDefinition.sheetName;
if (typeDefinition.cell !== null)
if (typeDefinition.cell != null)
mob.cell = typeDefinition.cell;
}
}


+ 1
- 1
src/server/world/spawners.js View File

@@ -170,7 +170,7 @@ module.exports = {
if (!l.zonePrint)
return;

if (l.zonePrint.level !== null)
if (l.zonePrint.level != null)
l.zonePrint.level = level;

if ((!l.mob) || (l.mob.destroyed))


Loading…
Cancel
Save