Browse Source

Merge branch 'master' of Alex/filterscan into master

master^2
atom0s 8 years ago committed by Gogs
parent
commit
8fa4776e2a
  1. 41
      filterscan.lua

41
filterscan.lua

@ -38,7 +38,7 @@ local FilterScan = @@ -38,7 +38,7 @@ local FilterScan =
FFXiPath = ashita.file.get_install_dir(0, 1) .. '\\',
MobList = { },
ZoneDatList = require('zonemoblist'),
Filter = ''
Filter = { }
};
---------------------------------------------------------------------------------------------------
@ -98,9 +98,19 @@ ashita.register_event('command', function(command, ntype) @@ -98,9 +98,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);
@ -134,17 +144,20 @@ ashita.register_event('incoming_packet', function(id, size, data) @@ -134,17 +144,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