Quellcode durchsuchen

more work

tags/v0.11.0
Shaun vor 2 Jahren
Ursprung
Commit
d7f567ef9e
6 geänderte Dateien mit 44 neuen und 6 gelöschten Zeilen
  1. +32
    -0
      src/client/js/input.js
  2. +1
    -1
      src/server/components/gatherer.js
  3. +1
    -1
      src/server/config/maps/fjolarok/quests.js
  4. +5
    -1
      src/server/config/quests/questBuilder.js
  5. +4
    -2
      src/server/config/quests/templates/questGatherResource.js
  6. +1
    -1
      src/server/world/resourceSpawner.js

+ 32
- 0
src/client/js/input.js Datei anzeigen

@@ -60,6 +60,9 @@ define([

enabled: true,

blacklistedKeys: [],
whitelistedKeys: [],

init: function () {
$(window).on('keydown', this.events.keyboard.keyDown.bind(this));
$(window).on('keyup', this.events.keyboard.keyUp.bind(this));
@@ -78,6 +81,22 @@ define([
require(['plugins/shake.js'], this.onLoadShake.bind(this));
},

blacklistKeys: function (list) {
this.blacklistedKeys.push(...list);
},

unBlacklistKeys: function (list) {
this.blacklistedKeys.spliceWhere(d => list.includes(d));
},

whitelistKeys: function (list) {
this.whitelistedKeys.push(...list);
},

unWhitelistKeys: function (list) {
this.whitelistedKeys.spliceWhere(d => list.includes(d));
},

onLoadShake: function (shake) {
let shaker = new shake({
threshold: 5,
@@ -142,6 +161,7 @@ define([

events: {
keyboard: {
/* eslint-disable-next-line max-lines-per-function */
keyDown: function (e) {
if (!this.enabled)
return;
@@ -156,6 +176,18 @@ define([
if ((e.keyCode === 9) || (e.keyCode === 8) || (e.keyCode === 122))
e.preventDefault();

const allowKey = (
key.length > 1 ||
this.whitelistedKeys.includes(key) ||
(
!this.blacklistedKeys.includes(key) &&
!this.blacklistedKeys.includes('*')
)
);

if (!allowKey)
return;

if (this.keys.has(key))
this.keys[key] = 2;
else {


+ 1
- 1
src/server/components/gatherer.js Datei anzeigen

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

if (this.gatheringTtl > 0) {
if ((this.gatheringTtl === this.gatheringTtlMax) && (gathering.width)) {
if (this.gatheringTtl === this.gatheringTtlMax && gathering.width > 1) {
['x', 'y', 'width', 'height'].forEach(function (p) {
this.obj.syncer.set(false, 'gatherer', p, gathering[p]);
}, this);


+ 1
- 1
src/server/config/maps/fjolarok/quests.js Datei anzeigen

@@ -19,6 +19,6 @@ module.exports = {
name: 'Green Fingers',
type: 'gatherResource',
subType: 'herb',
quantity: [5, 10]
quantity: [2, 5]
}]
};

+ 5
- 1
src/server/config/quests/questBuilder.js Datei anzeigen

@@ -33,7 +33,11 @@ module.exports = {
zoneTemplate = globalQuests;

let config = extend({}, zoneTemplate);
this.instance.eventEmitter.emit('onBeforeGetQuests', config);
this.instance.eventEmitter.emit('onBeforeGetQuests', {
obj,
config,
zoneName
});
if (config.infini.length === 0)
return;



+ 4
- 2
src/server/config/quests/templates/questGatherResource.js Datei anzeigen

@@ -8,9 +8,11 @@ module.exports = {

build: function () {
if (!this.need) {
this.need = 2 + ~~(Math.random() * 3);
const { quantity, subType } = this;

this.gatherType = ['herb', 'fish'][~~(Math.random() * 2)];
this.need = quantity[0] + ~~(Math.random() * (quantity[1] - quantity[0]));

this.gatherType = subType ?? ['herb', 'fish'][~~(Math.random() * 2)];

if (this.gatherType === 'fish') {
this.name = 'Lure of the Sea';


+ 1
- 1
src/server/world/resourceSpawner.js Datei anzeigen

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

let position = null;

if (blueprint.type === 'herb') {
if (blueprint.type === 'herb' && !blueprint.positions) {
x = ~~(Math.random() * w);
y = ~~(Math.random() * h);



Laden…
Abbrechen
Speichern