-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTUI.lua
554 lines (482 loc) · 22.2 KB
/
TUI.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
UI = {}
UI.name = "TUI"
local classIcons = {
[1] = [[/esoui/art/icons/class/class_dragonknight.dds]],
[2] = [[/esoui/art/icons/class/class_sorcerer.dds]],
[3] = [[/esoui/art/icons/class/class_nightblade.dds]],
[4] = [[/esoui/art/icons/class/class_warden.dds]],
[5] = [[/esoui/art/icons/class/class_necromancer.dds]],
[6] = [[/esoui/art/icons/class/class_templar.dds]],
[117] = [[/esoui/art/icons/class/class_arcanist.dds]],
}
local allianceIcons = {
[100] = [[/esoui/art/ava/ava_allianceflag_neutral.dds]],
[1] = [[/esoui/art/guild/guildbanner_icon_aldmeri.dds]],
[2] = [[/esoui/art/guild/guildbanner_icon_ebonheart.dds]],
[3] = [[/esoui/art/guild/guildbanner_icon_daggerfall.dds]],
}
function UI.OnAddOnLoaded(event, addonName)
if addonName == UI.name then
-- Register our events
EVENT_MANAGER:RegisterForEvent(UI.name, EVENT_PLAYER_ACTIVATED, UI.OnPlayerLoaded)
EVENT_MANAGER:RegisterForEvent(UI.name, EVENT_POWER_UPDATE, UI.OnPowerUpdate)
EVENT_MANAGER:RegisterForEvent(UI.name, EVENT_UNIT_ATTRIBUTE_VISUAL_ADDED, UI.OnVisualAdded)
EVENT_MANAGER:RegisterForEvent(UI.name, EVENT_UNIT_ATTRIBUTE_VISUAL_REMOVED, UI.OnVisualRemoved)
EVENT_MANAGER:RegisterForEvent(UI.name, EVENT_UNIT_ATTRIBUTE_VISUAL_UPDATED, UI.OnVisualUpdated)
EVENT_MANAGER:RegisterForEvent(UI.name, EVENT_RETICLE_TARGET_CHANGED, UI.OnTargetChanged)
EVENT_MANAGER:RegisterForEvent(UI.name, EVENT_PLAYER_ALIVE, UI.OnPlayerRez)
EVENT_MANAGER:RegisterForEvent(UI.name, EVENT_GROUP_MEMBER_JOINED, UI.OnGroupMemberJoined)
EVENT_MANAGER:RegisterForEvent(UI.name, EVENT_GROUP_MEMBER_LEFT, UI.OnGroupMemberLeft)
EVENT_MANAGER:RegisterForEvent(UI.name, EVENT_GROUP_MEMBER_CONNECTED_STATUS, UI.OnGroupMemberConnectionChanged)
EVENT_MANAGER:RegisterForUpdate(UI.name, 1000, UI.OnUpdate)
-- Unset our initial hook
EVENT_MANAGER:UnregisterForEvent(UI.name, EVENT_ADD_ON_LOADED)
end
end
function TempFixActionBar()
-- Quick fix for making the quickslot button not spazz out on FancyActionBars
local LQuickSlotButton = nil
LQuickSlotButton = GetControl("QuickslotButton");
if LQuickSlotButton ~= nil then
LQuickSlotButton:ClearAnchors()
LQuickSlotButton:SetAnchor(RIGHT, CompanionUltimateButton, LEFT, 35, 0)
end
end
function UI.OnPlayerLoaded()
-- Initialize our controls
UI.InitializeControls()
UI.HideControls()
UI.AddUiAsFragment()
UI.Initialize()
-- Unload our initial hook
EVENT_MANAGER:UnregisterForEvent(UI.name, EVENT_PLAYER_ACTIVATED)
-- CHAT_SYSTEM:AddMessage("garf")
end
function UI.OnUpdate()
local framerate = GetFramerate()
local ping = GetLatency()
UnitFramesInfoRightBlockFPSLabel:SetText(string.format("%d fps & %s ms", framerate, ping))
UnitFramesInfoRightBlockTimeLabel:SetText(string.format("%s", GetTimeString()))
if framerate > 30 and ping < 200 then
local color = ZO_ColorDef:New("387039")
UnitFramesInfoRightBlockFPSLabel:SetColor(color:UnpackRGBA())
else
local color = ZO_ColorDef:New("933f3f")
UnitFramesInfoRightBlockFPSLabel:SetColor(color:UnpackRGBA())
end
local currencyType = CURT_MONEY
local formatType = ZO_CURRENCY_FORMAT_AMOUNT_ICON
local currencyString = zo_strformat(SI_NUMBER_FORMAT,
ZO_Currency_FormatKeyboard(currencyType, GetCurrentMoney(), formatType))
UnitFramesInfoRightBlockGoldLabel:SetText(string.format("%s", currencyString))
end
function UI.Initialize()
UI.InitUnitPower("player")
UI.InitializeGroup()
UI.InitializeSkillBar()
end
function UI.InitializeSkillBar()
local LActionBar = nil
local LBackBar = nil
LActionBar = GetControl("ZO_ActionBar1")
LBBackBar = GetControl("LUI_Backbar")
-- Vanilla Action Bar
if LActionBar ~= nil then
LActionBar:ClearAnchors()
LActionBar:SetAnchor(CENTER, GuiRoot, BOTTOM, 0, -320)
-- Quick fix for making the quickslot button not spazz out on FancyActionBars
TempFixActionBar()
end
-- LUI Action Bar
if LBackBar ~= nil then
CHAT_SYSTEM:AddMessage("garf")
LBackBar:ClearAnchors()
LBackBar:SetAnchor(CENTER, GuiRoot, BOTTOM, 0, -300)
end
-- local actionBar = WINDOW_MANAGER:GetNamedChild("Z0_ActionBar1")
-- actionBar = GetControl(GuiRoot, "ActionBarContainer")
-- actionBar = WINDOW_MANAGER:GetNamedChild("ActionBarContainer")
-- actionBar = GetControl("Z0_ActionBar1")
-- actionBar = WINDOW_MANAGER:GetControlByName("Z0_ActionBar1")
-- actionBar:SetAnchor(CENTER,)
-- bar = WINDOW_MANAGER:GetControlByName("Z0_ActionBar1")
-- bar:SetAnchor(CENTER, GuiRoot, CENTER, 0, 0)
end
function UI.InitializeGroup()
-- Temp fix for quickbar button
TempFixActionBar()
-- Actually disabling group frames since its not working for groups larger then 4
-- for i = 1, 4 do
-- unitTag = "group" .. i
-- if DoesUnitExist(unitTag) then
-- UI.InitUnitPower(unitTag)
-- else
-- UI.SetHidden(unitTag, true)
-- end
-- end
end
function UI.InitializeControls()
unitFrames = {
["player"] = UnitFramesPlayer,
["reticleover"] = UnitFramesTarget,
["group1"] = UnitFramesGroup1,
["group2"] = UnitFramesGroup2,
["group3"] = UnitFramesGroup3,
["group4"] = UnitFramesGroup4
}
powertype_controls = {}
powertype_controls["player"] = {
["HEALTH_SHIELD_CURRENT_LABEL"] = UnitFramesPlayerDefenceHealthShieldValueLabel,
["HEALTH_CURRENT_LABEL"] = UnitFramesPlayerDefenceHealthValueLabel,
["HEALTH_BAR"] = UnitFramesPlayerDefenceHealthBar,
["MAGICKA_CURRENT_LABEL"] = UnitFramesPlayerResourceMagickaValueLabel,
["MAGICKA_BAR"] = UnitFramesPlayerResourceMagickaBar,
["STAMINA_CURRENT_LABEL"] = UnitFramesPlayerResourceStaminaValueLabel,
["STAMINA_BAR"] = UnitFramesPlayerResourceStaminaBar
}
powertype_controls["reticleover"] = {
["RANK"] = UnitFramesTargetRank,
["NAME"] = UnitFramesTargetInfoName,
["CLASS_ICON"] = UnitFramesTargetClassIcon,
["CHAMPION_ICON"] = UnitFramesTargetChampionIcon,
["RACE"] = UnitFramesTargetRace,
["HEALTH_SHIELD_CURRENT_LABEL"] = UnitFramesTargetHealthShieldValueLabel,
["HEALTH_CURRENT_LABEL"] = UnitFramesTargetHealthValueLabel,
["HEALTH_BAR"] = UnitFramesTargetHealthBar
}
for i = 1, 4 do
powertype_controls["group" .. i] = {
["NAME"] = WINDOW_MANAGER:GetControlByName("UnitFramesGroup" .. i .. "Name"),
["HEALTH"] = WINDOW_MANAGER:GetControlByName("UnitFramesGroup" .. i .. "Health"),
["HEALTH_CURRENT_LABEL"] = WINDOW_MANAGER:GetControlByName("UnitFramesGroup" .. i .. "HealthValueLabel"),
["HEALTH_SHIELD_CURRENT_LABEL"] = WINDOW_MANAGER:GetControlByName(
"UnitFramesGroup" .. i .. "HealthShieldValueLabel"
),
["HEALTH_BAR"] = WINDOW_MANAGER:GetControlByName("UnitFramesGroup" .. i .. "HealthBar"),
["HEALTH_BORDER"] = WINDOW_MANAGER:GetControlByName("UnitFramesGroup" .. i .. "HealthBorder"),
["HEALTH_BACKDROP"] = WINDOW_MANAGER:GetControlByName("UnitFramesGroup" .. i .. "HealthBackdrop")
}
end
end
function UI.OnPowerUpdate(eventCode, unitTag, powerIndex, powerType, powerValue, powerMax, powerEffectiveMax)
if powertype_controls == nil then
return
end
if unitTag == "player" then
if powerType == POWERTYPE_HEALTH then
powertype_controls[unitTag]["HEALTH_BAR"]:SetMinMax(0, powerEffectiveMax)
powertype_controls[unitTag]["HEALTH_BAR"]:SetValue(powerValue)
UI.SetPowerStatusValue(unitTag, "HEALTH", powerValue, powerEffectiveMax)
end
if powerType == POWERTYPE_MAGICKA then
powertype_controls[unitTag]["MAGICKA_BAR"]:SetMinMax(0, powerEffectiveMax)
powertype_controls[unitTag]["MAGICKA_BAR"]:SetValue(powerValue)
UI.SetPowerStatusValue(unitTag, "MAGICKA", powerValue, powerEffectiveMax)
end
if powerType == POWERTYPE_STAMINA then
powertype_controls[unitTag]["STAMINA_BAR"]:SetMinMax(0, powerEffectiveMax)
powertype_controls[unitTag]["STAMINA_BAR"]:SetValue(powerValue)
UI.SetPowerStatusValue(unitTag, "STAMINA", powerValue, powerEffectiveMax)
end
end
if unitTag == "reticleover" then
powertype_controls[unitTag]["HEALTH_BAR"]:SetMinMax(0, powerEffectiveMax)
powertype_controls[unitTag]["HEALTH_BAR"]:SetValue(powerValue)
UI.SetPowerStatusValue(unitTag, "HEALTH", powerValue, powerEffectiveMax)
end
if unitTag == "group1" or unitTag == "group2" or unitTag == "group3" or unitTag == "group4" then
powertype_controls[unitTag]["HEALTH_BAR"]:SetMinMax(0, powerEffectiveMax)
powertype_controls[unitTag]["HEALTH_BAR"]:SetValue(powerValue)
UI.SetPowerStatusValue(unitTag, "HEALTH", powerValue, powerEffectiveMax)
end
end
function UI.OnVisualAdded(eventCode, unitTag, unitAttributeVisual, statType, attributeType, powerType, value, maxValue)
if unitAttributeVisual == ATTRIBUTE_VISUAL_POWER_SHIELDING then
if unitTag == "player" then
local shieldColor = ZO_ColorDef:New("8f8f8f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(shieldColor:UnpackRGBA())
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText(string.format("(%d)", value))
end
if unitTag == "reticleover" then
local shieldColor = ZO_ColorDef:New("8f8f8f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(shieldColor:UnpackRGBA())
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText(string.format("(%d)", value))
end
if unitTag == "group1" or unitTag == "group2" or unitTag == "group3" or unitTag == "group4" then
local shieldColor = ZO_ColorDef:New("8f8f8f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(shieldColor:UnpackRGBA())
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText(string.format("(%d)", value))
end
end
end
function UI.OnVisualUpdated(
eventCode,
unitTag,
unitAttributeVisual,
statType,
attributeType,
powerType,
oldValue,
newValue,
value,
maxValue)
if unitAttributeVisual == ATTRIBUTE_VISUAL_POWER_SHIELDING then
if unitTag == "player" then
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText(string.format("(%d)", newValue))
end
if unitTag == "reticleover" then
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText(string.format("(%d)", newValue))
end
if unitTag == "group1" or unitTag == "group2" or unitTag == "group3" or unitTag == "group4" then
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText(string.format("(%d)", newValue))
end
end
end
function UI.OnVisualRemoved(
eventCode,
unitTag,
unitAttributeVisual,
statType,
attributeType,
powerType,
value,
maxValue)
if powertype_controls == nil then
return
end
if unitAttributeVisual == ATTRIBUTE_VISUAL_POWER_SHIELDING then
if unitTag == "player" then
local backToHealthColor = ZO_ColorDef:New("933f3f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(backToHealthColor:UnpackRGBA())
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText("")
end
if unitTag == "reticleover" then
local backToHealthColor = ZO_ColorDef:New("933f3f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(backToHealthColor:UnpackRGBA())
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText("")
end
if unitTag == "group1" or unitTag == "group2" or unitTag == "group3" or unitTag == "group4" then
local backToHealthColor = ZO_ColorDef:New("933f3f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(backToHealthColor:UnpackRGBA())
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText("")
end
end
end
function UI.OnTargetChanged(eventCode)
if DoesUnitExist("reticleover") then
unitFrames["reticleover"]:SetHidden(false)
UI.InitUnitPower("reticleover")
else
unitFrames["reticleover"]:SetHidden(true)
end
end
function UI.OnPlayerRez(eventCode)
UI.InitUnitPower("player")
UI.InitializeGroup()
end
function UI.InitUnitPower(unitTag)
local currentHealth, maxHealth, effectiveMaxHealth = GetUnitPower(unitTag, POWERTYPE_HEALTH)
local currentMagicka, maxMagicka, effectiveMaxMagicka = GetUnitPower(unitTag, POWERTYPE_MAGICKA)
local currentStamina, maxStamina, effectiveMaxStamina = GetUnitPower(unitTag, POWERTYPE_STAMINA)
local shield, _ =
GetUnitAttributeVisualizerEffectInfo(
unitTag,
ATTRIBUTE_VISUAL_POWER_SHIELDING,
STAT_MITIGATION,
ATTRIBUTE_HEALTH,
POWERTYPE_HEALTH
)
if unitTag == "player" then
if shield == nil then
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText("")
local backToHealthColor = ZO_ColorDef:New("933f3f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(backToHealthColor:UnpackRGBA())
else
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText(string.format("(%d)", shield))
local shieldColor = ZO_ColorDef:New("8f8f8f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(shieldColor:UnpackRGBA())
end
powertype_controls[unitTag]["HEALTH_BAR"]:SetMinMax(0, maxHealth)
powertype_controls[unitTag]["HEALTH_BAR"]:SetValue(currentHealth)
UI.SetPowerStatusValue(unitTag, "HEALTH", currentHealth, effectiveMaxHealth)
powertype_controls[unitTag]["MAGICKA_BAR"]:SetMinMax(0, maxMagicka)
powertype_controls[unitTag]["MAGICKA_BAR"]:SetValue(currentMagicka)
UI.SetPowerStatusValue(unitTag, "MAGICKA", currentMagicka, effectiveMaxMagicka)
powertype_controls[unitTag]["STAMINA_BAR"]:SetMinMax(0, maxStamina)
powertype_controls[unitTag]["STAMINA_BAR"]:SetValue(currentStamina)
UI.SetPowerStatusValue(unitTag, "STAMINA", currentStamina, effectiveMaxStamina)
end
if unitTag == "reticleover" then
local unitAlliance = GetUnitAlliance(unitTag)
if shield == nil then
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText("")
if unitAlliance == 1 then
local backToHealthColor = ZO_ColorDef:New("b2984a")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(backToHealthColor:UnpackRGBA())
end
if unitAlliance == 2 then
local backToHealthColor = ZO_ColorDef:New("973735")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(backToHealthColor:UnpackRGBA())
end
if unitAlliance == 3 then
local backToHealthColor = ZO_ColorDef:New("587d9f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(backToHealthColor:UnpackRGBA())
end
else
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText(string.format("(%d)", shield))
local shieldColor = ZO_ColorDef:New("8f8f8f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(shieldColor:UnpackRGBA())
end
powertype_controls[unitTag]["HEALTH_BAR"]:SetMinMax(0, maxHealth)
powertype_controls[unitTag]["HEALTH_BAR"]:SetValue(currentHealth)
powertype_controls[unitTag]["NAME"]:SetText(GetUnitName(unitTag))
--powertype_controls[unitTag]["DISPLAY_NAME"]:SetText(GetUnitDisplayName(unitTag))
powertype_controls[unitTag]["RACE"]:SetText(GetUnitRace(unitTag))
if IsUnitPlayer(unitTag) then
powertype_controls[unitTag]["CLASS_ICON"]:SetTexture(classIcons[GetUnitClassId(unitTag)])
powertype_controls[unitTag]["CLASS_ICON"]:SetHidden(false)
powertype_controls[unitTag]["RANK"]:SetHidden(false)
if IsUnitChampion(unitTag) then
powertype_controls[unitTag]["RANK"]:SetText(GetUnitChampionPoints(unitTag))
powertype_controls[unitTag]["CHAMPION_ICON"]:SetHidden(false)
else
powertype_controls[unitTag]["RANK"]:SetText(GetUnitLevel(unitTag))
powertype_controls[unitTag]["CHAMPION_ICON"]:SetHidden(true)
end
else
powertype_controls[unitTag]["CLASS_ICON"]:SetHidden(true)
powertype_controls[unitTag]["RANK"]:SetHidden(true)
powertype_controls[unitTag]["CHAMPION_ICON"]:SetHidden(true)
end
UI.SetPowerStatusValue(unitTag, "HEALTH", currentHealth, effectiveMaxHealth)
end
if unitTag == "group1" or unitTag == "group2" or unitTag == "group3" or unitTag == "group4" then
UI.SetHidden(unitTag, false)
if IsUnitOnline(unitTag) then
powertype_controls[unitTag]["NAME"]:SetText(GetUnitName(unitTag))
if shield == nil then
local backToHealthColor = ZO_ColorDef:New("933f3f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(backToHealthColor:UnpackRGBA())
else
powertype_controls[unitTag]["HEALTH_SHIELD_CURRENT_LABEL"]:SetText(string.format("(%d)", shield))
local shieldColor = ZO_ColorDef:New("8f8f8f")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(shieldColor:UnpackRGBA())
end
else
powertype_controls[unitTag]["NAME"]:SetText(GetUnitName(unitTag) .. " - offline")
local offlineColor = ZO_ColorDef:New("1a1a1a")
powertype_controls[unitTag]["HEALTH_BAR"]:SetColor(offlineColor:UnpackRGBA())
end
powertype_controls[unitTag]["HEALTH_BAR"]:SetMinMax(0, maxHealth)
powertype_controls[unitTag]["HEALTH_BAR"]:SetValue(currentHealth)
UI.SetPowerStatusValue(unitTag, "HEALTH", currentHealth, effectiveMaxHealth)
end
end
function UI.SetPowerStatusValue(unitTag, type, current, effective)
if unitTag == "player" then
powertype_controls[unitTag][type .. "_CURRENT_LABEL"]:SetText(string.format("%s / %s", current, effective))
end
if unitTag == "reticleover" then
powertype_controls[unitTag][type .. "_CURRENT_LABEL"]:SetText(string.format("%s / %s", current, effective))
end
if unitTag == "group1" or unitTag == "group2" or unitTag == "group3" or unitTag == "group4" then
powertype_controls[unitTag][type .. "_CURRENT_LABEL"]:SetText(string.format("%s / %s", current, effective))
end
end
function UI.HideControls()
ZO_UnitFramesGroups:SetHidden(true)
ZO_PlayerAttributeMagicka:UnregisterForEvent(EVENT_POWER_UPDATE)
ZO_PlayerAttributeMagicka:UnregisterForEvent(EVENT_INTERFACE_SETTING_CHANGED)
ZO_PlayerAttributeMagicka:UnregisterForEvent(EVENT_PLAYER_ACTIVATED)
EVENT_MANAGER:UnregisterForUpdate("ZO_PlayerAttributeMagickaFadeUpdate")
ZO_PlayerAttributeMagicka:SetHidden(true)
ZO_PlayerAttributeStamina:UnregisterForEvent(EVENT_POWER_UPDATE)
ZO_PlayerAttributeStamina:UnregisterForEvent(EVENT_INTERFACE_SETTING_CHANGED)
ZO_PlayerAttributeStamina:UnregisterForEvent(EVENT_PLAYER_ACTIVATED)
EVENT_MANAGER:UnregisterForUpdate("ZO_PlayerAttributeStaminaFadeUpdate")
ZO_PlayerAttributeStamina:SetHidden(true)
ZO_PlayerAttributeHealth:UnregisterForEvent(EVENT_POWER_UPDATE)
ZO_PlayerAttributeHealth:UnregisterForEvent(EVENT_INTERFACE_SETTING_CHANGED)
ZO_PlayerAttributeHealth:UnregisterForEvent(EVENT_PLAYER_ACTIVATED)
EVENT_MANAGER:UnregisterForUpdate("ZO_PlayerAttributeHealthFadeUpdate")
ZO_PlayerAttributeHealth:SetHidden(true)
ZO_PlayerAttributeMountStamina:UnregisterForEvent(EVENT_POWER_UPDATE)
ZO_PlayerAttributeMountStamina:UnregisterForEvent(EVENT_INTERFACE_SETTING_CHANGED)
ZO_PlayerAttributeMountStamina:UnregisterForEvent(EVENT_PLAYER_ACTIVATED)
EVENT_MANAGER:UnregisterForUpdate("ZO_PlayerAttributeMountStamina")
ZO_PlayerAttributeMountStamina:SetHidden(true)
--[[ ZO_TargetUnitFramereticleover:SetHidden(true)
ZO_TargetUnitFramereticleoverBarLeft:SetHidden(true)
ZO_TargetUnitFramereticleoverBarLeftGloss:SetHidden(true)
ZO_TargetUnitFramereticleoverBarRight:SetHidden(true)
ZO_TargetUnitFramereticleoverBarRightGloss:SetHidden(true)
ZO_TargetUnitFramereticleoverBgContainer:SetHidden(true)
ZO_TargetUnitFramereticleoverBgContainerBgCenter:SetHidden(true)
ZO_TargetUnitFramereticleoverBgContainerBgLeft:SetHidden(true)
ZO_TargetUnitFramereticleoverBgContainerBgRight:SetHidden(true)
ZO_TargetUnitFramereticleoverCaption:SetHidden(true)
ZO_TargetUnitFramereticleoverFrameCenter:SetHidden(true)
ZO_TargetUnitFramereticleoverFrameCenterBottomMunge:SetHidden(true)
ZO_TargetUnitFramereticleoverFrameCenterTopMunge:SetHidden(true)
ZO_TargetUnitFramereticleoverFrameLeft:SetHidden(true)
ZO_TargetUnitFramereticleoverFrameRight:SetHidden(true)
ZO_TargetUnitFramereticleoverLeftBracket:SetHidden(true)
ZO_TargetUnitFramereticleoverLeftBracketGlow:SetHidden(true)
ZO_TargetUnitFramereticleoverLeftBracketUnderlay:SetHidden(true)
ZO_TargetUnitFramereticleoverLevel:SetHidden(true)
ZO_TargetUnitFramereticleoverName:SetHidden(true)
ZO_TargetUnitFramereticleoverRankIcon:SetHidden(true)
ZO_TargetUnitFramereticleoverRightBracket:SetHidden(true)
ZO_TargetUnitFramereticleoverRightBracketGlow:SetHidden(true)
ZO_TargetUnitFramereticleoverRightBracketUnderlay:SetHidden(true)
ZO_TargetUnitFramereticleoverTextArea:SetHidden(true)
ZO_TargetUnitFramereticleoverWarner:SetHidden(true) ]]
--UI.HideCompass(true)
end
function UI.HideCompass(hide)
-- frame
lCompassFrame = COMPASS_FRAME.control
if lCompassFrame then
for lIndex, lPos in pairs({ "Left", "Center", "Right" }) do
lWidget = lCompassFrame:GetNamedChild(lPos)
if lWidget then
lWidget:SetHidden(hide)
end
end
end
-- pins
lCompassPins = COMPASS.control
if lCompassPins then
lWidget = lCompassPins:GetNamedChild("Container")
if lWidget then
lWidget:SetHidden(hide)
end
end
if hide then
-- above text
COMPASS.centerOverPinLabel:SetText("")
COMPASS.centerOverPinLabelAnimation:PlayBackward()
end
end
function UI.AddUiAsFragment()
for key, value in pairs(unitFrames) do
local fragment = ZO_FadeSceneFragment:New(value)
SCENE_MANAGER:GetScene("hud"):AddFragment(fragment)
SCENE_MANAGER:GetScene("hudui"):AddFragment(fragment)
end
end
function UI.SetHidden(unitTag, value)
powertype_controls[unitTag]["HEALTH"]:SetHidden(value)
powertype_controls[unitTag]["NAME"]:SetHidden(value)
end
function UI.OnGroupMemberJoined(eventCode, name)
UI.InitializeGroup()
end
function UI.OnGroupMemberLeft(eventCode, name)
UI.InitializeGroup()
end
function UI.OnGroupMemberConnectionChanged(eventCode, unitTag, isOnline)
UI.InitializeGroup()
end
-- Load our addon
EVENT_MANAGER:RegisterForEvent(UI.name, EVENT_ADD_ON_LOADED, UI.OnAddOnLoaded)