-
Notifications
You must be signed in to change notification settings - Fork 89
vBot looting blacklist #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,13 @@ 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.labelToLoot then | ||
| if ui.everyItem:isOn() then | ||
| ui.labelToLoot:setText("Items to ignore") | ||
| else | ||
| ui.labelToLoot:setText("Items to loot") | ||
| end | ||
| end | ||
| TargetBot.save() | ||
| end | ||
| ui.maxDangerPanel.value.onTextChange = function() | ||
|
|
@@ -52,6 +59,13 @@ TargetBot.Looting.update = function(data) | |
| ui.items:setItems(data['items'] or {}) | ||
| ui.containers:setItems(data['containers'] or {}) | ||
| ui.everyItem:setOn(data['everyItem']) | ||
| if ui.labelToLoot then | ||
| if ui.everyItem:isOn() then | ||
| ui.labelToLoot:setText("Items to ignore") | ||
| else | ||
| ui.labelToLoot:setText("Items to loot") | ||
| end | ||
| end | ||
|
Comment on lines
+62
to
+68
|
||
| ui.maxDangerPanel.value:setText(data['maxDanger'] or 10) | ||
| ui.minCapacityPanel.value:setText(data['minCapacity'] or 100) | ||
| TargetBot.Looting.updateItemsAndContainers() | ||
|
|
@@ -224,7 +238,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 | ||
|
Comment on lines
240
to
242
|
||
| if item.lootTries < 5 then -- if can't be looted within 0.5s then skip it | ||
| return TargetBot.Looting.lootItem(lootContainers, item) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,7 @@ TargetBotLootingPanel < Panel | |||||||||||
| margin-top: 5 | ||||||||||||
|
|
||||||||||||
| Label | ||||||||||||
| id: labelToLoot | ||||||||||||
| margin-top: 5 | ||||||||||||
| text: Items to loot | ||||||||||||
| text-align: center | ||||||||||||
|
|
@@ -17,8 +18,9 @@ TargetBotLootingPanel < Panel | |||||||||||
|
|
||||||||||||
| BotSwitch | ||||||||||||
| id: everyItem | ||||||||||||
| !text: tr("Loot every item") | ||||||||||||
| !text: tr("Loot every item, except these") | ||||||||||||
divinity76 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||
| margin-top: 2 | ||||||||||||
| font: small-9px | ||||||||||||
|
|
||||||||||||
|
||||||||||||
| !text: tr("Loot every item, except these") | |
| margin-top: 2 | |
| font: small-9px | |
| !text: tr("Loot all except listed") | |
| margin-top: 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The label update logic is duplicated in the onClick handler and the update function. Consider extracting this into a separate function to improve maintainability and reduce code duplication. For example, create a function like updateLootLabel() that checks the state and updates the label text accordingly.