Skip to content
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

Add 'done' command to treasury. #2246

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions addons/Treasury/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ This will either clear the specified list (for the current character only) or li

Lots/passes on all items currently in the pool

`//treasury done`

Passes on all items currently in the pool that have not been lotted or passed yet. Equivalent to the in-game 'Done' menu command.

`//treasury clearall`

Clears all character-specific settings (it will keep global settings)
Expand Down
34 changes: 29 additions & 5 deletions addons/Treasury/Treasury.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ config = require('config')
packets = require('packets')
require('logger')

local MIN_TREASURE_SLOT_INDEX = 0
local MAX_TREASURE_SLOT_INDEX = 9

defaults = {}
defaults.Pass = S{}
defaults.Lot = S{}
Expand Down Expand Up @@ -188,7 +191,7 @@ function find_id(name)
end

function pool_ids()
return S(T(windower.ffxi.get_items().treasure):map(table.get-{'item_id'}))
return S(T(windower.ffxi.get_items('treasure')):map(table.get-{'item_id'}))
end

stack = function()
Expand Down Expand Up @@ -286,14 +289,34 @@ windower.register_event('addon command', function(command1, command2, ...)

end

elseif command1 == 'done' then
local lots = windower.ffxi.get_party().p0.lots
local treasure = windower.ffxi.get_items('treasure')
for idx=MIN_TREASURE_SLOT_INDEX, MAX_TREASURE_SLOT_INDEX do
-- Pass if we haven't lotted or passed.
if treasure[idx] and lots[idx] == nil then
windower.ffxi.pass_item(idx)
end
end

elseif command1 == 'passall' then
for slot_index, item_table in pairs(windower.ffxi.get_items().treasure) do
windower.ffxi.pass_item(slot_index)
local lots = windower.ffxi.get_party().p0.lots
local treasure = windower.ffxi.get_items('treasure')
for idx=MIN_TREASURE_SLOT_INDEX, MAX_TREASURE_SLOT_INDEX do
-- Pass if we haven't passed (will pass if lotted).
if treasure[idx] and (lots[idx] == nil or type(lots[idx]) == 'number') then
windower.ffxi.pass_item(idx)
end
end

elseif command1 == 'lotall' then
for slot_index, item_table in pairs(windower.ffxi.get_items().treasure) do
windower.ffxi.lot_item(slot_index)
local lots = windower.ffxi.get_party().p0.lots
local treasure = windower.ffxi.get_items('treasure')
for idx=MIN_TREASURE_SLOT_INDEX, MAX_TREASURE_SLOT_INDEX do
-- Lot if we haven't lotted or passed.
if treasure[idx] and lots[idx] == nil then
windower.ffxi.lot_item(idx)
end
end

elseif command1 == 'clearall' then
Expand Down Expand Up @@ -353,6 +376,7 @@ windower.register_event('addon command', function(command1, command2, ...)
print(' \\cs(255,255,255)lot|pass|drop clear\\cr - Clears the specified list for the current character')
print(' \\cs(255,255,255)lot|pass list\\cr - Lists all items on the specified list for the current character')
print(' \\cs(255,255,255)lotall|passall\\cr - Lots/Passes all items currently in the pool')
print(' \\cs(255,255,255)done\\cr - Passes all items currently in the pool that have not been lotted on by the current character')
print(' \\cs(255,255,255)clearall\\cr - Removes lotting/passing/dropping settings for this character')
print(' \\cs(255,255,255)autodrop [on|off]\\cr - Enables/disables (or toggles) the auto-drop setting')
print(' \\cs(255,255,255)verbose [on|off]\\cr - Enables/disables (or toggles) the verbose setting')
Expand Down