From ddcd7fcdae09f1c555000a3964db8eda9dcfde5a Mon Sep 17 00:00:00 2001 From: Robert Coones Date: Wed, 6 Mar 2024 12:05:25 -0600 Subject: [PATCH 1/2] Add creature loot blacklist --- targetbot/looting.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/targetbot/looting.lua b/targetbot/looting.lua index 9e41528..123987c 100644 --- a/targetbot/looting.lua +++ b/targetbot/looting.lua @@ -12,6 +12,16 @@ TargetBot.Looting.setup = function() ui = UI.createWidget("TargetBotLootingPanel") UI.Container(TargetBot.Looting.onItemsUpdate, true, nil, ui.items) UI.Container(TargetBot.Looting.onContainersUpdate, true, nil, ui.containers) + UI.Separator() + local blackListText = table.concat(storage.blacklist, ",") + UI.Label("Loot Blacklist (creature1,creature2):") + UI.TextEdit(table.concat(storage.blacklist, ","), function(_, text) + storage.blacklist = {} + for _, creature in ipairs(string.split(text, ",")) do + table.insert(storage.blacklist, creature) + end + end) + UI.Separator() ui.everyItem.onClick = function() ui.everyItem:setOn(not ui.everyItem:isOn()) TargetBot.save() @@ -302,6 +312,11 @@ onCreatureDisappear(function(creature) local pos = player:getPosition() local mpos = creature:getPosition() local name = creature:getName() + + for _, v in ipairs(storage.blacklist) do + if name == v then return end + end + if pos.z ~= mpos.z or math.max(math.abs(pos.x-mpos.x), math.abs(pos.y-mpos.y)) > 6 then return end schedule(20, function() -- check in 20ms if there's container (dead body) on that tile if not containers[1] then return end From 655a4cccef62ab21dbdf02a722fd121fbb9a0631 Mon Sep 17 00:00:00 2001 From: Robert Coones Date: Wed, 6 Mar 2024 12:08:55 -0600 Subject: [PATCH 2/2] Add creature loot blacklist --- targetbot/looting.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/targetbot/looting.lua b/targetbot/looting.lua index 123987c..050e6cd 100644 --- a/targetbot/looting.lua +++ b/targetbot/looting.lua @@ -13,7 +13,6 @@ TargetBot.Looting.setup = function() UI.Container(TargetBot.Looting.onItemsUpdate, true, nil, ui.items) UI.Container(TargetBot.Looting.onContainersUpdate, true, nil, ui.containers) UI.Separator() - local blackListText = table.concat(storage.blacklist, ",") UI.Label("Loot Blacklist (creature1,creature2):") UI.TextEdit(table.concat(storage.blacklist, ","), function(_, text) storage.blacklist = {}