atom0s 7 years ago
parent
commit
70d325f0eb
  1. 41
      filterscan.lua

41
filterscan.lua

@ -44,7 +44,7 @@ local FilterScan = @@ -44,7 +44,7 @@ local FilterScan =
FFXiPath = ashita.file.get_install_dir(polVersion, 1) .. '\\',
MobList = { },
ZoneDatList = require('zonemoblist'),
Filter = ''
Filter = { }
};
---------------------------------------------------------------------------------------------------
@ -104,9 +104,19 @@ ashita.register_event('command', function(command, ntype) @@ -104,9 +104,19 @@ ashita.register_event('command', function(command, ntype)
return false;
end
-- Pull the filter from the command..
FilterScan.Filter = (string.gsub(command, '/filterscan', '')):trim()
print(string.format('[FilterScan] Set new filter to: %s', FilterScan.Filter));
-- the list of targets gets reset anytime the cmd is called. calling w/o params will 'disable' the filter
FilterScan.Filter = { }
-- pull the target mobs from the arg and split them into the list
local filter = (string.gsub(command, '/filterscan', '')):trim()
for target in string.gmatch(filter, "[^,]+") do
if (target ~= nil) then
table.insert(FilterScan.Filter, target:lower():trim())
end
end
print(string.format('[FilterScan] Set new filter to: %s', filter));
return true;
end);
@ -140,17 +150,20 @@ ashita.register_event('incoming_packet', function(id, size, data) @@ -140,17 +150,20 @@ ashita.register_event('incoming_packet', function(id, size, data)
if (mobName == nil) then
return false;
else
-- Filter by name..
if (mobName:lower():find(FilterScan.Filter:lower()) ~= nil) then
return false;
end
-- Filter by target index..
if (targetIndex == tonumber(FilterScan.Filter, 16)) then
return false;
-- there is nothing in the filter list, so you get all the entities
if (table.getn(FilterScan.Filter) == 0) then
return false
end
if (tostring(targetIndex) == FilterScan.Filter) then
return false;
local mob = mobName:lower()
local idx_s = tostring(targetIndex)
for _, target in pairs(FilterScan.Filter) do
if (mob:find(target) ~= nil or targetIndex == tonumber(target, 16) or idx_s == target) then
-- the mob has matched an item in the filter
return false
end
end
-- Ignore all non-matching entries..

Loading…
Cancel
Save