fix for charge items in post
This commit is contained in:
@@ -46,7 +46,8 @@ function public.container_item(bag, slot)
|
|||||||
|
|
||||||
local texture, count, locked, quality, readable, lootable = GetContainerItemInfo(bag, slot) -- quality not working?
|
local texture, count, locked, quality, readable, lootable = GetContainerItemInfo(bag, slot) -- quality not working?
|
||||||
local tooltip = public.tooltip(function(tt) tt:SetBagItem(bag, slot) end)
|
local tooltip = public.tooltip(function(tt) tt:SetBagItem(bag, slot) end)
|
||||||
local charges = private.item_charges(tooltip)
|
local max_charges = private.max_item_charges(item_id)
|
||||||
|
local charges = max_charges and private.item_charges(tooltip)
|
||||||
local aux_quantity = charges or count
|
local aux_quantity = charges or count
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -67,7 +68,6 @@ function public.container_item(bag, slot)
|
|||||||
slot = item_info.slot,
|
slot = item_info.slot,
|
||||||
quality = item_info.quality,
|
quality = item_info.quality,
|
||||||
max_stack = item_info.max_stack,
|
max_stack = item_info.max_stack,
|
||||||
aux_quantity = aux_quantity,
|
|
||||||
|
|
||||||
count = count,
|
count = count,
|
||||||
locked = locked,
|
locked = locked,
|
||||||
@@ -75,7 +75,9 @@ function public.container_item(bag, slot)
|
|||||||
lootable = lootable,
|
lootable = lootable,
|
||||||
|
|
||||||
tooltip = tooltip,
|
tooltip = tooltip,
|
||||||
|
max_charges = max_charges,
|
||||||
charges = charges,
|
charges = charges,
|
||||||
|
aux_quantity = aux_quantity,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -86,21 +88,20 @@ function public.auction_sell_item()
|
|||||||
|
|
||||||
local unit_vendor_price = vendor_price / count
|
local unit_vendor_price = vendor_price / count
|
||||||
local tooltip = public.tooltip(function(tt) tt:SetAuctionSellItem() end)
|
local tooltip = public.tooltip(function(tt) tt:SetAuctionSellItem() end)
|
||||||
|
|
||||||
local charges = private.item_charges(tooltip)
|
local charges = private.item_charges(tooltip)
|
||||||
local aux_quantity = charges or count
|
local aux_quantity = charges > 1 and charges or count
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name = name,
|
name = name,
|
||||||
texture = texture,
|
texture = texture,
|
||||||
quality = quality,
|
quality = quality,
|
||||||
aux_quantity = aux_quantity,
|
|
||||||
stack_size = count,
|
stack_size = count,
|
||||||
usable = usable,
|
usable = usable,
|
||||||
vendor_price = vendor_price,
|
vendor_price = vendor_price,
|
||||||
unit_vendor_price = unit_vendor_price,
|
unit_vendor_price = unit_vendor_price,
|
||||||
|
|
||||||
tooltip = tooltip,
|
tooltip = tooltip,
|
||||||
charges = charges,
|
aux_quantity = aux_quantity,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -121,7 +122,8 @@ function public.auction(index, query_type)
|
|||||||
|
|
||||||
local duration = GetAuctionItemTimeLeft(query_type, index)
|
local duration = GetAuctionItemTimeLeft(query_type, index)
|
||||||
local tooltip = public.tooltip(function(tt) tt:SetAuctionItem(query_type, index) end)
|
local tooltip = public.tooltip(function(tt) tt:SetAuctionItem(query_type, index) end)
|
||||||
local charges = private.item_charges(tooltip)
|
local max_charges = private.max_item_charges(item_id)
|
||||||
|
local charges = max_charges and private.item_charges(tooltip)
|
||||||
local aux_quantity = charges or count
|
local aux_quantity = charges or count
|
||||||
local blizzard_bid = high_bid > 0 and high_bid or start_price
|
local blizzard_bid = high_bid > 0 and high_bid or start_price
|
||||||
local bid_price = high_bid > 0 and (high_bid + min_increment) or start_price
|
local bid_price = high_bid > 0 and (high_bid + min_increment) or start_price
|
||||||
@@ -161,7 +163,9 @@ function public.auction(index, query_type)
|
|||||||
sale_status = sale_status,
|
sale_status = sale_status,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
usable = usable,
|
usable = usable,
|
||||||
|
|
||||||
tooltip = tooltip,
|
tooltip = tooltip,
|
||||||
|
max_charges = max_charges,
|
||||||
charges = charges,
|
charges = charges,
|
||||||
aux_quantity = aux_quantity,
|
aux_quantity = aux_quantity,
|
||||||
}
|
}
|
||||||
@@ -308,10 +312,6 @@ function public.tooltip(setter)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function private.item_charges(tooltip)
|
function private.item_charges(tooltip)
|
||||||
if public.tooltip_find(ITEM_SPELL_TRIGGER_ONUSE, tooltip) > 1 then -- it's presumably a recipe
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, line in ipairs(tooltip) do
|
for _, line in ipairs(tooltip) do
|
||||||
local pattern1 = '^'..gsub(ITEM_SPELL_CHARGES, '%%d', '(%%d+)')..'$'
|
local pattern1 = '^'..gsub(ITEM_SPELL_CHARGES, '%%d', '(%%d+)')..'$'
|
||||||
local pattern2 = '^'..gsub(ITEM_SPELL_CHARGES_P1, '%%d', '(%%d+)')..'$'
|
local pattern2 = '^'..gsub(ITEM_SPELL_CHARGES_P1, '%%d', '(%%d+)')..'$'
|
||||||
@@ -326,7 +326,33 @@ function private.item_charges(tooltip)
|
|||||||
if charges then
|
if charges then
|
||||||
return charges
|
return charges
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function private.max_item_charges(item_id)
|
||||||
|
return ({
|
||||||
|
-- wizard oil
|
||||||
|
[20744] = 5,
|
||||||
|
[20746] = 5,
|
||||||
|
[20750] = 5,
|
||||||
|
[20749] = 5,
|
||||||
|
|
||||||
|
-- mana oil
|
||||||
|
[20745] = 5,
|
||||||
|
[20747] = 5,
|
||||||
|
[20748] = 5,
|
||||||
|
|
||||||
|
-- discombobulator
|
||||||
|
[4388] = 5,
|
||||||
|
|
||||||
|
-- recombobulator
|
||||||
|
[4381] = 10,
|
||||||
|
[18637] = 10,
|
||||||
|
|
||||||
|
-- ... TODO
|
||||||
|
|
||||||
|
})[item_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.durability(tooltip)
|
function public.durability(tooltip)
|
||||||
|
|||||||
+11
-11
@@ -20,8 +20,8 @@ function private.default_settings()
|
|||||||
stack_size = 1,
|
stack_size = 1,
|
||||||
start_price = 0,
|
start_price = 0,
|
||||||
buyout_price = 0,
|
buyout_price = 0,
|
||||||
post_all = 1,
|
post_all = true,
|
||||||
hidden = nil,
|
hidden = false,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -554,7 +554,7 @@ function private.post_auctions()
|
|||||||
local unit_buyout_price = private.get_unit_buyout_price()
|
local unit_buyout_price = private.get_unit_buyout_price()
|
||||||
local stack_size = private.stack_size_slider:GetValue()
|
local stack_size = private.stack_size_slider:GetValue()
|
||||||
local stack_count
|
local stack_count
|
||||||
if private.post_all_checkbox:GetChecked() and not selected_item.charges then
|
if private.post_all_checkbox:GetChecked() and not selected_item.max_charges then
|
||||||
stack_count = floor(selected_item.aux_quantity / stack_size)
|
stack_count = floor(selected_item.aux_quantity / stack_size)
|
||||||
else
|
else
|
||||||
stack_count = private.stack_count_slider:GetValue()
|
stack_count = private.stack_count_slider:GetValue()
|
||||||
@@ -578,7 +578,7 @@ function private.post_auctions()
|
|||||||
unit_start_price,
|
unit_start_price,
|
||||||
unit_buyout_price,
|
unit_buyout_price,
|
||||||
stack_count,
|
stack_count,
|
||||||
private.post_all_checkbox:GetChecked() and not selected_item.charges,
|
private.post_all_checkbox:GetChecked() and not selected_item.max_charges,
|
||||||
function(posted, partial)
|
function(posted, partial)
|
||||||
local new_auction_record
|
local new_auction_record
|
||||||
for i = 1, posted do
|
for i = 1, posted do
|
||||||
@@ -619,7 +619,7 @@ function private.validate_parameters()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if private.stack_count_slider:GetValue() == 0 and (selected_item.charges or not private.post_all_checkbox:GetChecked()) then
|
if private.stack_count_slider:GetValue() == 0 and (selected_item.max_charges or not private.post_all_checkbox:GetChecked()) then
|
||||||
private.post_button:Disable()
|
private.post_button:Disable()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -696,13 +696,13 @@ function private.update_item_configuration()
|
|||||||
local deposit_factor = Aux.neutral and 0.25 or 0.05
|
local deposit_factor = Aux.neutral and 0.25 or 0.05
|
||||||
local stack_size = private.stack_size_slider:GetValue()
|
local stack_size = private.stack_size_slider:GetValue()
|
||||||
local stack_count
|
local stack_count
|
||||||
if private.post_all_checkbox:GetChecked() and not selected_item.charges then
|
if private.post_all_checkbox:GetChecked() and not selected_item.max_charges then
|
||||||
stack_count = floor(selected_item.aux_quantity / stack_size)
|
stack_count = floor(selected_item.aux_quantity / stack_size)
|
||||||
else
|
else
|
||||||
stack_count = private.stack_count_slider:GetValue()
|
stack_count = private.stack_count_slider:GetValue()
|
||||||
end
|
end
|
||||||
local deposit = floor(selected_item.unit_vendor_price * deposit_factor * (selected_item.charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(private.duration_dropdown) / 120
|
local deposit = floor(selected_item.unit_vendor_price * deposit_factor * (selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(private.duration_dropdown) / 120
|
||||||
if private.post_all_checkbox:GetChecked() and not selected_item.charges then
|
if private.post_all_checkbox:GetChecked() and not selected_item.max_charges then
|
||||||
local partial_stack = mod(selected_item.aux_quantity, stack_size)
|
local partial_stack = mod(selected_item.aux_quantity, stack_size)
|
||||||
deposit = deposit + floor(selected_item.unit_vendor_price * deposit_factor * partial_stack) * UIDropDownMenu_GetSelectedValue(private.duration_dropdown) / 120
|
deposit = deposit + floor(selected_item.unit_vendor_price * deposit_factor * partial_stack) * UIDropDownMenu_GetSelectedValue(private.duration_dropdown) / 120
|
||||||
end
|
end
|
||||||
@@ -728,7 +728,7 @@ end
|
|||||||
|
|
||||||
function private.quantity_update()
|
function private.quantity_update()
|
||||||
if selected_item then
|
if selected_item then
|
||||||
private.stack_count_slider:SetMinMaxValues(1, selected_item.charges and selected_item.availability[private.stack_size_slider:GetValue()] or floor(selected_item.availability[0] / private.stack_size_slider:GetValue()))
|
private.stack_count_slider:SetMinMaxValues(1, selected_item.max_charges and selected_item.availability[private.stack_size_slider:GetValue()] or floor(selected_item.availability[0] / private.stack_size_slider:GetValue()))
|
||||||
end
|
end
|
||||||
refresh = true
|
refresh = true
|
||||||
end
|
end
|
||||||
@@ -789,7 +789,7 @@ function private.set_item(item)
|
|||||||
private.hide_checkbox:SetChecked(settings.hidden)
|
private.hide_checkbox:SetChecked(settings.hidden)
|
||||||
private.post_all_checkbox:SetChecked(settings.post_all)
|
private.post_all_checkbox:SetChecked(settings.post_all)
|
||||||
|
|
||||||
private.stack_size_slider:SetMinMaxValues(1, selected_item.charges and 10 or selected_item.max_stack)
|
private.stack_size_slider:SetMinMaxValues(1, selected_item.max_charges or selected_item.max_stack)
|
||||||
private.stack_size_slider:SetValue(settings.stack_size)
|
private.stack_size_slider:SetValue(settings.stack_size)
|
||||||
private.quantity_update()
|
private.quantity_update()
|
||||||
private.stack_count_slider:SetValue(selected_item.aux_quantity) -- reduced to max possible
|
private.stack_count_slider:SetValue(selected_item.aux_quantity) -- reduced to max possible
|
||||||
@@ -836,9 +836,9 @@ function private.update_inventory_records()
|
|||||||
name = item_info.name,
|
name = item_info.name,
|
||||||
texture = item_info.texture,
|
texture = item_info.texture,
|
||||||
quality = item_info.quality,
|
quality = item_info.quality,
|
||||||
charges = item_info.charges,
|
|
||||||
aux_quantity = item_info.charges or item_info.count,
|
aux_quantity = item_info.charges or item_info.count,
|
||||||
max_stack = item_info.max_stack,
|
max_stack = item_info.max_stack,
|
||||||
|
max_charges = item_info.max_charges,
|
||||||
availability = availability,
|
availability = availability,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user