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

41
filterscan.lua

@ -44,7 +44,7 @@ local FilterScan =
FFXiPath = ashita.file.get_install_dir(polVersion, 1) .. '\\', FFXiPath = ashita.file.get_install_dir(polVersion, 1) .. '\\',
MobList = { }, MobList = { },
ZoneDatList = require('zonemoblist'), ZoneDatList = require('zonemoblist'),
Filter = '' Filter = { }
}; };
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
@ -104,9 +104,19 @@ ashita.register_event('command', function(command, ntype)
return false; return false;
end end
-- Pull the filter from the command.. -- the list of targets gets reset anytime the cmd is called. calling w/o params will 'disable' the filter
FilterScan.Filter = (string.gsub(command, '/filterscan', '')):trim() FilterScan.Filter = { }
print(string.format('[FilterScan] Set new filter to: %s', 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; return true;
end); end);
@ -140,17 +150,20 @@ ashita.register_event('incoming_packet', function(id, size, data)
if (mobName == nil) then if (mobName == nil) then
return false; return false;
else else
-- Filter by name..
if (mobName:lower():find(FilterScan.Filter:lower()) ~= nil) then -- there is nothing in the filter list, so you get all the entities
return false; if (table.getn(FilterScan.Filter) == 0) then
end return false
-- Filter by target index..
if (targetIndex == tonumber(FilterScan.Filter, 16)) then
return false;
end 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 end
-- Ignore all non-matching entries.. -- Ignore all non-matching entries..

Loading…
Cancel
Save