Mercurial > wow > buffalo2
changeset 80:bb6b532c5d2f
- added "world state" frame for zone-specific currencies and context-based artifact/experience progress
author | Nenue |
---|---|
date | Tue, 11 Oct 2016 08:03:41 -0400 |
parents | 0784b87f9722 |
children | 65ec88b30eb8 |
files | Modules/BuffFrame.lua Modules/OrderHall.lua Modules/PaperDoll.lua Veneer.lua Veneer.toc Veneer.xml |
diffstat | 6 files changed, 362 insertions(+), 72 deletions(-) [+] |
line wrap: on
line diff
--- a/Modules/BuffFrame.lua Sun Sep 11 18:46:30 2016 -0400 +++ b/Modules/BuffFrame.lua Tue Oct 11 08:03:41 2016 -0400 @@ -95,6 +95,8 @@ veneer.count:SetFontObject(VeneerNumberFont) veneer.count:ClearAllPoints() veneer.count:SetPoint('TOPRIGHT', veneer, 'TOPRIGHT', -3, -3) + veneer.count:SetJustifyH('RIGHT') + veneer.count:SetSize(30,30) veneer.underlay:SetParent(UIParent) veneer.underlay:SetFrameStrata('BACKGROUND') @@ -177,11 +179,8 @@ for i = 1, n do print(i, veneer.count:GetPoint(n)) end - veneer.count.isUpdating = true - self:Hide() veneer.count:Show() veneer.count:SetText(text) - veneer.count.isUpdating = false end) hooksecurefunc(count, 'Hide', function(self) if veneer.count.isUpdating then @@ -342,11 +341,7 @@ buff:ClearAllPoints() if mod(numBuffs,BUFFS_PER_ROW) == 1 then if numBuffs == 1 then - if OrderHallCommandBar and OrderHallCommandBar:IsVisible() then - buff:SetPoint('TOPRIGHT', OrderHallCommandBar, 'BOTTOMRIGHT', BUFF_FRAMES_X, BUFF_FRAMES_Y) - else - buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', BUFF_FRAMES_X, BUFF_FRAMES_Y) - end + buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', BUFF_FRAMES_X, BUFF_FRAMES_Y) plugin.currentTop = buff:GetTop() else buff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) @@ -473,9 +468,25 @@ end +local OrderHallCommandBarMod = CreateFrame('Frame') +function OrderHallCommandBarMod:Refresh() + OrderHallCommandBar.Background:SetAlpha(0.5) + OrderHallCommandBar:ClearAllPoints() + OrderHallCommandBar:SetPoint('TOP') + OrderHallCommandBar:SetWidth(580) +end +function OrderHallCommandBarMod:Setup() + if OrderHallCommandBar then + print('mapping orderhall bar') + hooksecurefunc(OrderHallCommandBar, 'Show', OrderHallCommandBarMod.Refresh) + self:Refresh() + self:UnregisterEvent('ADDON_LOADED') + else + self:RegisterEvent('ADDON_LOADED') + self:SetScript('OnEvent', OrderHallCommandBarMod.Setup) + end +end plugin.init = function () - - - plugin.db = vn.db[PLUGIN_NAME] + OrderHallCommandBarMod:Setup() end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Modules/OrderHall.lua Tue Oct 11 08:03:41 2016 -0400 @@ -0,0 +1,88 @@ +-- Veneer +-- OrderHall.lua +-- Created: 10/7/2016 10:55 PM +-- %file-revision% +-- + +VeneerWorldStateCurrencyMixin = {} +VeneerWorldStateMixin = {} +local print = DEVIAN_WORKSPACE and function(...) print('VnWorldState', ...) end or nop + +function VeneerWorldStateMixin:Setup() + hooksecurefunc(OrderHallCommandBar,'Show', function() + self:Refresh() + end) + self:Refresh() + --DEFAULT_CHAT_FRAME:AddMessage('Loaded') +end + +function VeneerWorldStateMixin:Refresh() + OrderHallCommandBar:ClearAllPoints() + OrderHallCommandBar:SetPoint('TOP') + OrderHallCommandBar:SetWidth(600) + OrderHallCommandBar.Background:SetColorTexture(0,0,0,0.5) + OrderHallCommandBar.WorldMapButton:Hide() + OrderHallCommandBar:EnableMouse(false) +end +local initialized +function VeneerWorldStateMixin:OnEvent(event, arg) + print(event, arg) + if OrderHallCommandBar and not initialized then + initialized = true + self:Setup() + self:UnregisterEvent('ADDON_LOADED') + end + + if event == 'PLAYER_ENTERING_WORLD' then + self:Update() + end +end + +function VeneerWorldStateMixin:Update() + local frames = {self:GetChildren()} + print('|cFFFFFF00All:Update()|r') + for i, frame in ipairs(frames) do + if frame.Update then + print(frame:GetName()) + frame:Update() + end + end +end + + + +function VeneerWorldStateMixin:OnLoad () + self:RegisterEvent('ADDON_LOADED') + self:RegisterEvent('ARTIFACT_UPDATE') + self:RegisterEvent('ARTIFACT_XP_UPDATE') + self:RegisterEvent('PLAYER_ENTERING_WORLD') + +end + +function VeneerWorldStateCurrencyMixin:OnLoad () + + self:RegisterEvent('ZONE_CHANGED') + self:RegisterEvent('CURRENCY_DISPLAY_UPDATE') + self:RegisterEvent('CHAT_MSG_CURRENCY') + +end + +function VeneerWorldStateCurrencyMixin:OnEvent (event, arg) + self:Update() +end + + +function VeneerWorldStateCurrencyMixin:Update() + local mapID = GetCurrentMapAreaID() + print('currency refresh: zone =', mapID) + if mapID == 1033 then + local name, earned, texture, earnedThisWeek, weeklyMax, totalMax = GetCurrencyInfo(1155) + + self.Icon:SetTexture(texture) + self.Label:SetFormattedText("%d / %d", earned, totalMax) + self:Show() + self:SetWidth(self.Icon:GetWidth() + self.Label:GetStringWidth() + 6) + else + self:Hide() + end +end \ No newline at end of file
--- a/Modules/PaperDoll.lua Sun Sep 11 18:46:30 2016 -0400 +++ b/Modules/PaperDoll.lua Tue Oct 11 08:03:41 2016 -0400 @@ -2,8 +2,7 @@ -- PaperDoll.lua -- Created: 8/16/2016 8:18 AM -- %file-revision% --- Displays item levels by equipment slots --- Requires tooltip scraping to obtain these numbers, meaning any currently active tooltip will be cleared. +-- Displays the item level and modifications of character sheet equipment, including artifact power local plugin = CreateFrame('Frame', 'VeneerPaper', UIParent) local vn, print = LibStub("LibKraken").register(Veneer, plugin) @@ -54,61 +53,105 @@ local pendingSlots = {} +local GetEquippedArtifactInfo = _G.C_ArtifactUI.GetEquippedArtifactInfo +local GetCostForPointAtRank = _G.C_ArtifactUI.GetCostForPointAtRank +local tooltip = CreateFrame('GameTooltip', 'VeneerTooltip', UIParent, 'GameTooltipTemplate') local jewel = {} + +local artifactBar_OnEvent = function (self) + local itemID, altItemID, name, icon, totalXP, pointsSpent = GetEquippedArtifactInfo() + if not itemID then + self:Hide() + return + end + + local numRelicSlots = C_ArtifactUI.GetNumRelicSlots() or 0; + + + local pointsAvailable = 0 + local nextRankCost = GetCostForPointAtRank(pointsSpent + pointsAvailable) or 0 + + while totalXP >= nextRankCost do + totalXP = totalXP - nextRankCost + pointsAvailable = pointsAvailable + 1 + nextRankCost = GetCostForPointAtRank(pointsSpent + pointsAvailable) or 0 + end + self.Header:SetText(name) + self.Level:SetText(pointsSpent) + self.ProgressText:SetFormattedText("|cFF00FFFF%d|r / %d", totalXP, nextRankCost) + + self.ProgressBar:SetPoint('TOPRIGHT', self.ProgressBG, 'TOPLEFT', self:GetWidth()*(totalXP/nextRankCost), 0) + self.ProgressBar:SetColorTexture(1,.5,0) + + self:Show() +end + + +local artifactBar = CreateFrame('Frame', 'VnPaperDollArtifact', CharacterModelFrame, 'VeneerStatusBarTemplate') +artifactBar:ClearAllPoints() +artifactBar:SetHeight(28) +artifactBar:SetPoint('LEFT', CharacterModelFrame, 'LEFT', 30, 0) +artifactBar:SetPoint('RIGHT', CharacterModelFrame, 'RIGHT', -30, 0) +artifactBar:SetPoint('BOTTOM', CharacterMainHandSlotFrame, 'TOP', 0, 1) +artifactBar.ProgressBG:SetColorTexture(0.5, 0.5, 0.5) +artifactBar.Header:Show() +artifactBar:RegisterEvent('ARTIFACT_UPDATE') +artifactBar:SetScript('OnEvent', artifactBar_OnEvent) + +plugin.artifactBar = artifactBar +print(CharacterMainHandSlotFrame:GetPoint(1)) +print(artifactBar:GetPoint(3)) + +for i = 1, 3 do + local relicSlot = CreateFrame('Frame', 'VnPaperDollRelic'..i, artifactBar) + relicSlot:SetSize(40,40) + relicSlot:SetPoint('BOTTOM', artifactBar, 'TOP', (i-2)*40, 24) + relicSlot.relicArt = relicSlot:CreateTexture(nil, 'BACKGROUND') + artifactBar['RelicSlot'..i] = relicSlot +end + + +artifactBar:EnableMouse(true) +artifactBar:SetScript('OnMouseUp', function() + SocketInventoryItem(16) +end) + local UpdateVeneer = function(itemslot, frame) local slot = itemslot:GetID() if itemslot.hasItem then - frame.link = GetInventoryItemLink('player', slot) + local unit = frame.target.unit or 'player' + frame.link = GetInventoryItemLink(unit, slot) + tooltip:SetOwner(frame, 'ANCHOR_NONE') + tooltip:SetInventoryItem(unit, slot) + tooltip:Show() + --print(tooltip:NumLines()) + if tooltip:NumLines() >= 3 then - local name, link, something, ilevel = GetItemInfo(frame.link) - frame.label:SetText(ilevel) - -- todo: test GetExtendedItemInfo() + local ilvl + if _G['VeneerTooltipTextLeft2'] then + ilvl = _G['VeneerTooltipTextLeft2']:GetText():match("Item Level (%d+)") + --print('l2', ilvl) + end - local item = {strsplit(":", link)} - local _, itemId, enchantId, jewelId1, jewelId2, jewelId3, jewelId4, suffixId, - uniqueId, linkLevel, specializationID, instanceDifficultyId, numBonusIds, bonusId1, bonusId2, upgradeValue + if _G['VeneerTooltipTextLeft3'] then + if not ilvl then + ilvl = _G['VeneerTooltipTextLeft3']:GetText():match("Item Level (%d+)") + --print('l3', ilvl) + end + end - specializationID, instanceDifficultyId, numBonusIds = item[11], item[12], item[13] - jewel[1], jewel[2], jewel[3], jewel[4] = item[4], item[5], item[6], item[7] - --vn:print(jewelId1, jewelId2, jewelId3, jewelId4) - for i = 1, 4 do - local gemslot = frame.gemslot[i] - if tonumber(jewel[i]) ~= nil then - if not gemslot then - gemslot = frame:CreateTexture(itemslot:GetName()..'Gem'..i, 'ARTWORK') - gemslot:SetSize(16,16) - local posx = 3 + (i-1)*16 - if slot_anchors[slot]:match('RIGHT') then - posx = posx * -1 - end - gemslot:SetPoint(slot_anchors[slot], frame.label, slot_relative[slot], posx, 0) - frame.gemslot[i] = gemslot - end - gemslot:SetTexture(GetItemIcon(jewel[i])) - gemslot:Show() - else - if gemslot then - gemslot:Hide() - end - + if ilvl then + frame.label:SetText(ilvl) end end ---[[ - print(link) - local difftag = '?' - if tonumber(numBonusIds) ~= nil then - local name, groupType, isHeroic, isChallengeMode, displayHeroic, displayMythic, toggleDifficultyID = GetDifficultyInfo(numBonusIds) - difftag = (name or '??') .. (isHeroic and ' (Heroic)' or '') + + local quality = GetInventoryItemQuality(unit, slot) + if slot == 16 and quality == LE_ITEM_QUALITY_ARTIFACT then + artifactBar_OnEvent(plugin.artifactBar) end - print(instanceDifficultyId, '|cFF00FFFF', difftag, numBonusIds) - --if tonumber(numBonusIds) ~= nil then - for i = 8, #item do - print(i..'-', item[i]) - end - --end ---]] + frame:Show() else @@ -142,7 +185,7 @@ if not slot_anchors[slot] then return end - + print(self:GetName()) local frame = _G[name .. 'Veneer'] @@ -154,36 +197,34 @@ frame.label = frame:CreateFontString(nil, 'OVERLAY', 'VeneerNumberFont') frame.gemslot = {} - local anchor, relative, x, y = slot_anchors[slot], slot_relative[slot], 8, -4 - if anchor:match('RIGHT') then - x = -x - end - if anchor:match('BOTTOM') then - y = 4 - end + frame.target = self frame.gemslot = {} - frame:SetPoint(anchor, self, relative, x, y) - frame:SetSize(200,24) - frame.label:ClearAllPoints() - frame.label:SetPoint(slot_anchors[slot], frame, slot_anchors[slot]) + frame:SetAllPoints(self) + frame:SetParent(self) + frame.label:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', 2, 2) tinsert(pendingSlots, frame) end + UpdateVeneer(self, frame) + end +local PaperDollFrame_UpdateStats = function() + +end plugin.event = function(self, event, ...) - print(self, event, flag, slot) + print(self, event, ...) if event == 'PLAYER_EQUIPMENT_CHANGED' then local slot, hasItem = ... if vnslot[slot] then UpdateVeneer(vnslot[slot]:GetParent(), vnslot[slot]) - plugin.ticker() + end elseif event == 'PLAYER_ENTERING_WORLD' then @@ -192,10 +233,16 @@ end end +local artifactBarCreated +plugin.init = function() + LoadAddOn('Blizzard_ArtifactUI') +end --plugin:SetScript('OnEvent', plugin.event) plugin:RegisterEvent('PLAYER_EQUIPMENT_CHANGED') plugin:RegisterEvent('PLAYER_ENTERING_WORLD') ---hooksecurefunc("PaperDollItemSlotButton_Update", PaperDollItemSlotButton_Update) +hooksecurefunc("PaperDollItemSlotButton_Update", PaperDollItemSlotButton_Update) + +hooksecurefunc("PaperDollFrame_UpdateStats", PaperDollFrame_UpdateStats) \ No newline at end of file
--- a/Veneer.lua Sun Sep 11 18:46:30 2016 -0400 +++ b/Veneer.lua Tue Oct 11 08:03:41 2016 -0400 @@ -2,7 +2,7 @@ -- Base framework for making things draggable. local vn, print = LibStub("LibKraken").register(Veneer) - +local wipe = table.wipe local defaults = { enableAll = true, @@ -170,11 +170,21 @@ return veneers[frame] end +local mixin_probe = { + 'ArtifactFrame', + 'ArtifactFrameUnderlay', +} + +vn.event = function(event, arg) + +end + vn.init = function() if (not VeneerData) or (not VeneerData.version) then VeneerData = defaults end vn.db = VeneerData + end @@ -190,6 +200,5 @@ end end end - ToggleVeneerConfig() end \ No newline at end of file
--- a/Veneer.toc Sun Sep 11 18:46:30 2016 -0400 +++ b/Veneer.toc Tue Oct 11 08:03:41 2016 -0400 @@ -11,4 +11,5 @@ Veneer.xml Options.lua -Modules\BuffFrame.lua \ No newline at end of file +Modules\BuffFrame.lua +Modules\PaperDoll.lua \ No newline at end of file
--- a/Veneer.xml Sun Sep 11 18:46:30 2016 -0400 +++ b/Veneer.xml Tue Oct 11 08:03:41 2016 -0400 @@ -159,9 +159,141 @@ </Frames> </Frame> + <Frame name="VeneerMixinScripts" virtual="true"> + <Scripts> + <OnLoad method="OnLoad" /> + <OnEvent method="OnEvent" /> + <OnShow method="OnShow" /> + </Scripts> + </Frame> + <Frame name="VeneerStatusBarTemplate" virtual="true" hidden="true" inherits="VeneerMixinScripts"> + <Scripts> + <OnShow> + if self.OnShow then self:OnShow() end + if self.Header:IsVisible() then + self.ProgressBG:ClearAllPoints() + self.ProgressBG:SetPoint('TOP', self.GlowLine, 'BOTTOM', 0, -1) + self.ProgressBG:SetPoint('LEFT') + self.ProgressBG:SetPoint('RIGHT') + self.ProgressBG:SetPoint('BOTTOM') + else + self.ProgressBG:ClearAllPoints() + self.ProgressBG:SetAllPoints(self) + end + </OnShow> + <OnSizeChanged> + </OnSizeChanged> + </Scripts> + <Layers> + <Layer level="BACKGROUND"> + <Texture parentKey="UnderLay"> + </Texture> + </Layer> + <Layer level="BORDER"> + <Texture parentKey="ProgressBG" setAllPoints="true"> + <Color a=".7" r="0" g="0" b="0" /> + </Texture> + <Texture parentKey="GlowLine" atlas="AftLevelup-GlowLine" useAtlasSize="false"> + <Size y="3" /> + <Anchors> + <Anchor point="TOPLEFT" x="-27" y="-11" /> + <Anchor point="RIGHT" x="27" y="0" /> + </Anchors> + </Texture> + </Layer> + <Layer level="ARTWORK"> + <Texture parentKey="ProgressBar"> + <Anchors> + <Anchor point="BOTTOMLEFT" /> + </Anchors> + <Color a="1" r=".7" g=".7" b=".7" /> + </Texture> + </Layer> + <Layer level="OVERLAY" > + <FontString parentKey="Header" inherits="VeneerNumberFontSmall"> + <Anchors> + <Anchor point="TOP" /> + </Anchors> + </FontString> + <FontString parentKey="Level" inherits="GameFontNormal"> + <Anchors> + <Anchor point="TOPLEFT" /> + </Anchors> + </FontString> + <FontString parentKey="ProgressText" inherits="VeneerNumberFont"> + <Anchors> + <Anchor point="CENTER" relativeKey="$parent.ProgressBG" /> + </Anchors> + </FontString> + </Layer> + </Layers> + </Frame> <Script file="Veneer.lua" /> + <Script file="Modules\OrderHall.lua" /> + + <Frame name="VeneerWorldState" mixin="VeneerWorldStateMixin" parent="UIParent" inherits="VeneerMixinScripts"> + <Anchors> + <Anchor point="TOP" /> + </Anchors> + <Size x="500" y="24" /> + <Frames> + <Frame name="$parentProgress" parentKey="Progress" mixin="VeneerWorldStateProgressMixin" hidden="true" inherits="VeneerMixinScripts"> + + <Size x="500" y="24" /> + <Anchors> + <Anchor point="TOPLEFT" /> + </Anchors> + <Layers> + <Layer level="BORDER"> + <Texture setAllPoints="true" parentKey="ProgressBG"> + <Color r="0" g="0" b="0" a="0.5" /> + </Texture> + </Layer> + <Layer level="ARTWORK"> + <Texture parentKey="ProgressBar"> + <Anchors> + <Anchor point="BOTTOMLEFT" /> + </Anchors> + <Color r="1" g="1" b="1" a="0.8" /> + </Texture> + </Layer> + <Layer level="OVERLAY"> + <FontString parentKey="Label" inherits="VeneerNumberFont"> + <Anchors> + <Anchor point="CENTER" /> + </Anchors> + </FontString> + </Layer> + </Layers> + </Frame> + + <Frame name="$parentZoneCurrency" parentKey="ZoneCurrency" mixin="VeneerWorldStateCurrencyMixin" hidden="true" inherits="VeneerMixinScripts"> + <Anchors> + <Anchor point="TOPRIGHT" /> + </Anchors> + <Size x="200" y="24" /> + <Layers> + <Layer level="ARTWORK"> + <Texture parentKey="Icon" > + <Size x="24" y="24" /> + <Anchors> + <Anchor point="LEFT" /> + </Anchors> + </Texture> + </Layer> + <Layer level="OVERLAY"> + <FontString parentKey="Label" inherits="VeneerNumberFont"> + <Anchors> + <Anchor point="LEFT" relativePoint="RIGHT" relativeKey="$parent.Icon" x="2" y="0" /> + </Anchors> + </FontString> + </Layer> + </Layers> + </Frame> + </Frames> + </Frame> </Ui> \ No newline at end of file