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)
|
||||
AuxBuyConfirmation.tooltip = tooltip
|
||||
function show_dialog(buyout_mode, entry, amount)
|
||||
AuxBuyConfirmation.tooltip = entry.tooltip
|
||||
AuxBuyConfirmation.EnhTooltip_info = entry.EnhTooltip_info
|
||||
|
||||
AuxBuyConfirmationActionButton:Disable()
|
||||
AuxBuyConfirmationItem:SetNormalTexture(texture)
|
||||
AuxBuyConfirmationItemName:SetText(name)
|
||||
local color = ITEM_QUALITY_COLORS[quality]
|
||||
AuxBuyConfirmationItem:SetNormalTexture(entry.texture)
|
||||
AuxBuyConfirmationItemName:SetText(entry.name)
|
||||
local color = ITEM_QUALITY_COLORS[entry.quality]
|
||||
AuxBuyConfirmationItemName:SetTextColor(color.r, color.g, color.b)
|
||||
|
||||
if stack_size > 1 then
|
||||
AuxBuyConfirmationItemCount:SetText(stack_size);
|
||||
if entry.stack_size > 1 then
|
||||
AuxBuyConfirmationItemCount:SetText(entry.stack_size);
|
||||
AuxBuyConfirmationItemCount:Show()
|
||||
else
|
||||
AuxBuyConfirmationItemCount:Hide()
|
||||
@@ -182,7 +183,7 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||
@@ -312,7 +313,9 @@ function process_auction(auction_item, current_page)
|
||||
owner = auction_item.owner,
|
||||
duration = auction_item.duration,
|
||||
usable = auction_item.usable,
|
||||
high_bidder = auction_item.high_bidder
|
||||
high_bidder = auction_item.high_bidder,
|
||||
|
||||
EnhTooltip_info = auction_item.EnhTooltip_info,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -347,7 +347,7 @@
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<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>
|
||||
<OnLeave>
|
||||
GameTooltip:Hide()
|
||||
|
||||
+13
-11
@@ -33,7 +33,8 @@ function fuzzy(input)
|
||||
local rating = 0
|
||||
for i=4,getn(match)-1 do
|
||||
if strlen(match[i]) == 0 then
|
||||
rating = rating + 1
|
||||
rating = rating + 1
|
||||
end
|
||||
end
|
||||
return rating
|
||||
end
|
||||
@@ -53,24 +54,27 @@ end
|
||||
|
||||
function suggestions(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 = {}
|
||||
for _, name in ipairs(item_names) do
|
||||
local rating = matcher(name)
|
||||
if rating then
|
||||
local candidate = { name=name, rating=rating }
|
||||
if getn(best) < NUM_MATCHES then
|
||||
tinsert(best, { name=name, rating=rating })
|
||||
sort(best, function(a, b) return a.rating < b.rating end)
|
||||
tinsert(best, candidate)
|
||||
fuzzy_sort(best)
|
||||
else
|
||||
if best[1].rating > rating then
|
||||
best[1] = { name=name, rating=rating }
|
||||
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
|
||||
best[getn(best)] = fuzzy_sort({ best[getn(best)], candidate })[1]
|
||||
fuzzy_sort(best)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return Aux.util.map(best, function(match) return match.name end)
|
||||
end
|
||||
|
||||
@@ -103,8 +107,6 @@ end
|
||||
function Aux.completion.highlight_next(input_box)
|
||||
if getn(current_suggestions) > 0 then
|
||||
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()
|
||||
if selected_index == 0 then
|
||||
Aux.completion.set_quietly(input_box, current_input)
|
||||
|
||||
@@ -74,23 +74,29 @@ function Aux.info.auction_item(index)
|
||||
auction_item.id = id
|
||||
auction_item.duration = duration
|
||||
auction_item.usable = usable
|
||||
|
||||
auction_item.tooltip = Aux.info.tooltip(function(tt) tt:SetAuctionItem("list", index) end)
|
||||
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
|
||||
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)
|
||||
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)
|
||||
end
|
||||
GameTooltip:Show()
|
||||
|
||||
-- if EnhTooltip and entry then
|
||||
-- EnhTooltip.TooltipCall(GameTooltip, entry.name, entry.hyperlink, entry.quality, entry.stack_size)
|
||||
-- end
|
||||
if EnhTooltip and EnhTooltip_info then
|
||||
EnhTooltip.TooltipCall(GameTooltip, EnhTooltip_info.name, EnhTooltip_info.hyperlink, EnhTooltip_info.quality, EnhTooltip_info.count)
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.info.tooltip(setter)
|
||||
|
||||
@@ -262,7 +262,7 @@ function Aux.sheet.initialize(frame)
|
||||
icon:SetNormalTexture('Interface\\Buttons\\UI-Quickslot2')
|
||||
icon:SetPushedTexture('Interface\\Buttons\\UI-Quickslot-Depress')
|
||||
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)
|
||||
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
|
||||
text:SetPoint("LEFT", icon, "RIGHT", 1, 0)
|
||||
@@ -276,6 +276,7 @@ function Aux.sheet.initialize(frame)
|
||||
end,
|
||||
cell_setter = function(cell, datum)
|
||||
cell.tooltip = datum.tooltip
|
||||
cell.EnhTooltip_info = datum.EnhTooltip_info
|
||||
cell.icon.icon_texture:SetTexture(datum.texture)
|
||||
if not datum.usable then
|
||||
cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
|
||||
|
||||
Reference in New Issue
Block a user