annotate Modules/WorldState.lua @ 138:6e2f20230190 tip

- 8.1 TOC - disabled Currency and WorldState modules for lack of use - BoD progress link buttons for group finder
author Nenue
date Fri, 22 Feb 2019 17:34:58 -0500
parents 3f4794dca91b
children
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@125 6 local _, vn = ...
Nenue@125 7 local L = vn.L
Nenue@97 8 local print = DEVIAN_WORKSPACE and function(...) print('VnWorldState', ...) end or nop
Nenue@115 9
Nenue@87 10 VeneerOrderHallMixin = {
Nenue@87 11 anchorPoint = 'TOP',
Nenue@90 12 anchorFrom = 'TOP',
Nick@113 13 anchorPriority = 1,
Nenue@90 14 anchorX = 0,
Nenue@90 15 anchorY = 0,
Nenue@90 16 addonTrigger = 'Blizzard_OrderHallUI',
Nenue@90 17 addonFrame = 'OrderHallCommandBar',
Nenue@87 18 }
Nick@114 19 --- Order Hall mod
Nick@114 20 local requiresUpdate
Nick@114 21 local ocb
Nenue@87 22 function VeneerOrderHallMixin:Setup()
Nenue@87 23 print('|cFFFFFF00'..self:GetName()..':Setup()')
Nick@114 24 ocb = OrderHallCommandBar
Nick@114 25 hooksecurefunc(ocb, 'RefreshCategories', function()
Nick@114 26 requiresUpdate = true
Nick@114 27 end)
Nick@114 28 hooksecurefunc(ocb, 'RefreshCurrency',
Nick@114 29 function()
Nick@114 30 requiresUpdate = true
Nick@114 31 end)
Nenue@116 32 hooksecurefunc(ocb, 'SetShown', function(_, isShown)
Nenue@116 33 if self:IsShown() ~= isShown then
Nenue@116 34 self:SetShown(isShown)
Nenue@116 35 Veneer:DynamicReanchor()
Nenue@116 36 end
Nick@114 37 end)
Nick@114 38 hooksecurefunc(ocb, 'RefreshAll', function()
Nick@114 39 self:Update()
Nick@114 40 end)
Nick@113 41
Nick@114 42 ocb:ClearAllPoints()
Nick@114 43 ocb:SetAllPoints(self)
Nick@114 44
Nick@114 45
Nick@114 46 ocb.WorldMapButton:Hide()
Nick@114 47 ocb.AreaName:Hide()
Nick@114 48
Nick@114 49 ocb.Currency:SetFontObject(VeneerHeaderFont)
Nick@114 50 ocb.Currency:ClearAllPoints()
Nick@114 51 ocb.Currency:SetPoint('BOTTOMLEFT', ocb.ClassIcon, 'BOTTOMRIGHT', 15, 0)
Nick@114 52
Nick@114 53 ocb.CurrencyIcon:ClearAllPoints()
Nick@114 54 ocb.CurrencyIcon:SetPoint('TOP', ocb.ClassIcon, 'TOPRIGHT')
Nick@114 55
Nick@114 56 ocb.Background:SetColorTexture(0,0,0,0.5)
Nick@114 57
Nick@114 58 -- frame that calls up the resources tooltip
Nick@114 59 ocb.CurrencyHitTest:SetPoint('LEFT', ocb.CurrencyIcon, 'LEFT')
Nick@114 60 ocb.CurrencyHitTest:SetPoint('RIGHT', ocb.Currency, 'RIGHT')
Nick@114 61
Nick@114 62
Nick@114 63 self:SetSize(700, 23)
Nenue@116 64 self:SetShown(C_Garrison.IsPlayerInGarrison(LE_GARRISON_TYPE_7_0))
Nick@114 65 end
Nick@114 66
Nick@114 67 function VeneerOrderHallMixin:OnUpdate()
Nick@114 68 if requiresUpdate then
Nick@114 69 self:Update()
Nick@114 70 end
Nick@114 71
Nenue@88 72 end
Nenue@88 73
Nenue@90 74 function VeneerOrderHallMixin:OnLoad()
Nenue@115 75 Veneer:AddHandler(self)
Nick@113 76 self:EnableMouse(false)
Nenue@90 77 end
Nenue@90 78
Nenue@88 79
Nenue@88 80 function VeneerOrderHallMixin:OnShow()
Nick@114 81 if ocb then
Nick@114 82 --self:Print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', ocb:IsShown(), self:IsShown())
Nenue@90 83 self:Update()
Nenue@90 84 end
Nenue@87 85 end
Nenue@87 86
Nenue@87 87 function VeneerOrderHallMixin:Update()
Nenue@125 88 self:SetShown(C_Garrison.IsPlayerInGarrison(LE_GARRISON_TYPE_7_0) or (GetSubZoneText() == L["The Vindicaar"]))
Nick@114 89 local lastFrame
Nick@114 90 local categoriesWidth = 0
Nick@113 91 local troops = OrderHallCommandBar.TroopSummary
Nick@113 92 if troops then
Nick@113 93 for _, category in ipairs(troops) do
Nick@114 94 category.Count:SetFontObject(VeneerHeaderFont)
Nick@114 95 category.Count:SetTextColor(1,1,1,1)
Nick@113 96 category.Count:ClearAllPoints()
Nick@113 97 category.Count:SetPoint('BOTTOMRIGHT', category.Icon, 'BOTTOMRIGHT', -1, 1)
Nick@114 98
Nick@114 99 category:ClearAllPoints()
Nick@114 100 if lastFrame then
Nick@114 101 lastFrame:SetPoint('TOPRIGHT', category, 'TOPLEFT', 0, 0)
Nick@114 102 end
Nick@114 103 category:SetSize(category.TroopPortraitCover:GetSize())
Nick@114 104
Nick@114 105 lastFrame = category
Nick@114 106 categoriesWidth = categoriesWidth + category:GetWidth()
Nick@114 107 end
Nick@114 108
Nick@114 109 if lastFrame then
Nick@114 110 lastFrame:SetPoint('TOPRIGHT', ocb, 'TOPRIGHT', 0, 0)
Nick@113 111 end
Nick@114 112
Nick@113 113 end
Nick@114 114 self:SetWidth(ocb.ClassIcon:GetWidth() + 15 + ocb.Currency:GetWidth() + ocb.CurrencyIcon:GetWidth() + categoriesWidth)
Nick@114 115 requiresUpdate = nil
Nick@114 116 --print('|cFF00AAFF'..self:GetName()..'|r:Update()', OrderHallCommandBar:IsVisible(), self:IsShown())
Nick@114 117 --print(debugstack(6))
Nenue@98 118 Veneer:DynamicReanchor()
Nenue@87 119 end
Nenue@87 120
Nenue@80 121
Nenue@87 122
Nenue@87 123