From bdc515d51784adf9f4783e8ffef03e80d5858b2d Mon Sep 17 00:00:00 2001 From: Simon Hirsig Date: Thu, 13 May 2021 20:39:08 +0200 Subject: [PATCH] tbc update --- aux-addon.lua | 4 +- core/disenchant.lua | 105 +++++++++-- core/slash.lua | 10 +- frame.lua | 2 +- gui/auction_listing.lua | 4 +- gui/core.lua | 373 ++++++++++++++++++++-------------------- tabs/post/core.lua | 54 +++--- tabs/post/frame.lua | 239 +++++++++++++++++-------- tabs/search/filter.lua | 2 +- tabs/search/frame.lua | 3 +- tabs/search/results.lua | 4 +- util.lua | 2 +- util/filter.lua | 2 +- util/info.lua | 4 +- 14 files changed, 485 insertions(+), 323 deletions(-) diff --git a/aux-addon.lua b/aux-addon.lua index b0451f57..680cb7ca 100644 --- a/aux-addon.lua +++ b/aux-addon.lua @@ -55,8 +55,8 @@ function event.AUX_LOADED() ignore_owner = true, action_shortcuts = false, crafting_cost = true, - post_bid = false, - post_duration = post.DURATION_8, + post_bid = nil, + post_duration = post.DURATION_24, items = {}, item_ids = {}, unused_item_ids = {}, diff --git a/core/disenchant.lua b/core/disenchant.lua index 427dd710..e65bba15 100644 --- a/core/disenchant.lua +++ b/core/disenchant.lua @@ -114,45 +114,112 @@ function M.distribution(slot, quality, level) { item_id = 16204, min_quantity = 1, max_quantity = 2, probability = probability(.75, .22) }, { item_id = 16203, min_quantity = 1, max_quantity = 2, probability = probability(.2, .75) }, { item_id = 14344, min_quantity = 1, max_quantity = 1, probability = probability(.05, .03) }, - } + } + elseif level <= 65 then + return { + { item_id = 16204, min_quantity = 2, max_quantity = 5, probability = probability(.75, .22) }, + { item_id = 16203, min_quantity = 2, max_quantity = 3, probability = probability(.2, .75) }, + { item_id = 14344, min_quantity = 1, max_quantity = 1, probability = probability(.05, .03) }, + } + elseif level <= 79 then + return { + { item_id = 22445, min_quantity = 1, max_quantity = 3, probability = probability(.75, .22) }, + { item_id = 22447, min_quantity = 1, max_quantity = 3, probability = probability(.22, .75) }, + { item_id = 22448, min_quantity = 1, max_quantity = 1, probability = probability(.03, .03) }, + } + elseif level <= 99 then + return { + { item_id = 22445, min_quantity = 2, max_quantity = 3, probability = probability(.75, .22) }, + { item_id = 22447, min_quantity = 2, max_quantity = 3, probability = probability(.22, .75) }, + { item_id = 22448, min_quantity = 1, max_quantity = 1, probability = probability(.03, .03) }, + } else return { - { item_id = 16204, min_quantity = 2, max_quantity = 5, probability = probability(.75, .22) }, - { item_id = 16203, min_quantity = 2, max_quantity = 3, probability = probability(.2, .75) }, - { item_id = 14344, min_quantity = 1, max_quantity = 1, probability = probability(.05, .03) }, + { item_id = 22445, min_quantity = 2, max_quantity = 5, probability = probability(.75, .22) }, + { item_id = 22446, min_quantity = 1, max_quantity = 2, probability = probability(.22, .75) }, + { item_id = 22449, min_quantity = 1, max_quantity = 1, probability = probability(.03, .03) }, } end elseif quality == RARE then if level <= 25 then - return {{ item_id = 10978, min_quantity = 1, max_quantity = 1, probability = 1 }} + return { + { item_id = 10978, min_quantity = 1, max_quantity = 1, probability = 1 }, + } elseif level <= 30 then - return {{ item_id = 11084, min_quantity = 1, max_quantity = 1, probability = 1 }} + return { + { item_id = 11084, min_quantity = 1, max_quantity = 1, probability = 1 }, + } elseif level <= 35 then - return {{ item_id = 11138, min_quantity = 1, max_quantity = 1, probability = 1 }} + return { + { item_id = 11138, min_quantity = 1, max_quantity = 1, probability = 1 }, + } elseif level <= 40 then - return {{ item_id = 11139, min_quantity = 1, max_quantity = 1, probability = 1 }} + return { + { item_id = 11139, min_quantity = 1, max_quantity = 1, probability = 1 }, + } elseif level <= 45 then - return {{ item_id = 11177, min_quantity = 1, max_quantity = 1, probability = 1 }} + return { + { item_id = 11177, min_quantity = 1, max_quantity = 1, probability = 1 }, + } elseif level <= 50 then - return {{ item_id = 11178, min_quantity = 1, max_quantity = 1, probability = 1 }} + return { + { item_id = 11178, min_quantity = 1, max_quantity = 1, probability = 1 }, + } elseif level <= 55 then - return {{ item_id = 14343, min_quantity = 1, max_quantity = 1, probability = 1 }} - elseif level <= 60 then - return {{ item_id = 14344, min_quantity = 1, max_quantity = 1, probability = .995}, { item_id = 20725, min_quantity = 1, max_quantity = 1, probability = .005 }} + return { + { item_id = 14343, min_quantity = 1, max_quantity = 1, probability = 1 }, + } + elseif level <= 65 then + return { + { item_id = 14344, min_quantity = 1, max_quantity = 1, probability = .995 }, + { item_id = 20725, min_quantity = 1, max_quantity = 1, probability = .005 }, + } + elseif level <= 99 then + return { + { item_id = 22448, min_quantity = 1, max_quantity = 1, probability = .995 }, + { item_id = 20725, min_quantity = 1, max_quantity = 1, probability = .005 }, + } else - return {{ item_id = 14344, min_quantity = 1, max_quantity = 1, probability = .995}, { item_id = 20725, min_quantity = 1, max_quantity = 1, probability = .005 }} + return { + { item_id = 22449, min_quantity = 1, max_quantity = 1, probability = .995 }, + { item_id = 22450, min_quantity = 1, max_quantity = 1, probability = .005 }, + } end elseif quality == EPIC then if level <= 45 then - return {{ item_id = 11177, min_quantity = 2, max_quantity = 4, probability = 1 }} + return { + { item_id = 11177, min_quantity = 2, max_quantity = 4, probability = 1 }, + } elseif level <= 50 then - return {{ item_id = 11178, min_quantity = 2, max_quantity = 4, probability = 1 }} + return { + { item_id = 11178, min_quantity = 2, max_quantity = 4, probability = 1 }, + } elseif level <= 55 then - return {{ item_id = 14343, min_quantity = 2, max_quantity = 4, probability = 1 }} + return { + { item_id = 14343, min_quantity = 2, max_quantity = 4, probability = 1 }, + } elseif level <= 60 then - return {{ item_id = 20725, min_quantity = 1, max_quantity = 1, probability = 1 }} + return { + { item_id = 20725, min_quantity = 1, max_quantity = 1, probability = 1 }, + } + elseif level <= 75 then + return { + { item_id = 20725, min_quantity = 1, max_quantity = 2, probability = 1 }, + } + elseif level <= 80 then + return { + { item_id = 20725, min_quantity = 1, max_quantity = 1, probability = probability(.5, .33) }, + { item_id = 20725, min_quantity = 2, max_quantity = 2, probability = probability(.5, .67) }, + } + elseif level <= 100 then + return { + { item_id = 22450, min_quantity = 1, max_quantity = 2, probability = 1 }, + } else - return {{ item_id = 20725, min_quantity = 1, max_quantity = 2, probability = 1 }} + return { + { item_id = 22450, min_quantity = 1, max_quantity = 1, probability = .33 }, + { item_id = 22450, min_quantity = 2, max_quantity = 2, probability = .67 }, + } end end return {} diff --git a/core/slash.lua b/core/slash.lua index 76f06195..b3c04d03 100644 --- a/core/slash.lua +++ b/core/slash.lua @@ -25,10 +25,10 @@ function SlashCmdList.AUX(command) aux.account_data.action_shortcuts = not aux.account_data.action_shortcuts aux.print('action shortcuts ' .. status(aux.account_data.action_shortcuts)) elseif arguments[1] == 'post' and arguments[2] == 'bid' then - aux.account_data.post_bid = not aux.account_data.post_bid - aux.print('post bid ' .. status(aux.account_data.post_bid)) - elseif arguments[1] == 'post' and arguments[2] == 'duration' and ({['2'] = post.DURATION_2, ['8'] = post.DURATION_8, ['24'] = post.DURATION_24})[arguments[3]] then - aux.account_data.post_duration = ({['2'] = post.DURATION_2, ['8'] = post.DURATION_8, ['24'] = post.DURATION_24})[arguments[3]] + aux.account_data.post_bid = ({ unit = 'unit', stack = 'stack' })[arguments[3]] + aux.print('post bid ' .. aux.color.blue(aux.account_data.post_bid or 'off')) + elseif arguments[1] == 'post' and arguments[2] == 'duration' and ({ ['12'] = post.DURATION_12, ['24'] = post.DURATION_24, ['48'] = post.DURATION_48 })[arguments[3]] then + aux.account_data.post_duration = ({ ['12'] = post.DURATION_12, ['24'] = post.DURATION_24, ['48'] = post.DURATION_48 })[arguments[3]] aux.print('post duration ' .. aux.color.blue(info.duration_hours(aux.account_data.post_duration) .. 'h')) elseif arguments[1] == 'crafting' and arguments[2] == 'cost' then aux.account_data.crafting_cost = not aux.account_data.crafting_cost @@ -65,7 +65,7 @@ function SlashCmdList.AUX(command) aux.print('- scale [' .. aux.color.blue(aux.account_data.scale) .. ']') aux.print('- ignore owner [' .. status(aux.account_data.ignore_owner) .. ']') aux.print('- action shortcuts [' .. status(aux.account_data.action_shortcuts) .. ']') - aux.print('- post bid [' .. status(aux.account_data.post_bid) .. ']') + aux.print('- post bid [' .. aux.color.blue(aux.account_data.post_bid or 'off') .. ']') aux.print('- post duration [' .. aux.color.blue(info.duration_hours(aux.account_data.post_duration) .. 'h') .. ']') aux.print('- crafting cost [' .. status(aux.account_data.crafting_cost) .. ']') aux.print('- tooltip value [' .. status(tooltip_settings.value) .. ']') diff --git a/frame.lua b/frame.lua index 11ffe0c5..43a29718 100644 --- a/frame.lua +++ b/frame.lua @@ -12,7 +12,7 @@ function event.AUX_LOADED() end do - local frame = CreateFrame('Frame', 'aux_frame', UIParent) + local frame = CreateFrame('Frame', 'aux_frame', UIParent, 'BackdropTemplate') tinsert(UISpecialFrames, 'aux_frame') gui.set_window_style(frame) gui.set_size(frame, 768, 447) diff --git a/gui/auction_listing.lua b/gui/auction_listing.lua index 933597e4..64f0fb91 100644 --- a/gui/auction_listing.lua +++ b/gui/auction_listing.lua @@ -16,8 +16,8 @@ local HEAD_SPACE = 2 local TIME_LEFT_STRINGS = { aux.color.red'30m', -- Short aux.color.orange'2h', -- Medium - aux.color.yellow'8h', -- Long - aux.color.blue'24h', -- Very Long + aux.color.yellow'12h', -- Long + aux.color.blue'48h', -- Very Long } function item_column_init(rt, cell) diff --git a/gui/core.lua b/gui/core.lua index b7bf56e9..c2eef21f 100644 --- a/gui/core.lua +++ b/gui/core.lua @@ -10,28 +10,28 @@ M.font = (function() end)() M.font_size = aux.immutable-{ - small = 13, - medium = 15, - large = 18, + small = 13, + medium = 15, + large = 18, } do - local id = 1 - function M.unique_name() - id = id + 1 - return 'aux.frame' .. id - end + local id = 1 + function M.unique_name() + id = id + 1 + return 'aux.frame' .. id + end end function M.set_size(frame, width, height) - frame:SetWidth(width) - frame:SetHeight(height or width) + frame:SetWidth(width) + frame:SetHeight(height or width) end function M.set_frame_style(frame, backdrop_color, border_color, left, right, top, bottom) - frame:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=1.5, tile=true, insets={left=left, right=right, top=top, bottom=bottom}} - frame:SetBackdropColor(backdrop_color()) - frame:SetBackdropBorderColor(border_color()) + frame:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=1.5, tile=true, insets={left=left, right=right, top=top, bottom=bottom}} + frame:SetBackdropColor(backdrop_color()) + frame:SetBackdropBorderColor(border_color()) end function M.set_window_style(frame, left, right, top, bottom) @@ -47,7 +47,7 @@ function M.set_content_style(frame, left, right, top, bottom) end function M.panel(parent) - local panel = CreateFrame('Frame', nil, parent) + local panel = CreateFrame('Frame', nil, parent, 'BackdropTemplate') set_panel_style(panel) return panel end @@ -73,7 +73,7 @@ end function M.button(parent, text_height) text_height = text_height or font_size.large - local button = CreateFrame('Button', nil, parent) + local button = CreateFrame('Button', nil, parent, 'BackdropTemplate') set_size(button, 80, 24) set_content_style(button) local highlight = button:CreateTexture(nil, 'HIGHLIGHT') @@ -91,13 +91,13 @@ function M.button(parent, text_height) end button.default_Enable = button.Enable function button:Enable() - if self:IsEnabled() == 1 then return end + if self:IsEnabled() == 1 then return end self:GetFontString():SetTextColor(aux.color.text.enabled()) return self:default_Enable() end button.default_Disable = button.Disable function button:Disable() - if self:IsEnabled() == 0 then return end + if self:IsEnabled() == 0 then return end self:GetFontString():SetTextColor(aux.color.text.disabled()) return self:default_Disable() end @@ -106,99 +106,99 @@ function M.button(parent, text_height) end do - local mt = {__index={}} - function mt.__index:create_tab(text) - local id = #self._tabs + 1 - - local tab = CreateFrame('Button', unique_name(), self._frame) - tab.id = id - tab.group = self - tab:SetHeight(24) - set_panel_style(tab) - local dock = tab:CreateTexture(nil, 'OVERLAY') - dock:SetHeight(3) - if self._orientation == 'UP' then - dock:SetPoint('BOTTOMLEFT', 1, -1) - dock:SetPoint('BOTTOMRIGHT', -1, -1) - elseif self._orientation == 'DOWN' then - dock:SetPoint('TOPLEFT', 1, 1) - dock:SetPoint('TOPRIGHT', -1, 1) - end - dock:SetColorTexture(aux.color.panel.background()) - tab.dock = dock - local highlight = tab:CreateTexture(nil, 'HIGHLIGHT') - highlight:SetAllPoints() - highlight:SetColorTexture(1, 1, 1, .2) - tab.highlight = highlight - - tab.text = tab:CreateFontString() - tab.text:SetAllPoints() - tab.text:SetJustifyH('CENTER') - tab.text:SetJustifyV('CENTER') - tab.text:SetFont(font, font_size.large) - tab:SetFontString(tab.text) - - tab:SetText(text) - - tab:SetScript('OnClick', function(self) - if self.id ~= self.group.selected then - PlaySound(SOUNDKIT.IG_CHARACTER_INFO_TAB) + local mt = {__index={}} + function mt.__index:create_tab(text) + local id = #self._tabs + 1 + + local tab = CreateFrame('Button', unique_name(), self._frame, 'BackdropTemplate') + tab.id = id + tab.group = self + tab:SetHeight(24) + set_panel_style(tab) + local dock = tab:CreateTexture(nil, 'OVERLAY') + dock:SetHeight(3) + if self._orientation == 'UP' then + dock:SetPoint('BOTTOMLEFT', 1, -1) + dock:SetPoint('BOTTOMRIGHT', -1, -1) + elseif self._orientation == 'DOWN' then + dock:SetPoint('TOPLEFT', 1, 1) + dock:SetPoint('TOPRIGHT', -1, 1) + end + dock:SetColorTexture(aux.color.panel.background()) + tab.dock = dock + local highlight = tab:CreateTexture(nil, 'HIGHLIGHT') + highlight:SetAllPoints() + highlight:SetColorTexture(1, 1, 1, .2) + tab.highlight = highlight + + tab.text = tab:CreateFontString() + tab.text:SetAllPoints() + tab.text:SetJustifyH('CENTER') + tab.text:SetJustifyV('CENTER') + tab.text:SetFont(font, font_size.large) + tab:SetFontString(tab.text) + + tab:SetText(text) + + tab:SetScript('OnClick', function(self) + if self.id ~= self.group.selected then + PlaySound(SOUNDKIT.IG_CHARACTER_INFO_TAB) self.group:select(self.id) - end - end) - - if #self._tabs == 0 then - if self._orientation == 'UP' then - tab:SetPoint('BOTTOMLEFT', self._frame, 'TOPLEFT', 4, -1) - elseif self._orientation == 'DOWN' then - tab:SetPoint('TOPLEFT', self._frame, 'BOTTOMLEFT', 4, 1) - end - else - if self._orientation == 'UP' then - tab:SetPoint('BOTTOMLEFT', self._tabs[#self._tabs], 'BOTTOMRIGHT', 4, 0) - elseif self._orientation == 'DOWN' then - tab:SetPoint('TOPLEFT', self._tabs[#self._tabs], 'TOPRIGHT', 4, 0) - end - end - - tab:SetWidth(tab:GetFontString():GetStringWidth() + 14) - - tinsert(self._tabs, tab) - end - function mt.__index:select(id) - self._selected = id - self:update() - do (self._on_select or pass)(id) end - end - function mt.__index:update() - for _, tab in pairs(self._tabs) do - if tab.group._selected == tab.id then - tab.text:SetTextColor(aux.color.label.enabled()) - tab:Disable() - tab:SetBackdropColor(aux.color.panel.background()) - tab.dock:Show() - tab:SetHeight(29) - else - tab.text:SetTextColor(aux.color.text.enabled()) - tab:Enable() - tab:SetBackdropColor(aux.color.content.background()) - tab.dock:Hide() - tab:SetHeight(24) - end - end - end - function M.tabs(parent, orientation) - local self = { - _frame = parent, - _orientation = orientation, - _tabs = {}, - } - return setmetatable(self, mt) - end + end + end) + + if #self._tabs == 0 then + if self._orientation == 'UP' then + tab:SetPoint('BOTTOMLEFT', self._frame, 'TOPLEFT', 4, -1) + elseif self._orientation == 'DOWN' then + tab:SetPoint('TOPLEFT', self._frame, 'BOTTOMLEFT', 4, 1) + end + else + if self._orientation == 'UP' then + tab:SetPoint('BOTTOMLEFT', self._tabs[#self._tabs], 'BOTTOMRIGHT', 4, 0) + elseif self._orientation == 'DOWN' then + tab:SetPoint('TOPLEFT', self._tabs[#self._tabs], 'TOPRIGHT', 4, 0) + end + end + + tab:SetWidth(tab:GetFontString():GetStringWidth() + 14) + + tinsert(self._tabs, tab) + end + function mt.__index:select(id) + self._selected = id + self:update() + do (self._on_select or pass)(id) end + end + function mt.__index:update() + for _, tab in pairs(self._tabs) do + if tab.group._selected == tab.id then + tab.text:SetTextColor(aux.color.label.enabled()) + tab:Disable() + tab:SetBackdropColor(aux.color.panel.background()) + tab.dock:Show() + tab:SetHeight(29) + else + tab.text:SetTextColor(aux.color.text.enabled()) + tab:Enable() + tab:SetBackdropColor(aux.color.content.background()) + tab.dock:Hide() + tab:SetHeight(24) + end + end + end + function M.tabs(parent, orientation) + local self = { + _frame = parent, + _orientation = orientation, + _tabs = {}, + } + return setmetatable(self, mt) + end end function M.editbox(parent) - local editbox = CreateFrame('EditBox', nil, parent) + local editbox = CreateFrame('EditBox', nil, parent, 'BackdropTemplate') editbox:SetAutoFocus(false) editbox:SetTextInsets(1.5, 1.5, 3, 3) editbox:SetMaxLetters(nil) @@ -207,20 +207,22 @@ function M.editbox(parent) set_content_style(editbox) editbox:SetScript('OnEscapePressed', function(self) self:ClearFocus() - do (self.escape or pass)(self) end + do (self.escape or pass)(self) end + end) + editbox:SetScript('OnEnterPressed', function(self) + (self.enter or pass)(self) end) - editbox:SetScript('OnEnterPressed', function(self) (self.enter or pass)(self) end) editbox:SetScript('OnEditFocusGained', function(self) - if self.block_focus then + if self.block_focus then self.block_focus = false self:ClearFocus() - return - end + return + end self.overlay:Hide() self:SetTextColor(aux.color.text.enabled()) self.focused = true self:HighlightText() - do (self.focus_gain or pass)(self) end + do (self.focus_gain or pass)(self) end end) editbox:SetScript('OnEditFocusLost', function(self) self.overlay:Show() @@ -228,44 +230,45 @@ function M.editbox(parent) self.focused = false self:HighlightText(0, 0) self:SetScript('OnUpdate', nil) - do (self.focus_loss or pass)(self) end + do (self.focus_loss or pass)(self) end end) editbox:SetScript('OnTextChanged', function(self, is_user_input) - do (self.change or pass)(self, is_user_input) end + do (self.change or pass)(self, is_user_input) end self.overlay:SetText(self.formatter and self.formatter(self:GetText()) or self:GetText()) end) editbox:SetScript('OnChar', function(self) (self.char or pass)(self) end) do local last_click = { t = 0 } editbox:SetScript('OnMouseDown', function(self, button) - if button == 'RightButton' then + if button == 'RightButton' then self:SetText(self.reset_text or '') + do (self.change or pass)(self, true) end self:ClearFocus() self.block_focus = true - else - local x, y = GetCursorPosition() - -- local offset = x - editbox:GetLeft()*editbox:GetEffectiveScale() TODO use a fontstring to measure getstringwidth for structural highlighting - -- or use an overlay with itemlinks - if GetTime() - last_click.t < .5 and x == last_click.x and y == last_click.y then - aux.coro_thread(function() + else + local x, y = GetCursorPosition() + -- local offset = x - editbox:GetLeft()*editbox:GetEffectiveScale() TODO use a fontstring to measure getstringwidth for structural highlighting + -- or use an overlay with itemlinks + if GetTime() - last_click.t < .5 and x == last_click.x and y == last_click.y then + aux.coro_thread(function() aux.coro_wait() editbox:HighlightText() end) - end + end aux.wipe(last_click) - last_click.t = GetTime() - last_click.x = x - last_click.y = y - end + last_click.t = GetTime() + last_click.x = x + last_click.y = y + end end) end function editbox:SetAlignment(alignment) - self:SetJustifyH(alignment) - self.overlay:SetJustifyH(alignment) + self:SetJustifyH(alignment) + self.overlay:SetJustifyH(alignment) end function editbox:SetFontSize(size) - self:SetFont(font, size) - self.overlay:SetFont(font, size) + self:SetFont(font, size) + self.overlay:SetFont(font, size) end local overlay = label(editbox) overlay:SetPoint('LEFT', 1.5, 0) @@ -278,48 +281,48 @@ function M.editbox(parent) end do - local function update_alpha(self) - self:SetAlpha(1 - (sin(GetTime() * 180) + 1) / 4) + local function update_alpha(self) + self:SetAlpha(1 - (sin(GetTime() * 180) + 1) / 4) end - function M.status_bar(parent) - local self = CreateFrame('Frame', nil, parent) + function M.status_bar(parent) + local self = CreateFrame('Frame', nil, parent, 'BackdropTemplate') set_window_style(self) - do - local status_bar = CreateFrame('StatusBar', nil, self, 'TextStatusBar') - status_bar:SetOrientation('HORIZONTAL') - status_bar:SetMinMaxValues(0, 1) - status_bar:SetPoint('TOPLEFT', 1.5, -1.5) + do + local status_bar = CreateFrame('StatusBar', nil, self, 'TextStatusBar') + status_bar:SetOrientation('HORIZONTAL') + status_bar:SetMinMaxValues(0, 1) + status_bar:SetPoint('TOPLEFT', 1.5, -1.5) status_bar:SetPoint('BOTTOMRIGHT', -1.5, 1.5) status_bar:SetStatusBarTexture([[Interface\Buttons\WHITE8X8]]) - status_bar:SetStatusBarColor(.42, .42, .42, .7) - self.secondary_status_bar = status_bar - end - do - local status_bar = CreateFrame('StatusBar', nil, self.secondary_status_bar, 'TextStatusBar') - status_bar:SetOrientation('HORIZONTAL') - status_bar:SetMinMaxValues(0, 1) - status_bar:SetAllPoints() - status_bar:SetStatusBarTexture([[Interface\Buttons\WHITE8X8]]) - status_bar:SetStatusBarColor(.19, .22, .33, .9) - self.primary_status_bar = status_bar - end - function self:update_status(primary_status, secondary_status) + status_bar:SetStatusBarColor(.42, .42, .42, .7) + self.secondary_status_bar = status_bar + end + do + local status_bar = CreateFrame('StatusBar', nil, self.secondary_status_bar, 'TextStatusBar') + status_bar:SetOrientation('HORIZONTAL') + status_bar:SetMinMaxValues(0, 1) + status_bar:SetAllPoints() + status_bar:SetStatusBarTexture([[Interface\Buttons\WHITE8X8]]) + status_bar:SetStatusBarColor(.19, .22, .33, .9) + self.primary_status_bar = status_bar + end + function self:update_status(primary_status, secondary_status) if min(primary_status or 0, secondary_status or 0) < 1 then self:SetScript('OnUpdate', update_alpha) else self:SetScript('OnUpdate', nil) self:SetAlpha(1) end - if primary_status then - self.primary_status_bar:SetValue(primary_status) - end - if secondary_status then - self.secondary_status_bar:SetValue(secondary_status) - end - end - return self - end + if primary_status then + self.primary_status_bar:SetValue(primary_status) + end + if secondary_status then + self.secondary_status_bar:SetValue(secondary_status) + end + end + return self + end end function M.item(parent) @@ -432,6 +435,8 @@ do item_button = button(dropdown_frame, text_height) item_button:GetFontString():SetJustifyH('LEFT') dropdown_item_buttons[i] = item_button + else + item_button:GetFontString():SetFont(font, text_height) end if i > #options then item_button:Hide() @@ -493,7 +498,7 @@ end function M.slider(parent) - local slider = CreateFrame('Slider', nil, parent) + local slider = CreateFrame('Slider', nil, parent, 'BackdropTemplate') slider:SetOrientation('HORIZONTAL') slider:SetHeight(6) slider:SetHitRectInsets(0, 0, -12, -12) @@ -530,10 +535,10 @@ function M.slider(parent) end function M.checkbox(parent) - local checkbox = CreateFrame('CheckButton', nil, parent, 'UICheckButtonTemplate') + local checkbox = CreateFrame('CheckButton', nil, parent, 'UICheckButtonTemplate,BackdropTemplate') checkbox:SetWidth(16) checkbox:SetHeight(16) - set_content_style(checkbox) + set_content_style(checkbox) checkbox:SetNormalTexture(nil) checkbox:SetPushedTexture(nil) checkbox:GetHighlightTexture():SetAllPoints() @@ -544,27 +549,27 @@ function M.checkbox(parent) end do - local editbox = CreateFrame('EditBox') - editbox:SetAutoFocus(false) - function M.clear_focus() - editbox:SetFocus() - editbox:ClearFocus() - end + local editbox = CreateFrame('EditBox') + editbox:SetAutoFocus(false) + function M.clear_focus() + editbox:SetFocus() + editbox:ClearFocus() + end end function M.percentage_historical(pct, bid) - local text = (pct > 10000 and '>10000' or pct) .. '%' - if bid then - return aux.color.gray(text) - elseif pct < 50 then - return aux.color.blue(text) - elseif pct < 80 then - return aux.color.green(text) - elseif pct < 110 then - return aux.color.yellow(text) - elseif pct < 135 then - return aux.color.orange(text) - else - return aux.color.red(text) - end + local text = (pct > 10000 and '>10000' or pct) .. '%' + if bid then + return aux.color.gray(text) + elseif pct < 50 then + return aux.color.blue(text) + elseif pct < 80 then + return aux.color.green(text) + elseif pct < 110 then + return aux.color.yellow(text) + elseif pct < 135 then + return aux.color.orange(text) + else + return aux.color.red(text) + end end \ No newline at end of file diff --git a/tabs/post/core.lua b/tabs/post/core.lua index 216ad3cf..b350f093 100644 --- a/tabs/post/core.lua +++ b/tabs/post/core.lua @@ -19,7 +19,7 @@ local settings_schema = {'tuple', '#', {duration='number'}, {start_price='number local inventory_records, bid_records, buyout_records = {}, {}, {} -M.DURATION_2, M.DURATION_8, M.DURATION_24 = 1, 2, 3 +M.DURATION_12, M.DURATION_24, M.DURATION_48 = 1, 2, 3 refresh = true @@ -135,10 +135,10 @@ function update_auction_listing(listing, records, reference) local rows = {} if selected_item then local historical_value = history.value(selected_item.key) - local stack_size = stack_size_slider:GetValue() + local stack_size = stack_size_input:GetNumber() for _, record in pairs(records[selected_item.key] or empty) do - local price_color = tonumber(tostring(undercut(record, stack_size_slider:GetValue(), listing == 'bid'))) < reference and aux.color.red - local price = record.unit_price * (listing == 'bid' and record.stack_size or 1) + local price_color = tonumber(tostring(undercut(record, stack_size_input:GetNumber(), listing == 'bid'))) < reference and aux.color.red + local price = record.unit_price * (listing == 'bid' and aux.account_data.post_bid == 'stack' and record.stack_size or 1) tinsert(rows, { cols = { { value = record.own and aux.color.green(record.count) or record.count }, @@ -156,7 +156,7 @@ function update_auction_listing(listing, records, reference) { value = '---' }, { value = '---' }, { value = '---' }, - { value = money.to_string(historical_value * (listing == 'bid' and stack_size_slider:GetValue() or 1), true, nil, aux.color.green) }, + { value = money.to_string(historical_value * (listing == 'bid' and aux.account_data.post_bid == 'stack' and stack_size_input:GetNumber() or 1), true, nil, aux.color.green) }, { value = historical_value and gui.percentage_historical(100) or '---' }, }, record = { historical_value = true, stack_size = stack_size, unit_price = historical_value } @@ -206,11 +206,11 @@ function price_update() if selected_item then local historical_value = history.value(selected_item.key) if get_bid_selection() or get_buyout_selection() then - set_unit_start_price(undercut(get_bid_selection() or get_buyout_selection(), stack_size_slider:GetValue(), get_bid_selection())) + set_unit_start_price(undercut(get_bid_selection() or get_buyout_selection(), stack_size_input:GetNumber(), get_bid_selection())) unit_start_price_input:SetText(money.to_string(get_unit_start_price(), true, nil, nil, true)) end if get_buyout_selection() then - set_unit_buyout_price(undercut(get_buyout_selection(), stack_size_slider:GetValue())) + set_unit_buyout_price(undercut(get_buyout_selection(), stack_size_input:GetNumber())) unit_buyout_price_input:SetText(money.to_string(get_unit_buyout_price(), true, nil, nil, true)) end start_price_percentage:SetText(historical_value and gui.percentage_historical(aux.round(get_unit_start_price() / historical_value * 100)) or '---') @@ -223,8 +223,8 @@ function post_auction() local unit_start_price = get_unit_start_price() local unit_buyout_price = get_unit_buyout_price() - local stack_size = stack_size_slider:GetValue() - local stack_count = stack_count_slider:GetValue() + local stack_size = stack_size_input:GetNumber() + local stack_count = stack_count_input:GetNumber() local start_price = max(1, floor(get_unit_start_price() * stack_size)) local buyout_price = floor(get_unit_buyout_price() * stack_size) local duration = duration_dropdown:GetIndex() @@ -285,7 +285,7 @@ function validate_parameters() post_button:Disable() return end - if stack_count_slider:GetValue() == 0 then + if stack_count_input:GetNumber() == 0 then post_button:Disable() return end @@ -307,16 +307,16 @@ function update_item_configuration() unit_start_price_input:Hide() unit_buyout_price_input:Hide() - stack_size_slider:Hide() - stack_count_slider:Hide() + stack_size_input:Hide() + stack_count_input:Hide() deposit:Hide() duration_dropdown:Hide() hide_checkbox:Hide() else unit_start_price_input:Show() unit_buyout_price_input:Show() - stack_size_slider:Show() - stack_count_slider:Show() + stack_size_input:Show() + stack_count_input:Show() deposit:Show() duration_dropdown:Show() hide_checkbox:Show() @@ -333,9 +333,6 @@ function update_item_configuration() item.count:SetText() end - stack_size_slider.editbox:SetNumber(stack_size_slider:GetValue()) - stack_count_slider.editbox:SetNumber(stack_count_slider:GetValue()) - do local amount = deposit_amount() deposit:SetText('Deposit: ' .. money.to_string(amount, nil, nil, amount > GetMoney() and aux.color.red or aux.color.text.enabled)) @@ -346,17 +343,17 @@ function update_item_configuration() end function deposit_amount() - local deposit_factor = UnitFactionGroup'npc' and .05 or .25 - local duration_factor = info.duration_hours(duration_dropdown:GetIndex()) / 2 - local stack_size, stack_count = stack_size_slider:GetValue(), stack_count_slider:GetValue() + local deposit_factor = UnitFactionGroup'npc' and .15 or .75 + local duration_factor = info.duration_hours(duration_dropdown:GetIndex()) / 12 + local stack_size, stack_count = stack_size_input:GetNumber(), stack_count_input:GetNumber() return floor(selected_item.unit_vendor_price * deposit_factor * stack_size) * stack_count * duration_factor end -function undercut(record, stack_size, stack) +function undercut(record, stack_size, bid) if record.historical_value or record.own then return record.unit_price else - local stack_price = ceil(record.unit_price * (stack and record.stack_size or stack_size)) + local stack_price = ceil(record.unit_price * (bid and aux.account_data.post_bid == 'stack' and record.stack_size or stack_size)) stack_price = stack_price - 1 return stack_price / stack_size end @@ -364,10 +361,10 @@ end function quantity_update(maximize_count) if selected_item then - local max_stack_count = floor(selected_item.count / stack_size_slider:GetValue()) - stack_count_slider:SetMinMaxValues(min(1, max_stack_count), max_stack_count) + local max_stack_count = floor(selected_item.count / stack_size_input:GetNumber()) + stack_count_input.max_value = max_stack_count if maximize_count then - stack_count_slider:SetValue(max_stack_count) + stack_count_input:SetNumber(max_stack_count) end end refresh = true @@ -411,7 +408,7 @@ function update_item(item) do local options = {} - for _, i in ipairs{2, 8, 24} do + for _, i in ipairs{12, 24, 48} do tinsert(options, aux.pluralize(i .. ' ' .. HOURS)) end duration_dropdown:SetOptions(options) @@ -420,8 +417,9 @@ function update_item(item) hide_checkbox:SetChecked(settings.hidden) - stack_size_slider:SetMinMaxValues(1, min(item.max_stack, item.count)) - stack_size_slider:SetValue(math.huge) + local max_stack_size = min(item.max_stack, item.count) + stack_size_input.max_value = max_stack_size + stack_size_input:SetNumber(max_stack_size) quantity_update(true) unit_start_price_input:SetText(money.to_string(settings.start_price, true, nil, nil, true)) diff --git a/tabs/post/frame.lua b/tabs/post/frame.lua index 47ae3050..553f04f4 100644 --- a/tabs/post/frame.lua +++ b/tabs/post/frame.lua @@ -32,10 +32,11 @@ frame.bid_listing = gui.panel(frame.content) frame.bid_listing:SetHeight(228) frame.bid_listing:SetWidth(271.5) frame.bid_listing:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', 2.5, 0) +frame.bid_listing:Hide() frame.buyout_listing = gui.panel(frame.content) frame.buyout_listing:SetHeight(228) -frame.buyout_listing:SetWidth(271.5) +frame.buyout_listing:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', 2.5, 0) frame.buyout_listing:SetPoint('BOTTOMRIGHT', 0, 0) do @@ -74,50 +75,47 @@ do end bid_listing = listing.new(frame.bid_listing) -bid_listing:SetColInfo{ - {name='Auctions', width=.17, align='CENTER'}, - {name='Time\nLeft', width=.11, align='CENTER'}, - {name='Stack\nSize', width=.11, align='CENTER'}, - {name='Auction Bid\n(per stack)', width=.4, align='RIGHT'}, - {name='% Hist.\nValue', width=.21, align='CENTER'}, -} bid_listing:SetSelection(function(data) return selected_item and (data.record == get_bid_selection() or data.record.historical_value and get_bid_selection() and get_bid_selection().historical_value) end) bid_listing:SetHandler('OnClick', function(table, row_data, column, button) - if button == 'RightButton' and row_data.record == get_bid_selection() or row_data.record.historical_value and get_bid_selection() and get_bid_selection().historical_value then - set_bid_selection() + if button == 'RightButton' then + if row_data.record == get_bid_selection() or row_data.record.historical_value and get_bid_selection() and get_bid_selection().historical_value then + set_bid_selection() + end else set_bid_selection(row_data.record) end refresh = true end) bid_listing:SetHandler('OnDoubleClick', function(table, row_data, column, button) - stack_size_slider:SetValue(row_data.record.stack_size) + stack_size_input:SetNumber(row_data.record.stack_size) refresh = true end) buyout_listing = listing.new(frame.buyout_listing) buyout_listing:SetColInfo{ - {name='Auctions', width=.17, align='CENTER'}, - {name='Time\nLeft', width=.11, align='CENTER'}, - {name='Stack\nSize', width=.12, align='CENTER'}, - {name='Auction Buyout\n(per item)', width=.4, align='RIGHT'}, - {name='% Hist.\nValue', width=.20, align='CENTER'}, + {name='Auctions', width=.15, align='CENTER'}, + {name='Time Left', width=.15, align='CENTER'}, + {name='Stack Size', width=.15, align='CENTER'}, + {name='Auction Buyout (per item)', width=.4, align='RIGHT'}, + {name='% Hist. Value', width=.15, align='CENTER'}, } buyout_listing:SetSelection(function(data) return selected_item and (data.record == get_buyout_selection() or data.record.historical_value and get_buyout_selection() and get_buyout_selection().historical_value) end) buyout_listing:SetHandler('OnClick', function(table, row_data, column, button) - if button == 'RightButton' and row_data.record == get_buyout_selection() or row_data.record.historical_value and get_buyout_selection() and get_buyout_selection().historical_value then - set_buyout_selection() + if button == 'RightButton' then + if row_data.record == get_buyout_selection() or row_data.record.historical_value and get_buyout_selection() and get_buyout_selection().historical_value then + set_buyout_selection() + end else set_buyout_selection(row_data.record) end refresh = true end) buyout_listing:SetHandler('OnDoubleClick', function(table, row_data, column, button) - stack_size_slider:SetValue(row_data.record.stack_size) + stack_size_input:SetNumber(row_data.record.stack_size) refresh = true end) @@ -138,6 +136,7 @@ end do item = gui.item(frame.parameters) item:SetPoint('TOPLEFT', 10, -6) + item:SetScale(.9) item.button:SetScript('OnEnter', function(self) if selected_item then info.set_tooltip(selected_item.link, self, 'ANCHOR_RIGHT') @@ -159,70 +158,151 @@ do item.button:HookScript('OnClick', select_cursor_item) end do - local slider = gui.slider(frame.parameters) - slider:SetValueStep(1) - slider:SetPoint('TOPLEFT', 13, -73) - slider:SetWidth(190) - slider:SetScript('OnValueChanged', function(_, _, is_user_input) --- if is_user_input then -- TODO need to solve issue of slider click not counting as user input - quantity_update(true) - refresh = true --- end - end) - slider.editbox.change = function(self, is_user_input) - if is_user_input then - slider:SetValue(self:GetNumber()) - quantity_update(true) - end + local editbox = gui.editbox(frame.parameters) + editbox:SetPoint('TOPLEFT', 68, -63) + editbox:SetWidth(88) + editbox:SetHeight(22) + editbox:SetFontSize(17) + editbox:SetAlignment('CENTER') + editbox:SetNumeric(true) + editbox.reset_text = '1' + editbox.change = function(self) + self:SetNumber(aux.bounded(1, self.max_value, self:GetNumber())) + quantity_update(true) end - slider.editbox:SetScript('OnTabPressed', function() + editbox:SetScript('OnTabPressed', function() if not IsShiftKeyDown() then - stack_count_slider.editbox:SetFocus() + stack_count_input:SetFocus() end end) - slider.editbox:SetNumeric(true) - slider.editbox:SetMaxLetters(3) - slider.editbox.reset_text = '1' - slider.label:SetText('Stack Size') - stack_size_slider = slider + editbox.max_value = 1 + do + local label = gui.label(editbox, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -48, 1) + label:SetText('Stack Size') + end + do + local btn = gui.button(editbox, 17) + btn:SetPoint('RIGHT', editbox, 'LEFT', -1, 0) + btn:SetWidth(22) + btn:SetHeight(22) + btn:SetText('<') + btn:SetScript('OnClick', function() + editbox:SetNumber(editbox:GetNumber() - 1) + end) + end + do + local btn = gui.button(editbox, 17) + btn:SetPoint('RIGHT', editbox, 'LEFT', -24, 0) + btn:SetWidth(22) + btn:SetHeight(22) + btn:SetText('<<') + btn:SetScript('OnClick', function() + editbox:SetNumber(1) + end) + end + do + local btn = gui.button(editbox, 17) + btn:SetPoint('LEFT', editbox, 'RIGHT', 1, 0) + btn:SetWidth(22) + btn:SetHeight(22) + btn:SetText('>') + btn:SetScript('OnClick', function() + editbox:SetNumber(editbox:GetNumber() + 1) + end) + end + do + local btn = gui.button(editbox, 17) + btn:SetPoint('LEFT', editbox, 'RIGHT', 24, 0) + btn:SetWidth(22) + btn:SetHeight(22) + btn:SetText('>>') + btn:SetScript('OnClick', function() + editbox:SetNumber(editbox.max_value) + end) + end + stack_size_input = editbox end do - local slider = gui.slider(frame.parameters) - slider:SetValueStep(1) - slider:SetPoint('TOPLEFT', stack_size_slider, 'BOTTOMLEFT', 0, -32) - slider:SetWidth(190) - slider:SetScript('OnValueChanged', function(_, _, is_user_input) --- if is_user_input then - quantity_update() --- end - end) - slider.editbox.change = function(self, is_user_input) - if is_user_input then - slider:SetValue(self:GetNumber()) - quantity_update() - end + local editbox = gui.editbox(frame.parameters) + editbox:SetPoint('TOPLEFT', stack_size_input, 'BOTTOMLEFT', 0, -19) + editbox:SetWidth(88) + editbox:SetHeight(22) + editbox:SetFontSize(17) + editbox:SetAlignment('CENTER') + editbox:SetNumeric(true) + editbox.reset_text = '1' + editbox.change = function(self) + self:SetNumber(aux.bounded(1, self.max_value, self:GetNumber())) + quantity_update() end - slider.editbox:SetScript('OnTabPressed', function() + editbox:SetScript('OnTabPressed', function() if IsShiftKeyDown() then - stack_size_slider.editbox:SetFocus() + stack_size_input:SetFocus() else duration_dropdown:SetFocus() end end) - slider.editbox:SetNumeric(true) - slider.label:SetText('Stack Count') - stack_count_slider = slider + editbox.max_value = 1 + do + local label = gui.label(editbox, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -48, 1) + label:SetText('Stack Count') + end + do + local btn = gui.button(editbox, 17) + btn:SetPoint('RIGHT', editbox, 'LEFT', -1, 0) + btn:SetWidth(22) + btn:SetHeight(22) + btn:SetText('<') + btn:SetScript('OnClick', function() + editbox:SetNumber(editbox:GetNumber() - 1) + end) + end + do + local btn = gui.button(editbox, 17) + btn:SetPoint('RIGHT', editbox, 'LEFT', -24, 0) + btn:SetWidth(22) + btn:SetHeight(22) + btn:SetText('<<') + btn:SetScript('OnClick', function() + editbox:SetNumber(1) + end) + end + do + local btn = gui.button(editbox, 17) + btn:SetPoint('LEFT', editbox, 'RIGHT', 1, 0) + btn:SetWidth(22) + btn:SetHeight(22) + btn:SetText('>') + btn:SetScript('OnClick', function() + editbox:SetNumber(editbox:GetNumber() + 1) + end) + end + do + local btn = gui.button(editbox, 17) + btn:SetPoint('LEFT', editbox, 'RIGHT', 24, 0) + btn:SetWidth(22) + btn:SetHeight(22) + btn:SetText('>>') + btn:SetScript('OnClick', function() + editbox:SetNumber(editbox.max_value) + end) + end + stack_count_input = editbox end do local dropdown = gui.dropdown(frame.parameters, gui.font_size.large) - dropdown.selection_change = function() duration_selection_change() end - dropdown:SetPoint('TOPLEFT', stack_count_slider, 'BOTTOMLEFT', 0, -25) + dropdown.selection_change = function() + duration_selection_change() + end + dropdown:SetPoint('TOPLEFT', stack_count_input, 'BOTTOMLEFT', -45, -19) dropdown:SetWidth(90) dropdown:SetHeight(22) dropdown:SetFontSize(17) dropdown:SetScript('OnTabPressed', function() if IsShiftKeyDown() then - stack_count_slider.editbox:SetFocus() + stack_count_input:SetFocus() else unit_start_price_input:SetFocus() end @@ -248,7 +328,7 @@ do end do local editbox = gui.editbox(frame.parameters) - editbox:SetPoint('TOPRIGHT', -71, -60) + editbox:SetPoint('TOPRIGHT', -71, -63) editbox:SetWidth(180) editbox:SetHeight(22) editbox:SetAlignment('RIGHT') @@ -270,6 +350,7 @@ do set_buyout_selection() set_unit_start_price(money.from_string(self:GetText()) or 0) end + unit_buyout_price_input.reset_text = self:GetText() end editbox.enter = function(self) self:ClearFocus() @@ -312,6 +393,7 @@ do set_buyout_selection() set_unit_buyout_price(money.from_string(self:GetText()) or 0) end + unit_start_price_input.reset_text = self:GetText() end editbox.enter = function(self) self:ClearFocus() @@ -340,15 +422,24 @@ do end function aux.event.AUX_LOADED() - if not aux.account_data.post_bid then - frame.bid_listing:Hide() - frame.buyout_listing:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', 2.5, 0) - buyout_listing:SetColInfo{ - {name='Auctions', width=.15, align='CENTER'}, - {name='Time Left', width=.15, align='CENTER'}, - {name='Stack Size', width=.15, align='CENTER'}, - {name='Auction Buyout (per item)', width=.4, align='RIGHT'}, - {name='% Hist. Value', width=.15, align='CENTER'}, - } + if aux.account_data.post_bid then + frame.bid_listing:Show() + bid_listing:SetColInfo{ + {name='Auctions', width=.17, align='CENTER'}, + {name='Time\nLeft', width=.11, align='CENTER'}, + {name='Stack\nSize', width=.11, align='CENTER'}, + {name='Auction Bid\n' .. (aux.account_data.post_bid == 'unit' and '(per item)' or '(per stack)'), width=.4, align='RIGHT'}, + {name='% Hist.\nValue', width=.21, align='CENTER'}, + } + frame.buyout_listing:ClearAllPoints() + frame.buyout_listing:SetWidth(271.5) + frame.buyout_listing:SetPoint('BOTTOMRIGHT', 0, 0) + buyout_listing:SetColInfo{ + {name='Auctions', width=.17, align='CENTER'}, + {name='Time\nLeft', width=.11, align='CENTER'}, + {name='Stack\nSize', width=.12, align='CENTER'}, + {name='Auction Buyout\n(per item)', width=.4, align='RIGHT'}, + {name='% Hist.\nValue', width=.20, align='CENTER'}, + } end end \ No newline at end of file diff --git a/tabs/search/filter.lua b/tabs/search/filter.lua index 1fba9d1f..ae0cbcd2 100644 --- a/tabs/search/filter.lua +++ b/tabs/search/filter.lua @@ -15,7 +15,7 @@ end function valid_level(str) local level = tonumber(str) - return level and aux.bounded(1, 60, level) + return level and aux.bounded(1, 70, level) end blizzard_query = setmetatable({}, { diff --git a/tabs/search/frame.lua b/tabs/search/frame.lua index 9ce3dd9d..3cecb234 100644 --- a/tabs/search/frame.lua +++ b/tabs/search/frame.lua @@ -62,6 +62,7 @@ do local btn = gui.button(frame, gui.font_size.small) btn:SetHeight(25) btn:SetWidth(45) + btn:SetText('Live') btn:SetScript('OnClick', function(self) update_mode(mode == ALL_MODE and NEW_MODE or ALL_MODE) end) @@ -431,7 +432,7 @@ do button:SetScript('OnClick', add_form_component) end do - local scroll_frame = CreateFrame('ScrollFrame', nil, frame.filter) + local scroll_frame = CreateFrame('ScrollFrame', nil, frame.filter, 'BackdropTemplate') scroll_frame:SetWidth(395) scroll_frame:SetHeight(270) scroll_frame:SetPoint('TOPLEFT', 348.5, -47) diff --git a/tabs/search/results.lua b/tabs/search/results.lua index 4d9bac01..aaf5379c 100644 --- a/tabs/search/results.lua +++ b/tabs/search/results.lua @@ -25,9 +25,9 @@ end function update_mode(mode) _M.mode = mode if mode == ALL_MODE then - mode_button:SetText('All') + mode_button:SetBackdropColor(aux.color.content.background()) else - mode_button:SetText('New') + mode_button:SetBackdropColor(aux.color.state.enabled()) end end diff --git a/util.lua b/util.lua index b1134ebf..354b5d9b 100644 --- a/util.lua +++ b/util.lua @@ -11,7 +11,7 @@ M.immutable = setmetatable({}, { function M.pluralize(text) local text = gsub(text, '(-?%d+)(.-)|4([^;]-);', function(number_string, gap, number_forms) local singular, dual, plural - _, _, singular, dual, plural = strfind(number_forms, '(.+):(.+):(.+)'); + _, _, singular, dual, plural = strfind(number_forms, '(.+):(.+):(.+)') if not singular then _, _, singular, plural = strfind(number_forms, '(.+):(.+)') end diff --git a/util/filter.lua b/util/filter.lua index 0fc6dc0c..fa482c26 100644 --- a/util/filter.lua +++ b/util/filter.lua @@ -212,7 +212,7 @@ do if self.exact then return end local number = tonumber(select(3, strfind(str, '^(%d+)$')) or nil) if number then - if number >= 1 and number <= 60 then + if number >= 1 and number <= 70 then for _, key in ipairs{'min_level', 'max_level'} do if not self[key] then self[key] = {str, number} diff --git a/util/info.lua b/util/info.lua index 95da8157..3a3391a2 100644 --- a/util/info.lua +++ b/util/info.lua @@ -5,7 +5,7 @@ local aux = require 'aux' CreateFrame('GameTooltip', 'AuxTooltip', nil, 'GameTooltipTemplate') do - local map = { [1] = 2, [2] = 8, [3] = 24 } + local map = { [1] = 12, [2] = 24, [3] = 48 } function M.duration_hours(duration_code) return map[duration_code] end @@ -248,7 +248,7 @@ function M.item_key(link) end function M.parse_link(link) - local _, _, item_id, enchant_id, suffix_id, unique_id, name = strfind(link, '|Hitem:(%d*):(%d*):::::(%d*):(%d*)[:0-9]*|h%[(.-)%]|h') + local _, _, item_id, enchant_id, suffix_id, unique_id, name = strfind(link, '|Hitem:(%d*):(%d*):::::(%-?%d*):(%d*)[:0-9]*|h%[(.-)%]|h') return tonumber(item_id) or 0, tonumber(suffix_id) or 0, tonumber(unique_id) or 0, tonumber(enchant_id) or 0, name end