Browse Source

chore #1811

tags/v0.10.0^2
Shaun 2 years ago
parent
commit
da7a9918eb
9 changed files with 14 additions and 29 deletions
  1. +3
    -3
      src/server/components/gatherer.js
  2. +2
    -2
      src/server/components/passives.js
  3. +2
    -2
      src/server/components/player.js
  4. +3
    -3
      src/server/components/stats.js
  5. +1
    -1
      src/server/config/quests/templates/questTemplate.js
  6. +1
    -1
      src/server/config/serverConfig.js
  7. +1
    -1
      src/server/items/generator.js
  8. +0
    -15
      src/server/misc/events.js
  9. +1
    -1
      src/server/world/instancer.js

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

@@ -35,7 +35,7 @@ module.exports = {
node,
obj: this
};
eventEmitter.emitNoSticky('beforeGatherResource', eGather);
eventEmitter.emit('beforeGatherResource', eGather);
obj.fireEvent('beforeGatherResource', eGather);

this.gathering = node;
@@ -110,7 +110,7 @@ module.exports = {
xp: resourceNode.xp,
items: gathering.inventory.items
});
this.obj.instance.eventEmitter.emitNoSticky('beforeGatherResourceComplete', gatherResult);
this.obj.instance.eventEmitter.emit('beforeGatherResourceComplete', gatherResult);
this.obj.fireEvent('beforeGatherResourceComplete', gatherResult);

this.obj.syncer.set(false, 'gatherer', 'progress', 100);
@@ -214,7 +214,7 @@ module.exports = {
let gatherResult = extend({
nodeName: node.name
});
obj.instance.eventEmitter.emitNoSticky('beforeEnterPool', gatherResult, obj);
obj.instance.eventEmitter.emit('beforeEnterPool', gatherResult, obj);

let nodeType = node.resourceNode.nodeType;



+ 2
- 2
src/server/components/passives.js View File

@@ -77,7 +77,7 @@ module.exports = {
this.obj.fireEvent('onBeforePassivesChange', passiveResult, node);
if (!passiveResult.success)
return;
this.obj.instance.eventEmitter.emitNoSticky('onBeforePlayerPassivesChange', passiveResult, this.obj, node);
this.obj.instance.eventEmitter.emit('onBeforePlayerPassivesChange', passiveResult, this.obj, node);
if (!passiveResult.success)
return;

@@ -103,7 +103,7 @@ module.exports = {
this.obj.fireEvent('onBeforePassivesChange', passiveResult);
if (!passiveResult.success)
return;
this.obj.instance.eventEmitter.emitNoSticky('onBeforePlayerPassivesChange', passiveResult, this.obj);
this.obj.instance.eventEmitter.emit('onBeforePlayerPassivesChange', passiveResult, this.obj);
if (!passiveResult.success)
return;



+ 2
- 2
src/server/components/player.js View File

@@ -176,7 +176,7 @@ module.exports = {
spawnPos = spawnPos[0];
}

obj.instance.eventEmitter.emitNoSticky('onBeforePlayerRespawn', obj, spawnPos);
obj.instance.eventEmitter.emit('onBeforePlayerRespawn', obj, spawnPos);

obj.x = spawnPos.x;
obj.y = spawnPos.y;
@@ -215,7 +215,7 @@ module.exports = {
x: obj.x,
y: obj.y
};
obj.instance.eventEmitter.emitNoSticky('onBeforePlayerRespawn', obj, spawnPos);
obj.instance.eventEmitter.emit('onBeforePlayerRespawn', obj, spawnPos);

if (!spawnPos.zone) {
obj.x = spawnPos.x;


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

@@ -269,7 +269,7 @@ module.exports = {
if (xpEvent.amount === 0)
return;

obj.instance.eventEmitter.emitNoSticky('onBeforeGetGlobalXpMultiplier', xpEvent);
obj.instance.eventEmitter.emit('onBeforeGetGlobalXpMultiplier', xpEvent);

amount = ~~(xpEvent.amount * (1 + (values.xpIncrease / 100)) * xpEvent.multiplier);

@@ -409,7 +409,7 @@ module.exports = {
source: killSource
};

obj.instance.eventEmitter.emitNoSticky('onAfterActorDies', deathEvent);
obj.instance.eventEmitter.emit('onAfterActorDies', deathEvent);
obj.fireEvent('afterDeath', deathEvent);

if (obj.player) {
@@ -582,7 +582,7 @@ module.exports = {
let death = {
success: true
};
obj.instance.eventEmitter.emitNoSticky('onBeforeActorDies', death, obj, source);
obj.instance.eventEmitter.emit('onBeforeActorDies', death, obj, source);
obj.fireEvent('beforeDeath', death);

if (death.success)


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

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

const obj = this.obj;

obj.instance.eventEmitter.emitNoSticky('beforeCompleteAutoquest', this, obj);
obj.instance.eventEmitter.emit('beforeCompleteAutoquest', this, obj);

const message = `Quest completed (${this.name})`;
obj.social.notifySelf({


+ 1
- 1
src/server/config/serverConfig.js View File

@@ -8,7 +8,7 @@ module.exports = {
// sqlite
// rethink
//eslint-disable-next-line no-process-env
db: process.env.IWD_DB || 'sqlite',
db: process.env.IWD_DB || 'rethink',
//eslint-disable-next-line no-process-env
dbHost: process.env.IWD_DB_HOST || 'localhost',
//eslint-disable-next-line no-process-env


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

@@ -38,7 +38,7 @@ module.exports = {
};

if (!blueprint.slot && !blueprint.type && !blueprint.spell)
global.instancer.instances[0].eventEmitter.emitNoSticky('onBeforeGetDropChances', dropChancesEvent);
global.instancer.instances[0].eventEmitter.emit('onBeforeGetDropChances', dropChancesEvent);

let currencyChance = dropChancesEvent.currencyChance;



+ 0
- 15
src/server/misc/events.js View File

@@ -41,20 +41,5 @@ module.exports = {
else
callback.apply(null, args);
}
},

//In the future, all events should be non sticky
emitNoSticky: async function (event) {
let args = [].slice.call(arguments, 1);

let list = this.events[event];
if (!list)
return;

let len = list.length;
for (let i = 0; i < len; i++) {
const { callback } = list[i];
callback.apply(null, args);
}
}
};

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

@@ -189,7 +189,7 @@ module.exports = {
spawnPos: extend({}, spawnPos),
changed: false
};
eventEmitter.emitNoSticky('onBeforePlayerSpawn', { name: obj.name, instance: { physics } }, spawnEvent);
eventEmitter.emit('onBeforePlayerSpawn', { name: obj.name, instance: { physics } }, spawnEvent);
//If a player is added, destroy any player objects with the same name
const existing = objects.filter(o => o.player && o.name === msg.obj.name);
existing.forEach(o => {


Loading…
Cancel
Save