|
@@ -1,24 +1,32 @@
|
|
|
module.exports = function Loot(dispatch) {
|
|
module.exports = function Loot(dispatch) {
|
|
|
|
|
|
|
|
let auto = false,
|
|
let auto = false,
|
|
|
|
|
+ enabled = true,
|
|
|
location;
|
|
location;
|
|
|
|
|
|
|
|
let loot = {};
|
|
let loot = {};
|
|
|
|
|
|
|
|
let commands = {
|
|
let commands = {
|
|
|
- loot: {
|
|
|
|
|
- alias: ['all', 'loot', 'drop', 'drops'],
|
|
|
|
|
- run: function() {
|
|
|
|
|
- message('Trying to loot all items in 150 range');
|
|
|
|
|
- tryLootAll();
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
auto: {
|
|
auto: {
|
|
|
alias: ['auto', 'autoloot', 'toggle'],
|
|
alias: ['auto', 'autoloot', 'toggle'],
|
|
|
run: function() {
|
|
run: function() {
|
|
|
auto = !auto;
|
|
auto = !auto;
|
|
|
message(`Autoloot mode toggled: ${auto}`);
|
|
message(`Autoloot mode toggled: ${auto}`);
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ enable: {
|
|
|
|
|
+ alias: ['enable', 'on'],
|
|
|
|
|
+ run: function() {
|
|
|
|
|
+ enabled = true;
|
|
|
|
|
+ message('Easy looting is enabled.');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ disable: {
|
|
|
|
|
+ alias: ['disable', 'off'],
|
|
|
|
|
+ run: function() {
|
|
|
|
|
+ enabled = false;
|
|
|
|
|
+ message('Easy looting is disabled.');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -53,15 +61,18 @@ module.exports = function Loot(dispatch) {
|
|
|
tryLootAll();
|
|
tryLootAll();
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ dispatch.hook('C_TRY_LOOT_DROPITEM', 1, (event) => {
|
|
|
|
|
+ if(enabled) tryLootAll();
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
dispatch.hook('S_DESPAWN_DROPITEM', 1, (event) => {
|
|
dispatch.hook('S_DESPAWN_DROPITEM', 1, (event) => {
|
|
|
- if(event.id.toString() in loot)
|
|
|
|
|
- delete loot[event.id.toString()];
|
|
|
|
|
|
|
+ if(event.id.toString() in loot) delete loot[event.id.toString()];
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
function tryLootAll() {
|
|
function tryLootAll() {
|
|
|
for(let item in loot) {
|
|
for(let item in loot) {
|
|
|
- if(Math.abs(loot[item].x - location.x2) < 150 && Math.abs(loot[item].y - location.y2) < 150)
|
|
|
|
|
|
|
+ if(Math.abs(loot[item].x - location.x2) < 250 && Math.abs(loot[item].y - location.y2) < 250)
|
|
|
dispatch.toServer('C_TRY_LOOT_DROPITEM', 1, {
|
|
dispatch.toServer('C_TRY_LOOT_DROPITEM', 1, {
|
|
|
id: loot[item].id
|
|
id: loot[item].id
|
|
|
});
|
|
});
|