Browse Source

fix #126

tags/v0.1.3^2
W01fw00d 7 years ago
parent
commit
a70b6d730f
2 changed files with 22 additions and 8 deletions
  1. +13
    -5
      src/client/js/components/spellbook.js
  2. +9
    -3
      src/client/js/objects/objects.js

+ 13
- 5
src/client/js/components/spellbook.js View File

@@ -80,7 +80,7 @@ define([
this.spells.splice(existIndex, 1, s);
return;
}
if (this.spells.length - 1 >= s.id)
this.spells.splice(s.id, 0, s);
else
@@ -141,7 +141,11 @@ define([
},

tabTarget: function() {
this.onMouseDown(null, objects.getClosest(window.player.x, window.player.y, 10, this.target));
this.onMouseDown(null, objects.getClosest(window.player.x, window.player.y, 10, false, this.target));
},

shiftTabTarget: function() {
this.onMouseDown(null, objects.getClosest(window.player.x, window.player.y, 10, true, this.target));
},

build: function(destroy) {
@@ -151,7 +155,7 @@ define([
data: {
instanceModule: 'customMap',
method: 'customize',
data: {
data: {
tile: 189,
direction: this.obj.keyboardMover.direction,
destroy: destroy
@@ -175,7 +179,11 @@ define([
this.shiftDown = true;
return;
} else if (key == 'tab') {
this.tabTarget();
if (this.shiftDown) {
this.shiftTabTarget();
} else {
this.tabTarget();
}
return;
}

@@ -288,4 +296,4 @@ define([
this.targetSprite.y = this.target.y * scale;
}
};
});
});

+ 9
- 3
src/client/js/objects/objects.js View File

@@ -46,7 +46,7 @@ define([
events.emit('onMobHover', mob);
},

getClosest: function(x, y, maxDistance, fromMob, callback) {
getClosest: function(x, y, maxDistance, reverse, fromMob, callback) {
var objects = this.objects;
var oLen = objects.length;

@@ -79,7 +79,13 @@ define([
return (l.id == fromMob.id);
});

return list[(fromIndex + 1) % list.length];
if (reverse) {
fromIndex = (fromIndex === 0 ? list.length : fromIndex) - 1;
} else {
fromIndex = (fromIndex + 1) % list.length;
}

return list[fromIndex];
},

onRezone: function(oldZone) {
@@ -341,4 +347,4 @@ define([
}
}
};
});
});

Loading…
Cancel
Save