Skip to content

Commit bca735d

Browse files
committed
4.400
Added trauma bars, new assistant, and fixed ZO_UIErrors display bug.
1 parent 8599993 commit bca735d

15 files changed

+190
-29
lines changed

BUI_Curved.lua

+44-10
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ BUI.Curved={
1212
-- CurvedShiftAnimation
1313
}
1414
}
15-
local ch,cm,cs,cw,ch1,cm1,cs1,cw1,rh,rh1
15+
local ch,cm,cs,ct,cw,ch1,cm1,cs1,ct1,cw1,rh,rh1
1616
local disable_hit_anim
1717
local coords={
1818
--Simple
@@ -91,30 +91,37 @@ local function UI_Init()
9191
[1] =BUI.UI.Texture("BUI_Curved_HealthTop1", ui, {w1,h*delta}, {BOTTOMLEFT,(delta==1 and BOTTOMLEFT or LEFT),0,0}, texture, false, {1,0}, coord),
9292
[2] =BUI.UI.Texture("BUI_Curved_HealthTop2", ui, {w1,h*delta}, {BOTTOMLEFT,(delta==1 and BOTTOMLEFT or LEFT),0,0}, texture, false, {0,1}, coord),
9393
[3] =BUI.UI.Texture("BUI_Curved_HealthTop3", ui, {w1,h*delta}, {BOTTOMLEFT,(delta==1 and BOTTOMLEFT or LEFT),0,0}, texture, true, {1,1}, coord),
94+
[4] =BUI.UI.Texture("BUI_Curved_HealthTop4", ui, {w1,h*delta}, {BOTTOMLEFT,(delta==1 and BOTTOMLEFT or LEFT),0,0}, texture, true, {1,1}, coord),
9495
coord=coord
9596
}
9697
ui.health.top[1]:SetGradientColors(2,ch[1],ch[2],ch[3],ch[4],ch1[1],ch1[2],ch1[3],ch1[4])
9798
ui.health.top[2]:SetColor(ch[1],ch[2],ch[3],.4)
9899
ui.health.top[3]:SetGradientColors(2,cw[1],cw[2],cw[3],cw[4],cw1[1],cw1[2],cw1[3],cw1[4])
99100
ui.health.top[3]:SetAlpha(.4)
101+
ui.health.top[4]:SetGradientColors(2,ct[1],ct[2],ct[3],ct[4],ct1[1],ct1[2],ct1[3],ct1[4])
102+
ui.health.top[4]:SetAlpha(ct[4])
100103
local coord=coords[c][3]
101104
if coord then
102105
local delta=math.abs(coord[3]-coord[4])
103106
ui.health.bot={
104107
[1] =BUI.UI.Texture("BUI_Curved_HealthBot1", ui, {w1,h*delta}, {TOPLEFT,(delta==1 and TOPLEFT or LEFT),0,0}, texture, false, {1,0}, coord),
105108
[2] =BUI.UI.Texture("BUI_Curved_HealthBot2", ui, {w1,h*delta}, {TOPLEFT,(delta==1 and TOPLEFT or LEFT),0,0}, texture, false, {0,1}, coord),
106109
[3] =BUI.UI.Texture("BUI_Curved_HealthBot3", ui, {w1,h*delta}, {TOPLEFT,(delta==1 and TOPLEFT or LEFT),0,0}, texture, true, {1,1}, coord),
110+
[4] =BUI.UI.Texture("BUI_Curved_HealthBot4", ui, {w1,h*delta}, {TOPLEFT,(delta==1 and TOPLEFT or LEFT),0,0}, texture, true, {1,1}, coord),
107111
coord=coord
108112
}
109113
ui.health.bot[1]:SetGradientColors(2,ch1[1],ch1[2],ch1[3],ch1[4],ch[1],ch[2],ch[3],ch[4])
110114
ui.health.bot[2]:SetColor(ch[1],ch[2],ch[3],.4)
111115
ui.health.bot[3]:SetGradientColors(2,cw1[1],cw1[2],cw1[3],cw1[4],cw[1],cw[2],cw[3],cw[4])
112116
ui.health.bot[3]:SetAlpha(.4)
117+
ui.health.bot[4]:SetGradientColors(2,ct1[1],ct1[2],ct1[3],ct1[4],ct[1],ct[2],ct[3],ct[4])
118+
ui.health.bot[4]:SetAlpha(ct[4])
113119
else
114120
ui.health.bot=nil
115121
if BUI_Curved_HealthBot1 then BUI_Curved_HealthBot1:SetHidden(true) end
116122
if BUI_Curved_HealthBot2 then BUI_Curved_HealthBot2:SetHidden(true) end
117123
if BUI_Curved_HealthBot3 then BUI_Curved_HealthBot3:SetHidden(true) end
124+
if BUI_Curved_HealthBot4 then BUI_Curved_HealthBot4:SetHidden(true) end
118125
end
119126
Attributes.player.health.frame=ui.health
120127

@@ -144,30 +151,37 @@ local function UI_Init()
144151
[1] =BUI.UI.Texture("BUI_Curved_TargetBot1", target, {w1,h*delta}, {BOTTOMRIGHT,(delta==1 and BOTTOMRIGHT or RIGHT),0,0}, texture, false, {1,0}, coord),
145152
[2] =BUI.UI.Texture("BUI_Curved_TargetBot2", target, {w1,h*delta}, {BOTTOMRIGHT,(delta==1 and BOTTOMRIGHT or RIGHT),0,0}, texture, false, {0,1}, coord),
146153
[3] =BUI.UI.Texture("BUI_Curved_TargetBot3", target, {w1,h*delta}, {BOTTOMRIGHT,(delta==1 and BOTTOMRIGHT or RIGHT),0,0}, texture, true, {1,1}, coord),
154+
[4] =BUI.UI.Texture("BUI_Curved_TargetBot4", target, {w1,h*delta}, {BOTTOMRIGHT,(delta==1 and BOTTOMRIGHT or RIGHT),0,0}, texture, true, {1,1}, coord),
147155
coord=coord
148156
}
149157
ui.target.bot[1]:SetGradientColors(2,ch[1],ch[2],ch[3],ch[4],ch1[1],ch1[2],ch1[3],ch1[4])
150158
ui.target.bot[2]:SetColor(ch[1],ch[2],ch[3],.4)
151159
ui.target.bot[3]:SetGradientColors(2,cw[1],cw[2],cw[3],cw[4],cw1[1],cw1[2],cw1[3],cw1[4])
152160
ui.target.bot[3]:SetAlpha(.4)
161+
ui.target.bot[4]:SetGradientColors(2,ct[1],ct[2],ct[3],ct[4],ct1[1],ct1[2],ct1[3],ct1[4])
162+
ui.target.bot[4]:SetAlpha(ct[4])
153163
local coord=coords[c][10]
154164
if coord then
155165
local delta=math.abs(coord[3]-coord[4])
156166
ui.target.top={
157167
[1] =BUI.UI.Texture("BUI_Curved_TargetTop1", target, {w1,h*delta}, {TOPRIGHT,(delta==1 and TOPRIGHT or RIGHT),0,0}, texture, false, {1,0}, coord),
158168
[2] =BUI.UI.Texture("BUI_Curved_TargetTop2", target, {w1,h*delta}, {TOPRIGHT,(delta==1 and TOPRIGHT or RIGHT),0,0}, texture, false, {0,1}, coord),
159169
[3] =BUI.UI.Texture("BUI_Curved_TargetTop3", target, {w1,h*delta}, {TOPRIGHT,(delta==1 and TOPRIGHT or RIGHT),0,0}, texture, true, {1,1}, coord),
170+
[4] =BUI.UI.Texture("BUI_Curved_TargetTop4", target, {w1,h*delta}, {TOPRIGHT,(delta==1 and TOPRIGHT or RIGHT),0,0}, texture, true, {1,1}, coord),
160171
coord=coord
161172
}
162173
ui.target.top[1]:SetGradientColors(2,ch1[1],ch1[2],ch1[3],ch1[4],ch[1],ch[2],ch[3],ch[4])
163174
ui.target.top[2]:SetColor(ch[1],ch[2],ch[3],.4)
164175
ui.target.top[3]:SetGradientColors(2,cw1[1],cw1[2],cw1[3],cw1[4],cw[1],cw[2],cw[3],cw[4])
165176
ui.target.top[3]:SetAlpha(.4)
177+
ui.target.top[4]:SetGradientColors(2,ct1[1],ct1[2],ct1[3],ct1[4],ct[1],ct[2],ct[3],ct[4])
178+
ui.target.top[4]:SetAlpha(ct[4])
166179
else
167180
ui.target.top=nil
168181
if BUI_Curved_TargetTop1 then BUI_Curved_TargetTop1:SetHidden(true) end
169182
if BUI_Curved_TargetTop2 then BUI_Curved_TargetTop2:SetHidden(true) end
170183
if BUI_Curved_TargetTop3 then BUI_Curved_TargetTop3:SetHidden(true) end
184+
if BUI_Curved_TargetTop4 then BUI_Curved_TargetTop4:SetHidden(true) end
171185
end
172186
Attributes.reticleover.health.frame=ui.target
173187

@@ -432,7 +446,7 @@ local function FramesFadeCheck(pct)
432446
end
433447
end
434448

435-
function BUI.Curved.Attribute(unitTag, attribute, powerValue, powerMax, pct, shieldValue)
449+
function BUI.Curved.Attribute(unitTag, attribute, powerValue, powerMax, pct, shieldValue, traumaValue)
436450
local frame=Attributes[unitTag] and Attributes[unitTag][attribute] and Attributes[unitTag][attribute].frame
437451
if not frame then return end
438452

@@ -455,23 +469,43 @@ function BUI.Curved.Attribute(unitTag, attribute, powerValue, powerMax, pct, shi
455469

456470
ChangeAttribute(frame,pct)
457471
if frame.cur then
458-
local shield=((attribute=="health" and shieldValue and shieldValue>0) and " ["..BUI.DisplayNumber(shieldValue/1000).."k]" or "")
459-
frame.cur:SetText(BUI.DisplayNumber(powerValue/1000, 1).."k"..shield)
472+
local preText=((shieldValue>0 or traumaValue>0) and " [" or "")
473+
local postText=((shieldValue>0 or traumaValue>0) and "]" or "")
474+
local shield=((attribute=="health" and shieldValue and shieldValue>0) and BUI.DisplayNumber(shieldValue/1000).."k" or "")
475+
local trauma=((attribute=="health" and traumaValue and traumaValue>0) and "-"..BUI.DisplayNumber(traumaValue/1000).."k" or "")
476+
frame.cur:SetText(BUI.DisplayNumber(powerValue/1000, 1).."k"..preText..shield..trauma..postText)
460477
end
461478
if frame.pct then frame.pct:SetText(pct*100 .."%") end
462479
end
463480

464-
function BUI.Curved.Shield(unitTag,value,pct,health)
465-
local frame=Attributes[unitTag] and Attributes[unitTag].health and Attributes[unitTag].health.frame
481+
function BUI.Curved.Shield(unitTag,value,pct,health,traumaValue)
482+
local frame=Attributes[unitTag] and Attributes[unitTag].health and Attributes[unitTag].health.frame
466483
if frame then
467484
if frame.cur then
468-
local shield=(value>0 and " ["..BUI.DisplayNumber(value/1000).."k]" or "")
469-
frame.cur:SetText(BUI.DisplayNumber(health/1000, 1).."k"..shield)
485+
local preText=((value>0 or traumaValue>0) and " [" or "")
486+
local postText=((value>0 or traumaValue>0) and "]" or "")
487+
local shield=(value>0 and BUI.DisplayNumber(value/1000).."k" or "")
488+
local trauma=(traumaValue>0 and "-"..BUI.DisplayNumber(traumaValue/1000).."k" or "")
489+
frame.cur:SetText(BUI.DisplayNumber(health/1000, 1).."k"..preText..shield..trauma..postText)
470490
end
471491
ChangeAttribute(frame,pct,3)
472492
end
473493
end
474494

495+
function BUI.Curved.Trauma(unitTag,value,pct,health,shieldValue)
496+
local frame=Attributes[unitTag] and Attributes[unitTag].health and Attributes[unitTag].health.frame
497+
if frame then
498+
if frame.cur then
499+
local preText=((value>0 or shieldValue>0) and " [" or "")
500+
local postText=((value>0 or shieldValue>0) and "]" or "")
501+
local shield=(shieldValue>0 and BUI.DisplayNumber(shieldValue/1000).."k" or "")
502+
local trauma=(value>0 and "-"..BUI.DisplayNumber(value/1000).."k" or "")
503+
frame.cur:SetText(BUI.DisplayNumber(health/1000, 1).."k"..preText..shield..trauma..postText)
504+
end
505+
ChangeAttribute(frame,pct,4)
506+
end
507+
end
508+
475509
function BUI.Curved.Target(show)
476510
if show then
477511
local powerValue, powerMax=GetUnitPower('reticleover', POWERTYPE_HEALTH)
@@ -560,8 +594,8 @@ function BUI.Curved.Initialize() --Initialisation
560594
return
561595
end
562596
theme_color=BUI.Vars.Theme==6 and {1,204/255,248/255,1} or BUI.Vars.Theme==7 and BUI.Vars.AdvancedThemeColor or BUI.Vars.CustomEdgeColor
563-
ch,cm,cs,cw=BUI.Vars.FrameHealthColor,BUI.Vars.FrameMagickaColor,BUI.Vars.FrameStaminaColor,BUI.Vars.FrameShieldColor
564-
ch1,cm1,cs1,cw1=BUI.Vars.FrameHealthColor1,BUI.Vars.FrameMagickaColor1,BUI.Vars.FrameStaminaColor1,BUI.Vars.FrameShieldColor1
597+
ch,cm,cs,cw,ct=BUI.Vars.FrameHealthColor,BUI.Vars.FrameMagickaColor,BUI.Vars.FrameStaminaColor,BUI.Vars.FrameShieldColor,BUI.Vars.FrameTraumaColor
598+
ch1,cm1,cs1,cw1,ct1=BUI.Vars.FrameHealthColor1,BUI.Vars.FrameMagickaColor1,BUI.Vars.FrameStaminaColor1,BUI.Vars.FrameShieldColor1,BUI.Vars.FrameTraumaColor1
565599
rh,rh1={1-ch[1],1-ch[2],1-ch[3],1-ch[4]},{1-ch1[1],1-ch1[2],1-ch1[3],1-ch1[4]}
566600
disable_hit_anim=not BUI.Vars.CurvedHitAnimation
567601
UI_Init()

BUI_Events.lua

+9
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ local function OnVisualAdded(eventCode, unitTag, unitAttributeVisual, statType,
175175
if unitAttributeVisual==ATTRIBUTE_VISUAL_POWER_SHIELDING then
176176
BUI.Player:UpdateShield(unitTag, (sequenceId==0 and value or 0), maxValue)
177177
if sequenceId==0 and value>20000 then BUI.Buffs.BarrierActive=GetGameTimeSeconds()+30 end
178+
elseif unitAttributeVisual==ATTRIBUTE_VISUAL_TRAUMA then
179+
BUI.Player:UpdateTrauma(unitTag, (sequenceId==0 and value or 0), maxValue)
178180
elseif statType==3 and unitAttributeVisual==ATTRIBUTE_VISUAL_DECREASED_STAT and value>1000 then --unitAttributeVisual==ATTRIBUTE_VISUAL_INCREASED_STAT
179181
if BUI.Vars.PlayerFrame then BUI.Frames:AttributeVisual(unitTag,unitAttributeVisual,sequenceId==0) end
180182
elseif unitAttributeVisual==ATTRIBUTE_VISUAL_INCREASED_REGEN_POWER or unitAttributeVisual==ATTRIBUTE_VISUAL_DECREASED_REGEN_POWER then
@@ -185,6 +187,8 @@ local function OnVisualAdded(eventCode, unitTag, unitAttributeVisual, statType,
185187
elseif unitTag=="reticleover" and powerType==POWERTYPE_HEALTH then
186188
if unitAttributeVisual==ATTRIBUTE_VISUAL_POWER_SHIELDING then
187189
if BUI_TargetFrame then BUI.Player:UpdateShield(unitTag, (sequenceId==0 and value or 0), maxValue) end
190+
elseif unitAttributeVisual==ATTRIBUTE_VISUAL_TRAUMA then
191+
if BUI_TargetFrame then BUI.Player:UpdateTrauma(unitTag, (sequenceId==0 and value or 0), maxValue) end
188192
elseif unitAttributeVisual==ATTRIBUTE_VISUAL_INCREASED_REGEN_POWER or unitAttributeVisual==ATTRIBUTE_VISUAL_DECREASED_REGEN_POWER then
189193
if BUI_TargetFrame then BUI.Frames.Regen(unitTag,unitAttributeVisual,powerType,(sequenceId==0 and 2000 or 0)) end
190194
if BUI.Vars.CurvedFrame~=0 then BUI.Curved.Regen(unitTag,unitAttributeVisual,powerType,(sequenceId==0 and 2000 or 0)) end
@@ -197,6 +201,8 @@ local function OnVisualAdded(eventCode, unitTag, unitAttributeVisual, statType,
197201
if powerType==POWERTYPE_HEALTH then
198202
if unitAttributeVisual==ATTRIBUTE_VISUAL_POWER_SHIELDING then
199203
BUI.Player:UpdateShield(unitTag, (sequenceId==0 and value or 0), maxValue)
204+
elseif unitAttributeVisual==ATTRIBUTE_VISUAL_TRAUMA then
205+
BUI.Player:UpdateTrauma(unitTag, (sequenceId==0 and value or 0), maxValue)
200206
elseif unitAttributeVisual==ATTRIBUTE_VISUAL_INCREASED_REGEN_POWER or unitAttributeVisual==ATTRIBUTE_VISUAL_DECREASED_REGEN_POWER then
201207
BUI.Frames:GroupRegen(unitTag,unitAttributeVisual,powerType,(sequenceId==0 and 2000 or 0))
202208
if unitAttributeVisual==ATTRIBUTE_VISUAL_DECREASED_REGEN_POWER then
@@ -232,6 +238,9 @@ local function OnVisualUpdate(eventCode, unitTag, unitAttributeVisual, statType,
232238
if powerType==POWERTYPE_HEALTH and unitAttributeVisual==ATTRIBUTE_VISUAL_POWER_SHIELDING then
233239
BUI.Player:UpdateShield(unitTag, newValue, newMaxValue)
234240
end
241+
if powerType==POWERTYPE_HEALTH and unitAttributeVisual==ATTRIBUTE_VISUAL_TRAUMA then
242+
BUI.Player:UpdateTrauma(unitTag, newValue, newMaxValue)
243+
end
235244
end
236245

237246
local function OnEffectChanged(_, changeType, _, effectName, unitTag, startTimeSec, endTimeSec, _, iconName, _, effectType, abilityType, statusEffectType, unitName, unitId, abilityId, sourceType)

0 commit comments

Comments
 (0)