Fix grid filter

This commit is contained in:
Casper Warden
2018-04-07 22:19:44 +01:00
parent 16aa98268d
commit 9f3f346cdd
4 changed files with 9 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@@ -92,7 +92,7 @@ class GridCommands extends CommandsBase_1.CommandsBase {
const filterMsg = packet.message;
let found = false;
filterMsg.Data.forEach((data) => {
if (data.X === (gridX / 256) && data.Y === (gridY / 256)) {
if (data.X === gridX && data.Y === gridY) {
found = true;
}
});
@@ -103,7 +103,7 @@ class GridCommands extends CommandsBase_1.CommandsBase {
}).then((packet) => {
const responseMsg = packet.message;
responseMsg.Data.forEach((data) => {
if (data.X === (gridX / 256) && data.Y === (gridY / 256)) {
if (data.X === gridX && data.Y === gridY) {
response.block = new MapBlock_1.MapBlock();
response.block.name = Utils_1.Utils.BufferToStringSimple(data.Name);
response.block.accessFlags = data.Access;
@@ -124,9 +124,9 @@ class GridCommands extends CommandsBase_1.CommandsBase {
RegionHandle: regionHandle
};
circuit.sendMessage(mi, PacketFlags_1.PacketFlags.Reliable);
const minX = Math.floor(gridX / 256) * 256;
const minX = gridX;
const maxX = minX + 256;
const minY = Math.floor(gridY / 256) * 256;
const minY = gridY;
const maxY = minY + 256;
response.avatars = [];
circuit.waitForMessage(Message_1.Message.MapItemReply, 10000, (packet) => {

File diff suppressed because one or more lines are too long

View File

@@ -26,16 +26,16 @@ let loginResponse = null;
bot.clientEvents.onLure.subscribe((lureEvent) =>
{
bot.clientCommands.grid.getRegionMapInfo(lureEvent.gridX, lureEvent.gridY).then((regionInfo) =>
bot.clientCommands.grid.getRegionMapInfo(lureEvent.gridX / 256, lureEvent.gridY / 256).then((regionInfo) =>
{
if (lureEvent.from.toString() === master)
{
console.log('Accepting teleport lure to ' + regionInfo.name + ' (' + regionInfo.avatars.length + ' avatar' + ((regionInfo.avatars.length === 1)?'':'s') + ' present) from ' + lureEvent.fromName + ' with message: ' + lureEvent.lureMessage);
console.log('Accepting teleport lure to ' + regionInfo.block.name + ' (' + regionInfo.avatars.length + ' avatar' + ((regionInfo.avatars.length === 1)?'':'s') + ' present) from ' + lureEvent.fromName + ' with message: ' + lureEvent.lureMessage);
bot.clientCommands.teleport.acceptTeleport(lureEvent);
}
else
{
console.log('Ignoring teleport lure to ' + regionInfo.name + ' (' + regionInfo.avatars.length + ' avatar' + ((regionInfo.avatars.length === 1)?'':'s') + ' present) from ' + lureEvent.fromName + ' with message: ' + lureEvent.lureMessage);
console.log('Ignoring teleport lure to ' + regionInfo.block.name + ' (' + regionInfo.avatars.length + ' avatar' + ((regionInfo.avatars.length === 1)?'':'s') + ' present) from ' + lureEvent.fromName + ' with message: ' + lureEvent.lureMessage);
}
});
});