Mercurial > wow > askmrrobot
changeset 61:cf2b6b9a8337 v23
6.2 update, shopping list bug fixes, ui scale option
author | yellowfive |
---|---|
date | Tue, 23 Jun 2015 00:27:21 -0700 |
parents | 017c05f42fd4 |
children | 8b37293e9ea5 |
files | AskMrRobot-Serializer/AskMrRobot-Serializer.lua AskMrRobot.toc CombatLog.lua Constants.lua Core.lua Gear.lua Loot.lua Options.lua Shopping.lua localization/enUS.lua localization/frFR.lua ui/AmrUiDropDown.lua ui/AmrUiFrame.lua ui/AmrUiTextarea.lua ui/Ui.lua |
diffstat | 15 files changed, 168 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Tue Jun 23 00:27:21 2015 -0700 @@ -1,7 +1,7 @@ -- AskMrRobot-Serializer will serialize and communicate character data between users. -- This is used primarily to associate character information to logs uploaded to askmrrobot.com. -local MAJOR, MINOR = "AskMrRobot-Serializer", 22 +local MAJOR, MINOR = "AskMrRobot-Serializer", 23 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not Amr then return end -- already loaded by something else @@ -153,7 +153,8 @@ TheEverbloom = 1279, UpperBlackrockSpire = 1358, Highmaul = 1228, - BlackrockFoundry = 1205 + BlackrockFoundry = 1205, + HellfireCitadel = 1448 } -- instances that AskMrRobot currently supports logging for @@ -167,7 +168,8 @@ --[1279] = true, --[1358] = true, [1228] = true, - [1205] = true + [1205] = true, + [1448] = true } Amr.SPEC_WARRIORPROTECTION = 34
--- a/AskMrRobot.toc Sun Jun 07 15:20:25 2015 -0700 +++ b/AskMrRobot.toc Tue Jun 23 00:27:21 2015 -0700 @@ -1,7 +1,7 @@ -## Interface: 60100 +## Interface: 60200 ## Title: Ask Mr. Robot ## Author: Team Robot, Inc. -## Version: 22 +## Version: 23 ## Notes: Gear import/export, combat logging, and more. ## URL: www.askmrrobot.com ## SavedVariables: AskMrRobotDb2
--- a/CombatLog.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/CombatLog.lua Tue Jun 23 00:27:21 2015 -0700 @@ -54,7 +54,7 @@ chkLfr:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", w + 20, -30) container:AddChild(chkLfr) - return lbl + return lbl, chkNormal end -- renders the main UI for the Combat Log tab @@ -173,18 +173,20 @@ _autoChecks = {} -- go through all supported instances, rendering in a left->right pattern, 2 per row - local autoSections = {} + local autoLbls = {} + local autoChks = {} for i, instanceId in ipairs(Amr.InstanceIdsOrdered) do - local autoSection = renderAutoLogSection(instanceId, container) + local autoLbl, autoChk = renderAutoLogSection(instanceId, container) if i == 1 then - autoSection:SetPoint("TOPLEFT", _chkAutoAll.frame, "BOTTOMLEFT", -1, -15) + autoLbl:SetPoint("TOPLEFT", _chkAutoAll.frame, "BOTTOMLEFT", -1, -15) elseif i % 2 == 0 then - autoSection:SetPoint("TOPLEFT", autoSections[i - 1].frame, "TOPRIGHT", 40, 0) + autoLbl:SetPoint("TOPLEFT", autoLbls[i - 1].frame, "TOPRIGHT", 40, 0) else - autoSection:SetPoint("TOPLEFT", autoSections[i - 2].frame, "BOTTOMLEFT", 0, -15) + autoLbl:SetPoint("TOPLEFT", autoChks[i - 2].frame, "BOTTOMLEFT", 0, -30) end - table.insert(autoSections, autoSection) + table.insert(autoLbls, autoLbl) + table.insert(autoChks, autoChk) end autoSections = nil
--- a/Constants.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/Constants.lua Tue Jun 23 00:27:21 2015 -0700 @@ -102,7 +102,7 @@ } -- instance IDs ordered in preferred display order -Amr.InstanceIdsOrdered = { 1205, 1228 } +Amr.InstanceIdsOrdered = { 1448, 1205, 1228 } Amr.Difficulties = { Lfr = 17,
--- a/Core.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/Core.lua Tue Jun 23 00:27:21 2015 -0700 @@ -87,7 +87,8 @@ shopWindow = {}, -- shopping list window position settings options = { autoGear = false, -- auto-equip saved gear sets when changing specs - shopAh = false -- auto-show shopping list at AH + shopAh = false, -- auto-show shopping list at AH + uiScale = 1 -- custom scale for AMR UI }, Logging = { -- global logging settings Auto = {} -- for each instanceId, for each difficultyId, true if auto-logging enabled @@ -211,6 +212,7 @@ version = "PrintVersions", wipe = "Wipe", undowipe = "UndoWipe", + reset = "Reset", test = "Test" }
--- a/Gear.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/Gear.lua Tue Jun 23 00:27:21 2015 -0700 @@ -159,7 +159,7 @@ end) panelGear:AddChild(btnEquip) - local btnShop = AceGUI:Create("AmrUiButton") + --[[local btnShop = AceGUI:Create("AmrUiButton") btnShop:SetText(L.GearButtonShop) btnShop:SetBackgroundColor(Amr.Colors.Blue) btnShop:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.White)) @@ -168,7 +168,7 @@ btnShop:SetPoint("LEFT", btnEquip.frame, "RIGHT", 75, 0) btnShop:SetPoint("RIGHT", panelMods.content, "RIGHT", -20, 0) btnShop:SetCallback("OnClick", function(widget) Amr:ShowShopWindow() end) - panelMods:AddChild(btnShop) + panelMods:AddChild(btnShop)]] -- each physical item can only be used once, this tracks ones we have already used local usedItems = {} @@ -393,6 +393,17 @@ container:AddChild(t) _gearTabs = t; + local btnShop = AceGUI:Create("AmrUiButton") + btnShop:SetText(L.GearButtonShop) + btnShop:SetBackgroundColor(Amr.Colors.Blue) + btnShop:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.White)) + btnShop:SetWidth(245) + btnShop:SetHeight(26) + btnShop:SetPoint("TOPRIGHT", container.content, "TOPRIGHT", -20, -25) + btnShop:SetCallback("OnClick", function(widget) Amr:ShowShopWindow() end) + container:AddChild(btnShop) + + if not _activeTab then _activeTab = tostring(GetActiveSpecGroup()) end @@ -475,6 +486,7 @@ _pendingEquip.tries = _pendingEquip.tries + 1 if _pendingEquip.tries > 16 then + -- too many tries, just give up (shouldn't happen but just to be safe) _pendingEquip = nil else -- start over again, trying any items that could not be equipped in the previous pass (unique constraints) @@ -494,18 +506,20 @@ -- find the best matching item - -- equipped items + -- equipped items, but skip slots we have just equipped (to avoid e.g. just moving 2 of the same item back and forth between mh oh weapon slots) for slotNum = 1, #Amr.SlotIds do local slotId = Amr.SlotIds[slotNum] - local itemLink = GetInventoryItemLink("player", slotId) - if itemLink then - local invItem = Amr.ParseItemLink(itemLink) - if invItem ~= nil then - local diff = countItemDifferences(item, invItem) - if diff < bestDiff then - bestItem = { slot = slotId } - bestDiff = diff - bestLink = itemLink + if not _pendingEquip.doneSlots[slotId] then + local itemLink = GetInventoryItemLink("player", slotId) + if itemLink then + local invItem = Amr.ParseItemLink(itemLink) + if invItem ~= nil then + local diff = countItemDifferences(item, invItem) + if diff < bestDiff then + bestItem = { slot = slotId } + bestDiff = diff + bestLink = itemLink + end end end end @@ -577,6 +591,8 @@ end PickupInventoryItem(slotId) ClearCursor() + + -- wait for game events to continue end end @@ -607,6 +623,7 @@ end -- move on to the next item, this item is done + _pendingEquip.doneSlots[_pendingEquip.destSlot] = true _pendingEquip.itemsToEquip[_pendingEquip.destSlot] = nil _pendingEquip.destSlot = nil _pendingEquip.bag = nil @@ -670,6 +687,7 @@ spec = spec, itemsToEquip = itemsToEquip, remaining = remaining, + doneSlots = {}, nextSlot = firstSlot }
--- a/Loot.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/Loot.lua Tue Jun 23 00:27:21 2015 -0700 @@ -956,6 +956,11 @@ _frameLoot:SetBorderColor(Amr.Colors.BorderBlue) _frameLoot:SetBackgroundColor(Amr.Colors.Bg) + if Amr.db.profile.options.uiScale ~= 1 then + local scale = tonumber(Amr.db.profile.options.uiScale) + _frameLoot:SetScale(scale) + end + local lbl = AceGUI:Create("AmrUiLabel") lbl:SetWidth(600) lbl:SetFont(Amr.CreateFont("Bold", 28, Amr.Colors.White))
--- a/Options.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/Options.lua Tue Jun 23 00:27:21 2015 -0700 @@ -5,6 +5,28 @@ local _chkMinimap local _chkAutoGear local _chkAh +local _txtScale + +local function onTextboxEnter(widget) + local setting = widget:GetUserData("setting") + local val = widget:GetText() + + val = tonumber(val) + if not val then + widget:SetText(Amr.db.profile.options[setting]) + else + if setting == "uiScale" then + if val < 0.5 then + val = 0.5 + elseif val > 1.5 then + val = 1.5 + end + end + + Amr.db.profile.options[setting] = val + Amr:RefreshConfig() + end +end local function onCheckClick(widget) local setting = widget:GetUserData("setting") @@ -42,6 +64,34 @@ return chk, desc end +local function createSmallTextbox(container, setting, text, description) + + local txt = AceGUI:Create("AmrUiTextarea") + txt:SetUserData("setting", setting) + txt:SetMultiLine(false) + txt:SetWidth(35) + txt:SetHeight(24) + txt:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.Text)) + txt:SetCallback("OnEnterPressed", onTextboxEnter) + container:AddChild(txt) + + local lbl = AceGUI:Create("AmrUiLabel") + lbl:SetWidth(600) + lbl:SetText(text) + lbl:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.Text)) + lbl:SetPoint("LEFT", txt.frame, "RIGHT", 6, 0) + container:AddChild(lbl) + + local desc = AceGUI:Create("AmrUiLabel") + desc:SetWidth(800) + desc:SetText(description) + desc:SetFont(Amr.CreateFont("Italic", 12, Amr.Colors.TextTan)) + desc:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 0, -4) + container:AddChild(desc) + + return txt, desc +end + -- renders the main UI for the Combat Log tab function Amr:RenderTabOptions(container) @@ -55,7 +105,7 @@ local desc, desc2 _chkMinimap, desc = createCheck(container, "minimap", L.OptionsHideMinimapName, L.OptionsHideMinimapDesc) - _chkMinimap:SetPoint("TOPLEFT", header.frame, "BOTTOMLEFT", 0, -20) + _chkMinimap:SetPoint("TOPLEFT", header.frame, "BOTTOMLEFT", 10, -20) _chkAutoGear, desc2 = createCheck(container, "autoGear", L.OptionsAutoGearName, L.OptionsAutoGearDesc) _chkAutoGear:SetPoint("TOPLEFT", desc.frame, "BOTTOMLEFT", -24, -20) @@ -63,6 +113,9 @@ _chkAh, desc = createCheck(container, "shopAh", L.OptionsShopAhName, L.OptionsShopAhDesc) _chkAh:SetPoint("TOPLEFT", desc2.frame, "BOTTOMLEFT", -24, -20) + _txtScale, desc2 = createSmallTextbox(container, "uiScale", L.OptionsUiScaleName, L.OptionsUiScaleDesc) + _txtScale:SetPoint("TOPLEFT", desc.frame, "BOTTOMLEFT", -43, -20) + -- initialize state of controls Amr:RefreshOptionsUi() end @@ -84,4 +137,9 @@ if _chkAh then _chkAh:SetChecked(self.db.profile.options.shopAh) end + + if _txtScale then + _txtScale:SetText(self.db.profile.options.uiScale) + _txtScale:ClearFocus() + end end \ No newline at end of file
--- a/Shopping.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/Shopping.lua Tue Jun 23 00:27:21 2015 -0700 @@ -58,6 +58,11 @@ _frameShop:SetBorderColor(Amr.Colors.BorderBlue) _frameShop:SetBackgroundColor(Amr.Colors.Bg) + if Amr.db.profile.options.uiScale ~= 1 then + local scale = tonumber(Amr.db.profile.options.uiScale) + _frameShop:SetScale(scale) + end + local lbl = AceGUI:Create("AmrUiLabel") lbl:SetWidth(400) lbl:SetFont(Amr.CreateFont("Bold", 28, Amr.Colors.White)) @@ -214,14 +219,14 @@ _panelContent:AddChild(lbl) else -- set labels on checkboxes - if data.specs[1] then + if data.specs[1] and data.specs[1] ~= 0 then local id, name = GetSpecializationInfoByID(Amr.GetGameSpecId(data.specs[1])) _chk1:SetText(name .. " " .. L.ShopSpecLabel) _chk1:SetVisible(true) _chk1:SetChecked(_specs[1]) end - if data.specs[2] then + if data.specs[2] and data.specs[2] ~= 0 then local id, name = GetSpecializationInfoByID(Amr.GetGameSpecId(data.specs[2])) _chk2:SetText(name .. " " .. L.ShopSpecLabel) _chk2:SetVisible(true)
--- a/localization/enUS.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/localization/enUS.lua Tue Jun 23 00:27:21 2015 -0700 @@ -3,7 +3,7 @@ Instructions for Translators: 1. Copy this entire file into a new file in the same folder, named with your locale, e.g. deDE.lua for German. -2. At the top, replace "enUS" in the first code line with your locale. +2. At the top, replace "enUS" in the first code line with your locale, and change the next parameter from true to false. 3. Change all the English strings in your file as appropriate. Note that a couple of the "strings" are functions that are provided variables. Feel free to modify these @@ -48,6 +48,7 @@ L.InstanceNames = { [1228] = "Highmaul", [1205] = "Blackrock Foundry", + [1448] = "Hellfire Citadel", [1182] = "Auchindoun", [1175] = "Bloodmaul Slag Mines", [1208] = "Grimrail Depot", @@ -372,4 +373,7 @@ L.OptionsShopAhName = "Automatically show shopping list at auction house" L.OptionsShopAhDesc = "Whenever you open the auction house, automatically show the shopping list window. You can click on items in the shopping list to quickly search for them in the auction house." +L.OptionsUiScaleName = "Ask Mr. Robot UI scale" +L.OptionsUiScaleDesc = "Enter a value between 0.5 and 1.5 to change the scale of the Ask Mr. Robot user interface, press Enter, then close/open the window for it take effect. If the positioning gets messed up, use the /amr reset command." + end
--- a/localization/frFR.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/localization/frFR.lua Tue Jun 23 00:27:21 2015 -0700 @@ -3,7 +3,7 @@ Instructions for Translators: 1. Copy this entire file into a new file in the same folder, named with your locale, e.g. deDE.lua for German. -2. At the top, replace "enUS" in the first code line with your locale. +2. At the top, replace "enUS" in the first code line with your locale, and change the next parameter from true to false. 3. Change all the English strings in your file as appropriate. Note that a couple of the "strings" are functions that are provided variables. Feel free to modify these @@ -12,7 +12,7 @@ ---------------------------------------------------------------------------------------------------------------]] -- replace enUS with your locale -local L = LibStub("AceLocale-3.0"):NewLocale("AskMrRobot", "frFR", true) +local L = LibStub("AceLocale-3.0"):NewLocale("AskMrRobot", "frFR", false) if L then @@ -48,6 +48,7 @@ L.InstanceNames = { [1228] = "Cognefort", [1205] = "Fonderie des Rochenoires", + [1448] = "Hellfire Citadel", [1182] = "Auchindoun", [1175] = "Mine de la Masse-Sanglante", [1208] = "Dépôt de Tristerail", @@ -372,4 +373,7 @@ L.OptionsShopAhName = "Voir la shopping list automatiquement à l'hôtel des ventes" L.OptionsShopAhDesc = "Quand tu ouvres l'hôtel des ventes, la fenêtre de la shopping list s'ouvre automatiquement. Tu peux cliquer sur un item dans la shopping list pour le chercher automatiquement dans l'hôtel des ventes." +L.OptionsUiScaleName = "Ask Mr. Robot UI scale" +L.OptionsUiScaleDesc = "Enter a value between 0.5 and 1.5 to change the scale of the Ask Mr. Robot user interface, press Enter, then close/open the window for it take effect. If the positioning gets messed up, use the /amr reset command." + end
--- a/ui/AmrUiDropDown.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/ui/AmrUiDropDown.lua Tue Jun 23 00:27:21 2015 -0700 @@ -51,6 +51,7 @@ self:SetWidth(200) self:SetDisabled(false) self:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.Text)) + self:SetItems() self:SelectItem() self.frame:ClearAllPoints() self.list:Hide() @@ -158,10 +159,11 @@ self.items[i] = item end + item:Show() item:SetNormalFontObject(Amr.CreateFont(obj.selected and "Bold" or "Regular", obj.selected and self.fontHeight + 2 or self.fontHeight, obj.color or Amr.Colors.White, 1)) item:SetText(obj.text) item.value = obj.value - + if prev then item:SetPoint("TOP", prev, "BOTTOM") else
--- a/ui/AmrUiFrame.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/ui/AmrUiFrame.lua Tue Jun 23 00:27:21 2015 -0700 @@ -56,6 +56,7 @@ self:SetAutoAdjustHeight(false) self.frame:SetParent(UIParent) self.frame:SetFrameStrata("FULLSCREEN_DIALOG") + self.frame:SetScale(1) self:ApplyStatus() self:Show() end, @@ -125,6 +126,10 @@ ["OnHeightSet"] = function(self, height) local content = self.content content.height = height + end, + + ["SetScale"] = function(self, scale) + self.frame:SetScale(scale) end }
--- a/ui/AmrUiTextarea.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/ui/AmrUiTextarea.lua Tue Jun 23 00:27:21 2015 -0700 @@ -60,6 +60,10 @@ self:Fire("OnTextSet", self.editbox:GetText()) end +local function editboxEnterPressed(self) + self.obj:Fire("OnEnterPressed") +end + -- works for both the scrollframe and the editbox, handles e.g. dragging a spell link into the textarea local function onReceiveDrag(self) local type, id, info = GetCursorInfo() @@ -86,6 +90,7 @@ -- restore default values self:SetWidth(200) self:SetHeight(24) + self:SetMultiLine(true) self:SetFont(Amr.CreateFont("Regular", 16, Amr.Colors.Text)) self:SetText("") self.frame:ClearAllPoints() @@ -122,8 +127,13 @@ ["ClearFocus"] = function(self) self.editbox:ClearFocus() + self.editbox:HighlightText(0, 0) self.frame:SetScript("OnShow", nil) end, + + ["SetMultiLine"] = function(self, multi) + self.editbox:SetMultiLine(multi) + end, ["SetFocus"] = function(self, highlight) self.editbox:SetFocus() @@ -167,6 +177,7 @@ editbox:SetScript("OnCursorChanged", editboxCursorChanged) editbox:SetScript("OnEscapePressed", editbox.ClearFocus) + editbox:SetScript("OnEnterPressed", editboxEnterPressed) editbox:SetScript("OnEditFocusLost", editboxEditFocusLost) editbox:SetScript("OnTextChanged", editboxTextChanged) editbox:SetScript("OnTextSet", editboxTextSet)
--- a/ui/Ui.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/ui/Ui.lua Tue Jun 23 00:27:21 2015 -0700 @@ -149,6 +149,11 @@ f:SetHeight(700) f:SetBorderColor(Amr.Colors.BorderBlue) f:SetBackgroundColor(Amr.Colors.Bg) + + if Amr.db.profile.options.uiScale ~= 1 then + local scale = tonumber(Amr.db.profile.options.uiScale) + f:SetScale(scale) + end -- some status text local lblStatus = AceGUI:Create("AmrUiLabel") @@ -338,6 +343,18 @@ _mainTabs:SelectTab(_activeTab) end +function Amr:Reset() + if not self:IsEnabled() then return end + + Amr:Hide() + Amr:HideLootWindow() + Amr:HideShopWindow() + Amr.db.profile.options.uiScale = 1 + Amr.db.profile.window = {} + Amr.db.profile.lootWindow = {} + Amr.db.profile.shopWindow = {} +end + -- show the UI if not shown already, and select the specified tab function Amr:ShowTab(tab) if not self:IsEnabled() then return end