From 9758bc0a0b19ac3ab09478a492706cef03f9b6a6 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Tue, 17 Sep 2024 10:15:32 +0200 Subject: [PATCH 1/5] looting blacklist When "loot every item" is off, it will loot everything in the loot list. When "loot every item" is on, it will loot everything that is not in the loot list, effectively making the loot list a blacklist when "loot every item" is on. --- mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua index c4816a1de0..9be55ffc1b 100644 --- a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua +++ b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua @@ -224,7 +224,7 @@ TargetBot.Looting.lootContainer = function(lootContainers, container) for i, item in ipairs(container:getItems()) do if item:isContainer() and not itemsById[item:getId()] then nextContainer = item - elseif itemsById[item:getId()] or (ui.everyItem:isOn() and not item:isContainer()) then + elseif (not ui.everyItem:isOn() and itemsById[item:getId()]) or (ui.everyItem:isOn() and (not item:isContainer() and not itemsById[item:getId()])) then item.lootTries = (item.lootTries or 0) + 1 if item.lootTries < 5 then -- if can't be looted within 0.5s then skip it return TargetBot.Looting.lootItem(lootContainers, item) From 5c3b90b1c59be1e0d79bc5caacc87ac9634a5b86 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Tue, 17 Sep 2024 10:17:57 +0200 Subject: [PATCH 2/5] blacklist UI --- mods/game_bot/default_configs/vBot_4.8/targetbot/looting.otui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.otui b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.otui index f0915e7887..1290de345d 100644 --- a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.otui +++ b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.otui @@ -18,7 +18,7 @@ TargetBotLootingPanel < Panel BotSwitch id: everyItem - !text: tr("Loot every item") + !text: tr("Loot every item, except these") margin-top: 2 Label From 60c835757e5f5ecd0e81ed8766dd16db9632be44 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Fri, 4 Oct 2024 19:52:56 +0200 Subject: [PATCH 3/5] UI improvements from PR review suggested by @kokekanon at https://github.com/mehah/otclient/pull/881#issuecomment-2386620565 --- mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua | 5 +++++ .../game_bot/default_configs/vBot_4.8/targetbot/looting.otui | 1 + 2 files changed, 6 insertions(+) diff --git a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua index 9be55ffc1b..90518e4552 100644 --- a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua +++ b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua @@ -13,6 +13,11 @@ TargetBot.Looting.setup = function() UI.Container(TargetBot.Looting.onItemsUpdate, true, nil, ui.items) UI.Container(TargetBot.Looting.onContainersUpdate, true, nil, ui.containers) ui.everyItem.onClick = function() + if ui.everyItem:isOn() then + ui.labelToLoot:setText("Items to loot") + else + ui.labelToLoot:setText("Items to ignore") + end ui.everyItem:setOn(not ui.everyItem:isOn()) TargetBot.save() end diff --git a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.otui b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.otui index 1290de345d..9873366ca6 100644 --- a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.otui +++ b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.otui @@ -20,6 +20,7 @@ TargetBotLootingPanel < Panel id: everyItem !text: tr("Loot every item, except these") margin-top: 2 + font: small-9px Label margin-top: 5 From 8d9c8eefd23ff38a409967654fde06b834c80574 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Fri, 4 Oct 2024 19:59:31 +0200 Subject: [PATCH 4/5] oops inverted it --- mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua index 90518e4552..944789137a 100644 --- a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua +++ b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua @@ -14,9 +14,9 @@ TargetBot.Looting.setup = function() UI.Container(TargetBot.Looting.onContainersUpdate, true, nil, ui.containers) ui.everyItem.onClick = function() if ui.everyItem:isOn() then - ui.labelToLoot:setText("Items to loot") - else ui.labelToLoot:setText("Items to ignore") + else + ui.labelToLoot:setText("Items to loot") end ui.everyItem:setOn(not ui.everyItem:isOn()) TargetBot.save() From e7151d9420725077dfc60c20c07c5adf9a7a4b37 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Fri, 4 Oct 2024 20:00:13 +0200 Subject: [PATCH 5/5] *mumble* --- mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua index 944789137a..d2d8000d82 100644 --- a/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua +++ b/mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua @@ -13,12 +13,12 @@ TargetBot.Looting.setup = function() UI.Container(TargetBot.Looting.onItemsUpdate, true, nil, ui.items) UI.Container(TargetBot.Looting.onContainersUpdate, true, nil, ui.containers) ui.everyItem.onClick = function() + ui.everyItem:setOn(not ui.everyItem:isOn()) if ui.everyItem:isOn() then ui.labelToLoot:setText("Items to ignore") else ui.labelToLoot:setText("Items to loot") end - ui.everyItem:setOn(not ui.everyItem:isOn()) TargetBot.save() end ui.maxDangerPanel.value.onTextChange = function()