Mercurial > wow > worldplan
changeset 31:d0114b51cdea
WorldPlan:
- Reworking filters to utilize newly added CVars
- Fleshed out POI tooltip for WQ's associated with Family Familiars
- Filter button tooltip includes reward icons
- Respond to tracking menu clicks when they change filter options
author | Nenue |
---|---|
date | Fri, 28 Oct 2016 19:54:00 -0400 |
parents | 8cb750e79952 |
children | e8679ecb48d8 |
files | FilterBar.lua QuestPOI.lua WorldPlan.lua |
diffstat | 3 files changed, 155 insertions(+), 76 deletions(-) [+] |
line wrap: on
line diff
--- a/FilterBar.lua Fri Oct 28 14:06:07 2016 -0400 +++ b/FilterBar.lua Fri Oct 28 19:54:00 2016 -0400 @@ -5,6 +5,7 @@ -- local print = DEVIAN_WORKSPACE and function(...) _G.print('FilterBar', ...) end or nop +local wipe, ipairs, pairs = table.wipe, ipairs, pairs local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER @@ -30,7 +31,7 @@ local DEFAULT_FILTER_LIST = { { label = 'Filters', texture = "Interface\\WorldMap\\WorldMap-Icon" }, { filterKey= 'rewardType', cVar = 'worldQuestFilterArtifactPower', filterValue = REWARD_ARTIFACT_POWER, label = 'Artifact Power', texture = "Interface\\ICONS\\inv_7xp_inscription_talenttome01" }, - { filterKey= 'rewardType', cVar = 'worldQuestFilterOrderResources', filterValue = REWARD_CURRENCY,label = 'Order Resources', texture = "Interface\\ICONS\\inv_misc_elvencoins" }, + { filterKey= 'rewardType', cVar = 'worldQuestFilterOrderResources', filterValue = REWARD_CURRENCY,label = 'Order Resources', texture = "Interface\\Icons\\inv_orderhall_orderresources" }, { filterKey= 'rewardType', cVar = 'worldQuestFilterEquipment', filterValue = REWARD_GEAR, label = 'Equipment', texture = "Interface\\ICONS\\garrison_bluearmorupgrade" }, { filterKey= 'rewardType', cVar = 'worldQuestFilterProfessionMaterials', filterValue = REWARD_REAGENT, label = 'Materials', texture = 1417744 }, { filterKey= 'rewardType', cVar = 'worldQuestFilterGold', filterValue = REWARD_CASH, label = 'Gold', texture = "Interface\\Buttons\\UI-GroupLoot-Coin-Up" }, @@ -126,6 +127,8 @@ local filterFill = "Interface\\BUTTONS\\YELLOWORANGE64" local filterMask = "Interface\\Minimap\\UI-Minimap-Background" + +local questResults = {{}} function WorldPlanSummaryMixin:Update(forced) local blocks = self.buttons local relativeFrame = WorldMapFrame.UIElementsFrame.TrackingOptionsButton @@ -134,17 +137,19 @@ local quests = WorldPlanQuests.QuestsByZone[self.currentMapID] or WorldPlanQuests.QuestsByID - - + local foundQuests = questResults[1] for index, info in ipairs(self.filterList) do local numQuests = 0 - + local resultIndex = numHeaders + 1 + questResults[resultIndex] = questResults[resultIndex] or {} + wipe(questResults[resultIndex]) for questID, pin in pairs(quests) do if pin.used then if not info.filterKey then numQuests = numQuests + 1 elseif pin[info.filterKey] == info.filterValue then numQuests = numQuests + 1 + tinsert(questResults[resultIndex], pin) end end end @@ -171,6 +176,7 @@ end button.info = info + button.questList = questResults[resultIndex] button:SetID(index) button.spacing = ((info.filterKey ~= relativeFrame.filterKey) and 10) or 0 button.relativeFrame = relativeFrame @@ -186,21 +192,43 @@ if blocks[i] then blocks[i]:Hide() end + if questResults[i] then + wipe(questResults[i]) + end end end function WorldPlanSummaryMixin:Cleanup() - -- hide trailing buttons end +local rgbWhite = {r = 1, g= 1, b= 1, hex = '|cFFFFFFFF'} function WorldPlanFilterPinMixin:OnEnter() - -end -function WorldPlanFilterPinMixin:OnLeave() - + if self.questList and #self.questList >= 1 then + GameTooltip:SetOwner(self, 'ANCHOR_LEFT') + GameTooltip_ClearInsertedFrames(GameTooltip) + GameTooltip:AddLine(self.info.label) + for index, pin in ipairs(self.questList) do + local colorInfo = (pin.quality and ITEM_QUALITY_COLORS[pin.quality]) or rgbWhite + GameTooltip:AddLine(pin.title ..(pin.cheevos and " |cFFFFFF00!|R" or ''), colorInfo.r, colorInfo.g, colorInfo.b) + GameTooltip:AddTexture(pin.itemTexture) + local cLine = GameTooltip:NumLines() - 1 + print(cLine, _G['GameTooltipTexture'..cLine]:GetTexture()) + if type(pin.itemTexture) == 'number' then + --- voodoo workaround for IDs getting coerced to string + _G['GameTooltipTexture'..cLine]:Show() + _G['GameTooltipTexture'..cLine]:SetTexture(pin.itemTexture) + end + GameTooltip:Show() + end + end end +function WorldPlanFilterPinMixin:OnLeave() + if GameTooltip:IsOwned(self) then + GameTooltip:Hide() + end +end function WorldPlanFilterPinMixin:Refresh(isFirst, numQuests) isFirst = isFirst or self.isFirst @@ -219,31 +247,39 @@ self.count:SetText(numQuests) self.cVar = info.cVar - self.itemTexture = self.texture if isFirst then self:SetPoint('TOP', self.relativeFrame, 'BOTTOM', 0, -5) else self:SetPoint('TOPRIGHT', self.relativeFrame, 'BOTTOMRIGHT', 0, -(3 + (self.spacing or 0))) - end print('anchor to', self.relativeFrame:GetName(), info.mask) local r, g, b, a = 1,1,1,1 - local used = WorldPlan.UsedFilters[self.filterKey] - if used and self.filterKey then - if used[self.filterValue] == true then - r, g, b = 0, 1, 0 - elseif used[self.filterValue] == false then - r, g, b = 1, 0, 0 + local desaturated = false + if self.cVar then + self.iconBorder:SetVertexColor(1, 1, 1, 1) + if GetCVarBool(self.cVar) == true then + self.icon:SetVertexColor(1,1,1,1) + self:SetAlpha(1) + else + self.icon:SetVertexColor(.5, .5, .5, 1) + self:SetAlpha(0.5) end else - if self.cVar and GetCVarBool(self.cVar) then - r, g, b = 0, 1, 0 + self:SetAlpha(1) + if WorldPlan.UsedFilters[self.filterKey] then + if WorldPlan.UsedFilters[self.filterKey] == self.filterValue then + self.iconBorder:SetVertexColor(0, 1, 0) + else + self.iconBorder:SetVertexColor(1, 0, 0) + end + else + self.iconBorder:SetVertexColor(1, 1, 1, 1) end end - self.iconBorder:SetVertexColor(r, g, b, a) + --self:UpdateSize() end @@ -267,35 +303,27 @@ -- click: rotate through include(1), exclude(-1), ignore(nil) function WorldPlanFilterPinMixin:OnClick (button) + print('|cFF00FF88'..self:GetName()..':OnClick()|r', filterKey, filterValue, operation) local filterKey = self.filterKey local filterValue = self.filterValue local operation = opPrefix - local setInclude = (button == 'LeftButton') if not filterKey then - -- resetting wipe(WorldPlan.UsedFilters) - - elseif IsShiftKeyDown() then - WorldPlan.UsedFilters[filterKey] = nil + elseif self.cVar then + SetCVar(self.cVar, (GetCVarBool(self.cVar) and 0) or 1) else - WorldPlan.UsedFilters[filterKey] = WorldPlan.UsedFilters[filterKey] or {} - WorldPlan.UsedFilters[filterKey][filterValue] = setInclude - print(filterKey, filterValue, '=', setInclude) - - for index, info in ipairs(WorldPlan.FilterOptions) do - if info.filterKey == filterKey then - if (not IsControlKeyDown()) and (filterValue ~= info.filterValue) then - WorldPlan.UsedFilters[filterKey][info.filterValue] = (not setInclude) - print(filterKey, info.filterValue, '=', WorldPlan.UsedFilters[filterKey][info.filterValue]) - end - end + local setInclude = (button == 'LeftButton') + local flushValue + print('') + if WorldPlan.UsedFilters[filterKey] == filterValue then + WorldPlan.UsedFilters[filterKey] = nil + else + WorldPlan.UsedFilters[filterKey] = filterValue end - end - print('|cFF00FF88Filter Update:', filterKey, filterValue, operation) WorldPlan:Refresh() end \ No newline at end of file
--- a/QuestPOI.lua Fri Oct 28 14:06:07 2016 -0400 +++ b/QuestPOI.lua Fri Oct 28 19:54:00 2016 -0400 @@ -46,6 +46,35 @@ local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL +local subStyles = { + continent = { + PinSize = 14, + Border = 2, + TrackingBorder = 1, + TagSize = 6, + TimeleftStage = 0, + showNumber = false, + numberFontObject = 'WorldPlanFont' + }, + zone = { + PinSize = 22, + Border = 3, + TrackingBorder = 2, + TagSize = 12, + TimeleftStage = 3, + showNumber = true, + numberFontObject = 'WorldPlanNumberFontThin' + }, + minimized = { + PinSize = 4, + Border = 0, + TrackingBorder = 1, + NoIcon = true, + TimeleftStage = 1, + showNumber = false, + } +} + -- Pin color/display variables local familiars = { @@ -108,14 +137,14 @@ end end - return REWARD_ARTIFACT_POWER, "Interface\\ICONS\\inv_7xp_inscription_talenttome01", power, name, itemID + return REWARD_ARTIFACT_POWER, "Interface\\ICONS\\inv_7xp_inscription_talenttome01", power, name, itemID, quality elseif text:match("Item Level") then --print('equipment!', text) quantity = text:match("Item Level ([%d\+]+)") - return REWARD_GEAR, icon, quantity, name, itemID + return REWARD_GEAR, icon, quantity, name, itemID, quality elseif text:match("Crafting Reagent") then --print('|cFFFF4400it is a reagent', text) - return REWARD_REAGENT, icon, quantity, name, itemID + return REWARD_REAGENT, icon, quantity, name, itemID, quality end end @@ -123,10 +152,10 @@ local text = ttl3:GetText() if text:match("Crafting Reagent") then --print('|cFFFF4400it is a reagent', text) - return REWARD_REAGENT, icon, quantity, name, itemID + return REWARD_REAGENT, icon, quantity, name, itemID, quality end end - return 128, icon, quantity, name, itemID + return 128, icon, quantity, name, itemID, quality end function WorldPlanPOIMixin:OnEnter() @@ -134,6 +163,33 @@ if not completed then if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT') + WorldMapTooltip:AddLine(self.title, 1, 1, 1) + if self.quality then + local c = ITEM_QUALITY_COLORS[self.quality] + WorldMapTooltip:AddLine(" ") + WorldMapTooltip:AddLine('Rewards') + WorldMapTooltip:AddLine(self.itemName .. (self.quantity and (' x'..self.quantity) or ''), c.r, c.g, c.b) + WorldMapTooltip:AddTexture(self.itemTexture) + + local cLine = WorldMapTooltip:NumLines() + local line = _G['WorldMapTooltipTextLeft'..cLine] + local pline = _G['WorldMapTooltipTextLeft'..(cLine-1)] + local icon = _G['WorldMapTooltipTexture'..(cLine-3)] + icon:SetSize(24,24) + icon:ClearAllPoints() + icon:SetPoint('TOPLEFT', pline, 'BOTTOMLEFT', 0, -2) + line:ClearAllPoints() + line:SetPoint('TOPLEFT', icon, 'TOPRIGHT', 7, 0) + + --- voodoo workaround for IDs getting coerced to string + if type(self.itemTexture) == 'number' then + icon:Show() + icon:SetTexture(self.itemTexture) + end + end + + + WorldMapTooltip:AddLine(" ") -- causes crash for some reason WorldMapTooltip:AddLine('Family Familiars') local trainer = familiars[self.questID].name local numCheevs = GetAchievementNumCriteria(familiars_id) @@ -181,19 +237,17 @@ qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y) end - self.passesBlizzFilters = WorldMap_DoesWorldQuestInfoPassFilters(info) end local questID = self:GetID() local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _ - local hasUpdate, isPending = self.hasUpdate, self.isPending + local hasUpdate, isPending = (self.hasUpdate or self.isNew), self.isPending if not HaveQuestData(questID) then TQ_RequestPreloadRewardData(questID) isPending = true - qprint('because not have data') else -- set reward category @@ -201,7 +255,7 @@ local numCurrency = GetNumQuestLogRewardCurrencies(questID) local money = GetQuestLogRewardMoney(questID) if numRewards >= 1 then - rewardType, rewardIcon, rewardCount, rewardName, itemID = ParseItemReward(questID) + rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = ParseItemReward(questID) elseif numCurrency >= 1 then rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID) rewardType = REWARD_CURRENCY @@ -215,6 +269,7 @@ self.itemNumber = rewardCount or self.itemNumber self.rewardType = rewardType or REWARD_ITEM self.style = rewardStyle + self.quality = quality -- title, faction, capped state local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID) @@ -270,6 +325,8 @@ qprint(' ', 'rewardType:', self.rewardType, 'tag:', self.tagID) qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) end + self.cheevos = familiars[self.questID] + return hasUpdate, isPending end @@ -411,6 +468,7 @@ subStyle = style.minimized end self.style = style + self.subStyle = subStyle local borderMask = style.mask @@ -419,7 +477,6 @@ local icon = self.icon local count = self.count - self.subStyle = subStyle self.hasNumeric = style.hasNumeric self.numberRGB = style.numberRGB self.showNumber = subStyle.showNumber @@ -438,8 +495,9 @@ wqprint('change font', _G[subStyle.numberFontObject]:GetName()) self.count:SetFontObject(_G[subStyle.numberFontObject]) end + wqprint('filtered:', self.filtered, 'showNumber:', self.showNumber) - self.count:SetShown(true) + self.count:SetShown(self.showNumber) self.count:SetText(self.itemNumber) self.count:SetTextColor(unpack(self.numberRGB)) else
--- a/WorldPlan.lua Fri Oct 28 14:06:07 2016 -0400 +++ b/WorldPlan.lua Fri Oct 28 19:54:00 2016 -0400 @@ -92,7 +92,7 @@ numberFontObject = 'WorldPlanNumberFontThin' }, minimized = { - PinSize = 4, + PinSize = 6, Border = 0, TrackingBorder = 1, NoIcon = true, @@ -102,16 +102,9 @@ } -local POI_FILTER_STYLE = setmetatable({ - continentBorder = 2, - zoneBorder = 2, -}, {__index = DEFAULT_TYPE}) local defaults = { - defaultPinStyle = POI_DEFAULT_TYPE, - rewardStyle = POI_REWARD_TYPE, - filterStyle = POI_FILTER_STYLE, ShowAllProfessionQuests = false, DisplayContinentSummary = true, DisplayContinentPins = true, @@ -134,18 +127,6 @@ local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL -local POI_FILTER_OPTIONS = { - { label = 'Filters', texture = "Interface\\WorldMap\\WorldMap-Icon" }, - { filterKey= 'rewardType', filterValue = REWARD_ARTIFACT_POWER, label = 'Artifact Power', texture = "Interface\\ICONS\\inv_7xp_inscription_talenttome01" }, - { filterKey= 'rewardType', filterValue = REWARD_CURRENCY,label = 'Order Resources', texture = "Interface\\ICONS\\inv_misc_elvencoins" }, - { filterKey= 'rewardType', filterValue = REWARD_GEAR, label = 'Equipment', texture = "Interface\\ICONS\\garrison_bluearmorupgrade" }, - { filterKey= 'rewardType', filterValue = REWARD_REAGENT, label = 'Materials', texture = 1417744 }, - { filterKey= 'rewardType', filterValue = REWARD_CASH, label = 'Gold', texture = ICON_MONEY }, - { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PVP, label = 'PvP', texture = "Interface\\Icons\\Ability_PVP_GladiatorMedallion", spacing = 10 }, - { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PET_BATTLE, label = 'Pet Battle', texture = "Interface\\Icons\\PetJournalPortrait", }, - { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_DUNGEON, label = 'Dungeon', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", }, - { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\ICONS\\70_professions_scroll_02", }, -} WorldPlanCore.BrokenIsleID = BROKEN_ISLES_ID WorldPlanCore.FilterStyle = POI_FILTER_STYLE @@ -416,11 +397,6 @@ return end - POI_DEFAULT_TYPE = db.defaultPinStyle - POI_REWARD_TYPE = db.rewardStyle - POI_FILTER_STYLE = db.filterStyle - - for i, module in ipairs(self.modules) do if module.Reset then print(module, 'Reset()') @@ -549,6 +525,15 @@ end end) + hooksecurefunc("WorldMapTrackingOptionsDropDown_OnClick", function(button) + print("|cFF0088FFWorldMapTrackingOptionsDropDown_OnClick|r") + local value = button.value + if (value == "worldQuestFilterOrderResources" or value == "worldQuestFilterArtifactPower" or + value == "worldQuestFilterProfessionMaterials" or value == "worldQuestFilterGold" or + value == "worldQuestFilterEquipment") then + self:Refresh(true) + end + end) end local defaults = {} @@ -765,9 +750,9 @@ local hostFrame = WorldMapPOIFrame local mapWidth, mapHeight = hostFrame:GetSize() for questID, pin in pairs(pins) do - pin.hasUpdate = true pin:IsShowable() if pin.used then + pin.hasUpdate = true pin:SetFrameLevel(PinBaseIndex+ (pin.whiteListed and 200 or 0) +numPins) print('level', PinBaseIndex+ (pin.whiteListed and 200 or 0) +numPins) pin:SetAnchor(WorldMapPOIFrame, currentMap, mapWidth, mapHeight) @@ -911,9 +896,17 @@ print(' |cFFFF4400IsShowable()|r', self.title) - if not self.passesBlizzFilters then + self.questId = self:GetID() + if not (WorldMap_DoesWorldQuestInfoPassFilters(self)) then self.filtered = true end + + for filterKey, value in pairs(WorldPlan.UsedFilters) do + if self[filterKey] ~= value then + self.filtered = true + end + end + if not TQ_IsActive(self.questID) then self.used = nil elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then