From 38801cb5018b21f4be66a5253baaecf1b2d36fb1 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Sat, 5 Oct 2024 16:36:51 +0200 Subject: [PATCH] looting blacklist (#881) 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. --- .../default_configs/vBot_4.8/targetbot/looting.lua | 7 ++++++- .../default_configs/vBot_4.8/targetbot/looting.otui | 3 ++- 2 files changed, 8 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 c4816a1de0..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 @@ -14,6 +14,11 @@ TargetBot.Looting.setup = function() 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 TargetBot.save() end ui.maxDangerPanel.value.onTextChange = function() @@ -224,7 +229,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) 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..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 @@ -18,8 +18,9 @@ TargetBotLootingPanel < Panel BotSwitch id: everyItem - !text: tr("Loot every item") + !text: tr("Loot every item, except these") margin-top: 2 + font: small-9px Label margin-top: 5