annotate Modules/WorldState.lua @ 122:ea2c616a3b4f

Standardize anchor variables - anchorGroup sets general position, defers to anchorPoint - anchorPoint and anchorFrom are used in SetPoint, deferring to anchorGroup and its inverse Artifact Power: - scan and update triggers trimmed down BuffFrame: - extra values can be right clicked to hide for particular auras LFG: - Desolate Host link placed above Sisters when searching for best cheevos TalkingHead - Re-enable TalkingHeadFrame click behaviour
author Nenue
date Mon, 21 Aug 2017 22:15:46 -0400
parents ddfe19d70a34
children 3f4794dca91b
rev   line source
Nenue@80 1 -- Veneer
Nenue@84 2 -- WorldState.lua
Nenue@80 3 -- Created: 10/7/2016 10:55 PM
Nenue@80 4 -- %file-revision%
Nick@113 5 -- An extensible panel group for HUD values
Nenue@80 6
Nenue@97 7 local print = DEVIAN_WORKSPACE and function(...) print('VnWorldState', ...) end or nop
Nenue@115 8
Nenue@87 9 VeneerOrderHallMixin = {
Nenue@87 10 anchorPoint = 'TOP',
Nenue@90 11 anchorFrom = 'TOP',
Nick@113 12 anchorPriority = 1,
Nenue@90 13 anchorX = 0,
Nenue@90 14 anchorY = 0,
Nenue@90 15 addonTrigger = 'Blizzard_OrderHallUI',
Nenue@90 16 addonFrame = 'OrderHallCommandBar',
Nenue@87 17 }
Nick@114 18 --- Order Hall mod
Nick@114 19 local requiresUpdate
Nick@114 20 local ocb
Nenue@87 21 function VeneerOrderHallMixin:Setup()
Nenue@87 22 print('|cFFFFFF00'..self:GetName()..':Setup()')
Nick@114 23 ocb = OrderHallCommandBar
Nick@114 24 hooksecurefunc(ocb, 'RefreshCategories', function()
Nick@114 25 requiresUpdate = true
Nick@114 26 end)
Nick@114 27 hooksecurefunc(ocb, 'RefreshCurrency',
Nick@114 28 function()
Nick@114 29 requiresUpdate = true
Nick@114 30 end)
Nenue@116 31 hooksecurefunc(ocb, 'SetShown', function(_, isShown)
Nenue@116 32 if self:IsShown() ~= isShown then
Nenue@116 33 self:SetShown(isShown)
Nenue@116 34 Veneer:DynamicReanchor()
Nenue@116 35 end
Nick@114 36 end)
Nick@114 37 hooksecurefunc(ocb, 'RefreshAll', function()
Nick@114 38 self:Update()
Nick@114 39 end)
Nick@113 40
Nick@114 41 ocb:ClearAllPoints()
Nick@114 42 ocb:SetAllPoints(self)
Nick@114 43
Nick@114 44
Nick@114 45 ocb.WorldMapButton:Hide()
Nick@114 46 ocb.AreaName:Hide()
Nick@114 47
Nick@114 48 ocb.Currency:SetFontObject(VeneerHeaderFont)
Nick@114 49 ocb.Currency:ClearAllPoints()
Nick@114 50 ocb.Currency:SetPoint('BOTTOMLEFT', ocb.ClassIcon, 'BOTTOMRIGHT', 15, 0)
Nick@114 51
Nick@114 52 ocb.CurrencyIcon:ClearAllPoints()
Nick@114 53 ocb.CurrencyIcon:SetPoint('TOP', ocb.ClassIcon, 'TOPRIGHT')
Nick@114 54
Nick@114 55 ocb.Background:SetColorTexture(0,0,0,0.5)
Nick@114 56
Nick@114 57 -- frame that calls up the resources tooltip
Nick@114 58 ocb.CurrencyHitTest:SetPoint('LEFT', ocb.CurrencyIcon, 'LEFT')
Nick@114 59 ocb.CurrencyHitTest:SetPoint('RIGHT', ocb.Currency, 'RIGHT')
Nick@114 60
Nick@114 61
Nick@114 62 self:SetSize(700, 23)
Nenue@116 63 self:SetShown(C_Garrison.IsPlayerInGarrison(LE_GARRISON_TYPE_7_0))
Nick@114 64 end
Nick@114 65
Nick@114 66 function VeneerOrderHallMixin:OnUpdate()
Nick@114 67 if requiresUpdate then
Nick@114 68 self:Update()
Nick@114 69 end
Nick@114 70
Nenue@88 71 end
Nenue@88 72
Nenue@90 73 function VeneerOrderHallMixin:OnLoad()
Nenue@115 74 Veneer:AddHandler(self)
Nick@113 75 self:EnableMouse(false)
Nenue@90 76 end
Nenue@90 77
Nenue@88 78
Nenue@88 79 function VeneerOrderHallMixin:OnShow()
Nick@114 80 if ocb then
Nick@114 81 --self:Print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', ocb:IsShown(), self:IsShown())
Nenue@90 82 self:Update()
Nenue@90 83 end
Nenue@87 84 end
Nenue@87 85
Nenue@87 86 function VeneerOrderHallMixin:Update()
Nenue@116 87 self:SetShown(C_Garrison.IsPlayerInGarrison(LE_GARRISON_TYPE_7_0))
Nick@114 88 local lastFrame
Nick@114 89 local categoriesWidth = 0
Nick@113 90 local troops = OrderHallCommandBar.TroopSummary
Nick@113 91 if troops then
Nick@113 92 for _, category in ipairs(troops) do
Nick@114 93 category.Count:SetFontObject(VeneerHeaderFont)
Nick@114 94 category.Count:SetTextColor(1,1,1,1)
Nick@113 95 category.Count:ClearAllPoints()
Nick@113 96 category.Count:SetPoint('BOTTOMRIGHT', category.Icon, 'BOTTOMRIGHT', -1, 1)
Nick@114 97
Nick@114 98 category:ClearAllPoints()
Nick@114 99 if lastFrame then
Nick@114 100 lastFrame:SetPoint('TOPRIGHT', category, 'TOPLEFT', 0, 0)
Nick@114 101 end
Nick@114 102 category:SetSize(category.TroopPortraitCover:GetSize())
Nick@114 103
Nick@114 104 lastFrame = category
Nick@114 105 categoriesWidth = categoriesWidth + category:GetWidth()
Nick@114 106 end
Nick@114 107
Nick@114 108 if lastFrame then
Nick@114 109 lastFrame:SetPoint('TOPRIGHT', ocb, 'TOPRIGHT', 0, 0)
Nick@113 110 end
Nick@114 111
Nick@113 112 end
Nick@114 113 self:SetWidth(ocb.ClassIcon:GetWidth() + 15 + ocb.Currency:GetWidth() + ocb.CurrencyIcon:GetWidth() + categoriesWidth)
Nick@114 114 requiresUpdate = nil
Nick@114 115 --print('|cFF00AAFF'..self:GetName()..'|r:Update()', OrderHallCommandBar:IsVisible(), self:IsShown())
Nick@114 116 --print(debugstack(6))
Nenue@98 117 Veneer:DynamicReanchor()
Nenue@87 118 end
Nenue@87 119
Nenue@80 120
Nenue@87 121
Nenue@87 122