Skip to content

Commit

Permalink
looting blacklist (mehah#881)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
divinity76 authored Oct 5, 2024
1 parent e54cb1c commit 38801cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion mods/game_bot/default_configs/vBot_4.8/targetbot/looting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 38801cb

Please sign in to comment.