Browse Source

fixed some linting issues

tags/v0.5
Shaun Kichenbrand 4 years ago
parent
commit
9992a7f323
10 changed files with 1148 additions and 29 deletions
  1. +0
    -0
      src/server/.eslintrc
  2. +0
    -1
      src/server/components/gatherer.js
  3. +0
    -1
      src/server/components/inventory.js
  4. +14
    -10
      src/server/components/inventory/getItem.js
  5. +14
    -11
      src/server/components/mob.js
  6. +0
    -2
      src/server/components/social/startEvent.js
  7. +0
    -2
      src/server/components/social/stopEvent.js
  8. +1117
    -0
      src/server/package-lock.json
  9. +3
    -0
      src/server/package.json
  10. +0
    -2
      src/server/world/map.js

.eslintrc → src/server/.eslintrc View File


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

@@ -1,5 +1,4 @@
let qualityGenerator = require('../items/generators/quality');
let { isItemStackable } = require('./inventory/helpers');

module.exports = {
type: 'gatherer',


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

@@ -358,7 +358,6 @@ module.exports = {
let messages = [];
let items = salvager.salvage(item);
let materialDrop = [];
this.destroyItem(id);


+ 14
- 10
src/server/components/inventory/getItem.js View File

@@ -14,6 +14,17 @@ const getNextId = items => {
return id;
};

const dropBagForOverflow = (cpnInv, item) => {
const { obj: { x, y, name, instance } } = cpnInv;

const dropCell = instance.physics.getOpenCellInArea(x - 1, y - 1, x + 1, y + 1);
if (dropCell) {
cpnInv.createBag(dropCell.x, dropCell.y, [item], name);
const msg = `Your inventory is too full to receive (${item.name}). It has been dropped on the ground.`;
cpnInv.notifyNoBagSpace(msg);
}
};

module.exports = (cpnInv, item, hideMessage, noStack, hideAlert, createBagIfFull = false) => {
const obj = cpnInv.obj;
obj.instance.eventEmitter.emit('onBeforeGetItem', item, obj);
@@ -44,16 +55,9 @@ module.exports = (cpnInv, item, hideMessage, noStack, hideAlert, createBagIfFull
//Get next id
if (!exists) {
if (!cpnInv.hasSpace(item)) {
if (createBagIfFull) {
const { x, y, name, instance } = obj;

const dropCell = instance.physics.getOpenCellInArea(x - 1, y - 1, x + 1, y + 1);
if (dropCell) {
cpnInv.createBag(dropCell.x, dropCell.y, [item], name);
const msg = `Your inventory is too full to receive (${item.name}). It has been dropped on the ground.`;
cpnInv.notifyNoBagSpace(msg);
}
} else if (!hideMessage)
if (createBagIfFull)
dropBagForOverflow(cpnInv, item);
else if (!hideMessage)
cpnInv.notifyNoBagSpace();

return false;


+ 14
- 11
src/server/components/mob.js View File

@@ -4,6 +4,18 @@ let max = Math.max.bind(Math);

const canPathHome = require('./mob/canPathHome');

const teleportHome = (physics, obj, mob) => {
physics.removeObject(obj, obj.x, obj.y);
obj.x = mob.originX;
obj.y = mob.originY;
const syncer = obj.syncer;
syncer.o.x = obj.x;
syncer.o.y = obj.y;
physics.addObject(obj, obj.x, obj.y);
obj.aggro.clearIgnoreList();
obj.aggro.move();
};

module.exports = {
type: 'mob',

@@ -72,17 +84,8 @@ module.exports = {

if (canPathHome(this))
this.goHome = true;
else {
this.physics.removeObject(obj, obj.x, obj.y);
obj.x = this.originX;
obj.y = this.originY;
const syncer = obj.syncer;
syncer.o.x = obj.x;
syncer.o.y = obj.y;
this.physics.addObject(obj, obj.x, obj.y);
obj.aggro.clearIgnoreList();
obj.aggro.move();
}
else
teleportHome(this.physics, obj, this);
}
}



+ 0
- 2
src/server/components/social/startEvent.js View File

@@ -1,6 +1,4 @@
module.exports = async (cpnSocial, eventName) => {
const { obj } = cpnSocial;

atlas.messageAllThreads({
threadModule: 'eventManager',
method: 'startEventByCode',


+ 0
- 2
src/server/components/social/stopEvent.js View File

@@ -1,6 +1,4 @@
module.exports = async (cpnSocial, eventName) => {
const { obj } = cpnSocial;

atlas.messageAllThreads({
threadModule: 'eventManager',
method: 'stopEventByCode',


+ 1117
- 0
src/server/package-lock.json
File diff suppressed because it is too large
View File


+ 3
- 0
src/server/package.json View File

@@ -14,6 +14,9 @@
"universal-analytics": "^0.4.20"
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-plugin-prettier": "^3.1.2",
"sqlite3": "^4.1.0"
}
}

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

@@ -333,8 +333,6 @@ module.exports = {
}

let cellInfo = this.builders.getCellInfo(cell);
if (!cellInfo.sheetName)
console.log(x, y, cell);
let sheetName = cellInfo.sheetName;
cell = cellInfo.cell;
if (sheetName === 'walls')


Loading…
Cancel
Save