added back enhtooltip support and improved autocomplete
This commit is contained in:
@@ -128,17 +128,18 @@ end
|
|||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function show_dialog(buyout_mode, name, texture, quality, tooltip, stack_size, amount)
|
function show_dialog(buyout_mode, entry, amount)
|
||||||
AuxBuyConfirmation.tooltip = tooltip
|
AuxBuyConfirmation.tooltip = entry.tooltip
|
||||||
|
AuxBuyConfirmation.EnhTooltip_info = entry.EnhTooltip_info
|
||||||
|
|
||||||
AuxBuyConfirmationActionButton:Disable()
|
AuxBuyConfirmationActionButton:Disable()
|
||||||
AuxBuyConfirmationItem:SetNormalTexture(texture)
|
AuxBuyConfirmationItem:SetNormalTexture(entry.texture)
|
||||||
AuxBuyConfirmationItemName:SetText(name)
|
AuxBuyConfirmationItemName:SetText(entry.name)
|
||||||
local color = ITEM_QUALITY_COLORS[quality]
|
local color = ITEM_QUALITY_COLORS[entry.quality]
|
||||||
AuxBuyConfirmationItemName:SetTextColor(color.r, color.g, color.b)
|
AuxBuyConfirmationItemName:SetTextColor(color.r, color.g, color.b)
|
||||||
|
|
||||||
if stack_size > 1 then
|
if entry.stack_size > 1 then
|
||||||
AuxBuyConfirmationItemCount:SetText(stack_size);
|
AuxBuyConfirmationItemCount:SetText(entry.stack_size);
|
||||||
AuxBuyConfirmationItemCount:Show()
|
AuxBuyConfirmationItemCount:Show()
|
||||||
else
|
else
|
||||||
AuxBuyConfirmationItemCount:Hide()
|
AuxBuyConfirmationItemCount:Hide()
|
||||||
@@ -182,7 +183,7 @@ function find_auction(entry, buyout_mode, express_mode)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not express_mode then
|
if not express_mode then
|
||||||
show_dialog(buyout_mode, entry.name, entry.texture, entry.quality, entry.tooltip, entry.stack_size, amount)
|
show_dialog(buyout_mode, entry, amount)
|
||||||
end
|
end
|
||||||
|
|
||||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||||
@@ -312,7 +313,9 @@ function process_auction(auction_item, current_page)
|
|||||||
owner = auction_item.owner,
|
owner = auction_item.owner,
|
||||||
duration = auction_item.duration,
|
duration = auction_item.duration,
|
||||||
usable = auction_item.usable,
|
usable = auction_item.usable,
|
||||||
high_bidder = auction_item.high_bidder
|
high_bidder = auction_item.high_bidder,
|
||||||
|
|
||||||
|
EnhTooltip_info = auction_item.EnhTooltip_info,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -347,7 +347,7 @@
|
|||||||
</Layers>
|
</Layers>
|
||||||
<Scripts>
|
<Scripts>
|
||||||
<OnEnter>
|
<OnEnter>
|
||||||
Aux.info.set_game_tooltip(this, this:GetParent().tooltip, 'ANCHOR_LEFT')
|
Aux.info.set_game_tooltip(this, this:GetParent().tooltip, 'ANCHOR_LEFT', this:GetParent().EnhTooltip_info)
|
||||||
</OnEnter>
|
</OnEnter>
|
||||||
<OnLeave>
|
<OnLeave>
|
||||||
GameTooltip:Hide()
|
GameTooltip:Hide()
|
||||||
|
|||||||
+13
-11
@@ -33,7 +33,8 @@ function fuzzy(input)
|
|||||||
local rating = 0
|
local rating = 0
|
||||||
for i=4,getn(match)-1 do
|
for i=4,getn(match)-1 do
|
||||||
if strlen(match[i]) == 0 then
|
if strlen(match[i]) == 0 then
|
||||||
rating = rating + 1
|
rating = rating + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return rating
|
return rating
|
||||||
end
|
end
|
||||||
@@ -53,24 +54,27 @@ end
|
|||||||
|
|
||||||
function suggestions(input)
|
function suggestions(input)
|
||||||
local matcher = fuzzy(input)
|
local matcher = fuzzy(input)
|
||||||
|
function fuzzy_sort(array)
|
||||||
|
sort(array, function(a, b) return strlen(a.name) < strlen(b.name) end)
|
||||||
|
sort(array, function(a, b) return b.rating < a.rating end)
|
||||||
|
return array
|
||||||
|
end
|
||||||
|
|
||||||
local best = {}
|
local best = {}
|
||||||
for _, name in ipairs(item_names) do
|
for _, name in ipairs(item_names) do
|
||||||
local rating = matcher(name)
|
local rating = matcher(name)
|
||||||
if rating then
|
if rating then
|
||||||
|
local candidate = { name=name, rating=rating }
|
||||||
if getn(best) < NUM_MATCHES then
|
if getn(best) < NUM_MATCHES then
|
||||||
tinsert(best, { name=name, rating=rating })
|
tinsert(best, candidate)
|
||||||
sort(best, function(a, b) return a.rating < b.rating end)
|
fuzzy_sort(best)
|
||||||
else
|
else
|
||||||
if best[1].rating > rating then
|
best[getn(best)] = fuzzy_sort({ best[getn(best)], candidate })[1]
|
||||||
best[1] = { name=name, rating=rating }
|
fuzzy_sort(best)
|
||||||
Aux.util.merge_sort(best, function(a, b) return Aux.util.compare(strlen(a), strlen(b)) end)
|
|
||||||
Aux.util.merge_sort(best, function(a, b) return Aux.util.compare(strlen(b.rating), strlen(a.rating)) end)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return Aux.util.map(best, function(match) return match.name end)
|
return Aux.util.map(best, function(match) return match.name end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -103,8 +107,6 @@ end
|
|||||||
function Aux.completion.highlight_next(input_box)
|
function Aux.completion.highlight_next(input_box)
|
||||||
if getn(current_suggestions) > 0 then
|
if getn(current_suggestions) > 0 then
|
||||||
selected_index = selected_index > 0 and math.mod(selected_index + 1, getn(current_suggestions) + 1) or 1
|
selected_index = selected_index > 0 and math.mod(selected_index + 1, getn(current_suggestions) + 1) or 1
|
||||||
snipe.log(selected_index .. 'after')
|
|
||||||
snipe.log(current_input)
|
|
||||||
update_highlighting()
|
update_highlighting()
|
||||||
if selected_index == 0 then
|
if selected_index == 0 then
|
||||||
Aux.completion.set_quietly(input_box, current_input)
|
Aux.completion.set_quietly(input_box, current_input)
|
||||||
|
|||||||
@@ -74,23 +74,29 @@ function Aux.info.auction_item(index)
|
|||||||
auction_item.id = id
|
auction_item.id = id
|
||||||
auction_item.duration = duration
|
auction_item.duration = duration
|
||||||
auction_item.usable = usable
|
auction_item.usable = usable
|
||||||
|
|
||||||
auction_item.tooltip = Aux.info.tooltip(function(tt) tt:SetAuctionItem("list", index) end)
|
auction_item.tooltip = Aux.info.tooltip(function(tt) tt:SetAuctionItem("list", index) end)
|
||||||
auction_item.charges = item_charges(auction_item.tooltip)
|
auction_item.charges = item_charges(auction_item.tooltip)
|
||||||
|
|
||||||
|
auction_item.EnhTooltip_info = {
|
||||||
|
name = auction_item.name,
|
||||||
|
hyperlink = auction_item.hyperlink,
|
||||||
|
quality = auction_item.quality,
|
||||||
|
count = auction_item.count,
|
||||||
|
}
|
||||||
|
|
||||||
return auction_item
|
return auction_item
|
||||||
end
|
end
|
||||||
|
|
||||||
function Aux.info.set_game_tooltip(owner, tooltip, anchor)
|
function Aux.info.set_game_tooltip(owner, tooltip, anchor, EnhTooltip_info)
|
||||||
GameTooltip:SetOwner(owner, anchor)
|
GameTooltip:SetOwner(owner, anchor)
|
||||||
for _, line in ipairs(tooltip) do
|
for _, line in ipairs(tooltip) do
|
||||||
GameTooltip:AddDoubleLine(line[1].text, line[2].text, line[1].r, line[1].b, line[1].g, line[2].r, line[2].b, line[2].g, true)
|
GameTooltip:AddDoubleLine(line[1].text, line[2].text, line[1].r, line[1].b, line[1].g, line[2].r, line[2].b, line[2].g, true)
|
||||||
end
|
end
|
||||||
GameTooltip:Show()
|
GameTooltip:Show()
|
||||||
|
|
||||||
-- if EnhTooltip and entry then
|
if EnhTooltip and EnhTooltip_info then
|
||||||
-- EnhTooltip.TooltipCall(GameTooltip, entry.name, entry.hyperlink, entry.quality, entry.stack_size)
|
EnhTooltip.TooltipCall(GameTooltip, EnhTooltip_info.name, EnhTooltip_info.hyperlink, EnhTooltip_info.quality, EnhTooltip_info.count)
|
||||||
-- end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Aux.info.tooltip(setter)
|
function Aux.info.tooltip(setter)
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ function Aux.sheet.initialize(frame)
|
|||||||
icon:SetNormalTexture('Interface\\Buttons\\UI-Quickslot2')
|
icon:SetNormalTexture('Interface\\Buttons\\UI-Quickslot2')
|
||||||
icon:SetPushedTexture('Interface\\Buttons\\UI-Quickslot-Depress')
|
icon:SetPushedTexture('Interface\\Buttons\\UI-Quickslot-Depress')
|
||||||
icon:SetHighlightTexture('Interface\\Buttons\\ButtonHilight-Square')
|
icon:SetHighlightTexture('Interface\\Buttons\\ButtonHilight-Square')
|
||||||
icon:SetScript('OnEnter', function() Aux.info.set_game_tooltip(this, cell.tooltip, 'ANCHOR_RIGHT') end)
|
icon:SetScript('OnEnter', function() Aux.info.set_game_tooltip(this, cell.tooltip, 'ANCHOR_RIGHT', cell.EnhTooltip_info) end)
|
||||||
icon:SetScript('OnLeave', function() GameTooltip:Hide() end)
|
icon:SetScript('OnLeave', function() GameTooltip:Hide() end)
|
||||||
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
|
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
|
||||||
text:SetPoint("LEFT", icon, "RIGHT", 1, 0)
|
text:SetPoint("LEFT", icon, "RIGHT", 1, 0)
|
||||||
@@ -276,6 +276,7 @@ function Aux.sheet.initialize(frame)
|
|||||||
end,
|
end,
|
||||||
cell_setter = function(cell, datum)
|
cell_setter = function(cell, datum)
|
||||||
cell.tooltip = datum.tooltip
|
cell.tooltip = datum.tooltip
|
||||||
|
cell.EnhTooltip_info = datum.EnhTooltip_info
|
||||||
cell.icon.icon_texture:SetTexture(datum.texture)
|
cell.icon.icon_texture:SetTexture(datum.texture)
|
||||||
if not datum.usable then
|
if not datum.usable then
|
||||||
cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
|
cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
|
||||||
|
|||||||
Reference in New Issue
Block a user