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 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 |
local PAB_TEMPLATES = {
[ COMBAT_MECHANIC_FLAGS_MAGICKA ] = {
background = {
Left = "ZO_PlayerAttributeBgLeftArrow" ,
Right = "ZO_PlayerAttributeBgRight" ,
Center = "ZO_PlayerAttributeBgCenter" ,
} ,
frame = {
Left = "ZO_PlayerAttributeFrameLeftArrow" ,
Right = "ZO_PlayerAttributeFrameRight" ,
Center = "ZO_PlayerAttributeFrameCenter" ,
} ,
warner = {
Left = "ZO_PlayerAttributeWarnerLeftArrow" ,
Right = "ZO_PlayerAttributeWarnerRight" ,
Center = "ZO_PlayerAttributeWarnerCenter" ,
} ,
anchors = {
"ZO_PlayerAttributeBarAnchorLeft" ,
} ,
} ,
[ COMBAT_MECHANIC_FLAGS_HEALTH ] = {
background = {
Left = "ZO_PlayerAttributeBgLeftArrow" ,
Right = "ZO_PlayerAttributeBgRightArrow" ,
Center = "ZO_PlayerAttributeBgCenter" ,
small = "ZO_PlayerAttributeBgSmallCenter" ,
} ,
frame = {
Left = "ZO_PlayerAttributeFrameLeftArrow" ,
Right = "ZO_PlayerAttributeFrameRightArrow" ,
Center = "ZO_PlayerAttributeFrameCenter" ,
small = "ZO_PlayerAttributeFrameSmallCenter" ,
} ,
warner = {
Left = "ZO_PlayerAttributeWarnerLeftArrow" ,
Right = "ZO_PlayerAttributeWarnerRightArrow" ,
Center = "ZO_PlayerAttributeWarnerCenter" ,
} ,
anchors = {
"ZO_PlayerAttributeHealthBarAnchorLeft" ,
"ZO_PlayerAttributeHealthBarAnchorRight" ,
} ,
smallAnchors = {
"ZO_PlayerAttributeHealthBarSmallAnchorLeft" ,
"ZO_PlayerAttributeHealthBarSmallAnchorRight" ,
} ,
} ,
[ COMBAT_MECHANIC_FLAGS_STAMINA ] = {
background = {
Left = "ZO_PlayerAttributeBgLeft" ,
Right = "ZO_PlayerAttributeBgRightArrow" ,
Center = "ZO_PlayerAttributeBgCenter" ,
} ,
frame = {
Left = "ZO_PlayerAttributeFrameLeft" ,
Right = "ZO_PlayerAttributeFrameRightArrow" ,
Center = "ZO_PlayerAttributeFrameCenter" ,
} ,
warner = {
Left = "ZO_PlayerAttributeWarnerLeft" ,
Right = "ZO_PlayerAttributeWarnerRightArrow" ,
Center = "ZO_PlayerAttributeWarnerCenter" ,
} ,
anchors = {
"ZO_PlayerAttributeBarAnchorRight" ,
} ,
} ,
[ COMBAT_MECHANIC_FLAGS_WEREWOLF ] = {
background = {
small = "ZO_PlayerAttributeBgSmallLeft" ,
} ,
frame = {
small = "ZO_PlayerAttributeFrameSmallLeft" ,
} ,
smallAnchors = {
"ZO_PlayerAttributeSmallAnchorLeft" ,
} ,
} ,
[ COMBAT_MECHANIC_FLAGS_MOUNT_STAMINA ] = {
background = {
small = "ZO_PlayerAttributeBgSmallRight" ,
} ,
frame = {
small = "ZO_PlayerAttributeFrameSmallRight" ,
} ,
smallAnchors = {
"ZO_PlayerAttributeSmallAnchorRight" ,
} ,
} ,
statusBar = "ZO_PlayerAttributeStatusBar" ,
statusBarGloss = "ZO_PlayerAttributeStatusBarGloss" ,
statusBarSmall = "ZO_PlayerAttributeStatusBarSmall" ,
statusBarGlossSmall = "ZO_PlayerAttributeStatusBarGlossSmall" ,
resourceNumbersLabel = "ZO_PlayerAttributeResourceNumbers" ,
}
--Attribute Bar
-------------------
local DELAY_BEFORE_FADING = 1500
function ZO_PlayerAttributeBar : New ( control , barControls , powerType , unitOverride , secondPriorityUnitTag )
bar . barControls = barControls
bar . powerType = powerType
bar . unitTag = unitOverride or "player"
bar . secondPriorityUnitTag = secondPriorityUnitTag
bar . current = 0
bar . effectiveMax = 0
bar . fadeOutDelay = 0
bar . textEnabled = false
bar . forcedVisibleReferences = 0
control : RegisterForEvent ( EVENT_INTERFACE_SETTING_CHANGED , function ( _ , settingType , settingId ) bar : OnInterfaceSettingChanged ( settingType , settingId ) end )
control : AddFilterForEvent ( EVENT_INTERFACE_SETTING_CHANGED , REGISTER_FILTER_SETTING_SYSTEM_TYPE , SETTING_TYPE_UI )
control : RegisterForEvent ( EVENT_POWER_UPDATE , function ( _ , unitTag , powerPoolIndex , powerType , current , max , effectiveMax ) bar : OnPowerUpdate ( unitTag , powerPoolIndex , powerType , current , max , effectiveMax ) end )
if unitOverride or secondPriorityUnitTag then
control : RegisterForEvent ( EVENT_UNIT_CREATED , function ( _ , unitTag ) if self : IsUnitTag ( unitTag ) then self : UpdateStatusBar ( ) end end )
end
EVENT_MANAGER : RegisterForUpdate ( control : GetName ( ) .. "FadeUpdate" , DELAY_BEFORE_FADING , function ( ) bar : UpdateContextualFading ( ) end )
return bar
end
end
end
end
end
local gradient = ZO_POWER_BAR_GRADIENT_COLORS [ powerType ]
end
end
return false
end
local forceInit = false
forceInit = true
end
return
end
local barCurrent = current
barMax = barMax / 2
barCurrent = barCurrent / 2
end
end
if not forceInit then
end
end
end
end
local EXCLUDE_LINK_CHECK = true
-- externalVisibilityRequirement controls when the bar should never show, for example the mount stamina bar
-- should not show when the player is not mounted
return false
end
return false
end
if showSetting == RESOURCE_BARS_SETTING_CHOICE_ALWAYS_SHOW then
return true
elseif showSetting == RESOURCE_BARS_SETTING_CHOICE_DONT_SHOW then
return false
else -- showSetting is RESOURCE_BARS_SETTING_CHOICE_AUTOMATIC and we'll just use the default behavior
-- forceVisible is largely controlled by a UnitAttributeVisualizer to show the bars when there is something affecting them
-- like an armor buff/debuff or a shield applied
return true
end
return true
end
return true
end
return true
end
end
return false
end
end
end
end
end
end
end
if shouldContextuallyShow then
else
end
end
end
end
end
end
end
end
end
else
end
end
end
end
end
end
--Events
function ZO_PlayerAttributeBar : OnPowerUpdate ( unitTag , powerPoolIndex , powerType , current , max , effectiveMax )
if ( ( current ~= self . current or max ~= self . max or effectiveMax ~= self . effectiveMax ) and self : IsUnitTag ( unitTag ) ) then
end
end
end
if settingType == SETTING_TYPE_UI then
if settingId == UI_SETTING_FADE_PLAYER_BARS then
elseif settingId == UI_SETTING_ALWAYS_SHOW_STATUS_TEXT then
elseif settingId == UI_SETTING_RESOURCE_NUMBERS then
elseif settingId == UI_SETTING_SHOW_RESOURCE_BARS then
end
end
end
--Attribute Bar Group
-----------------------
local NUM_BARS = 3
local NORMAL_WIDTH = 237
local EXPANDED_WIDTH = 323
local SHRUNK_WIDTH = 141
local BAR_OFFSET_FROM_SCREEN_EDGE = 502
local MIN_BAR_AREA_WIDTH = ( EXPANDED_WIDTH + 15 ) * NUM_BARS
local MAX_BAR_AREA_WIDTH = 1600
local PLAYER_ATTRIBUTE_VISUALIZER_SOUNDS =
{
[ STAT_HEALTH_MAX ] =
{
[ ATTRIBUTE_BAR_STATE_NORMAL ] = SOUNDS . UAV_MAX_HEALTH_NORMAL ,
[ ATTRIBUTE_BAR_STATE_EXPANDED ] = SOUNDS . UAV_MAX_HEALTH_INCREASED ,
[ ATTRIBUTE_BAR_STATE_SHRUNK ] = SOUNDS . UAV_MAX_HEALTH_DECREASED ,
} ,
[ STAT_MAGICKA_MAX ] =
{
[ ATTRIBUTE_BAR_STATE_NORMAL ] = SOUNDS . UAV_MAX_MAGICKA_NORMAL ,
[ ATTRIBUTE_BAR_STATE_EXPANDED ] = SOUNDS . UAV_MAX_MAGICKA_INCREASED ,
[ ATTRIBUTE_BAR_STATE_SHRUNK ] = SOUNDS . UAV_MAX_MAGICKA_DECREASED ,
} ,
[ STAT_STAMINA_MAX ] =
{
[ ATTRIBUTE_BAR_STATE_NORMAL ] = SOUNDS . UAV_MAX_STAMINA_NORMAL ,
[ ATTRIBUTE_BAR_STATE_EXPANDED ] = SOUNDS . UAV_MAX_STAMINA_INCREASED ,
[ ATTRIBUTE_BAR_STATE_SHRUNK ] = SOUNDS . UAV_MAX_STAMINA_DECREASED ,
} ,
[ STAT_HEALTH_REGEN_COMBAT ] =
{
[ STAT_STATE_INCREASE_GAINED ] = SOUNDS . UAV_INCREASED_HEALTH_REGEN_ADDED ,
[ STAT_STATE_INCREASE_LOST ] = SOUNDS . UAV_INCREASED_HEALTH_REGEN_LOST ,
[ STAT_STATE_DECREASE_GAINED ] = SOUNDS . UAV_DECREASED_HEALTH_REGEN_ADDED ,
[ STAT_STATE_DECREASE_LOST ] = SOUNDS . UAV_DECREASED_HEALTH_REGEN_LOST ,
} ,
[ STAT_MAGICKA_REGEN_COMBAT ] =
{
[ STAT_STATE_INCREASE_GAINED ] = SOUNDS . UAV_INCREASED_MAGICKA_REGEN_ADDED ,
[ STAT_STATE_INCREASE_LOST ] = SOUNDS . UAV_INCREASED_MAGICKA_REGEN_LOST ,
[ STAT_STATE_DECREASE_GAINED ] = SOUNDS . UAV_DECREASED_MAGICKA_REGEN_ADDED ,
[ STAT_STATE_DECREASE_LOST ] = SOUNDS . UAV_DECREASED_MAGICKA_REGEN_LOST ,
} ,
[ STAT_STAMINA_REGEN_COMBAT ] =
{
[ STAT_STATE_INCREASE_GAINED ] = SOUNDS . UAV_INCREASED_STAMINA_REGEN_ADDED ,
[ STAT_STATE_INCREASE_LOST ] = SOUNDS . UAV_INCREASED_STAMINA_REGEN_LOST ,
[ STAT_STATE_DECREASE_GAINED ] = SOUNDS . UAV_DECREASED_STAMINA_REGEN_ADDED ,
[ STAT_STATE_DECREASE_LOST ] = SOUNDS . UAV_DECREASED_STAMINA_REGEN_LOST ,
} ,
[ STAT_ARMOR_RATING ] =
{
[ STAT_STATE_INCREASE_GAINED ] = SOUNDS . UAV_INCREASED_ARMOR_ADDED ,
[ STAT_STATE_INCREASE_LOST ] = SOUNDS . UAV_INCREASED_ARMOR_LOST ,
[ STAT_STATE_DECREASE_GAINED ] = SOUNDS . UAV_DECREASED_ARMOR_ADDED ,
[ STAT_STATE_DECREASE_LOST ] = SOUNDS . UAV_DECREASED_ARMOR_LOST ,
} ,
[ STAT_POWER ] =
{
[ STAT_STATE_INCREASE_GAINED ] = SOUNDS . UAV_INCREASED_POWER_ADDED ,
[ STAT_STATE_INCREASE_LOST ] = SOUNDS . UAV_INCREASED_POWER_LOST ,
[ STAT_STATE_DECREASE_GAINED ] = SOUNDS . UAV_DECREASED_POWER_ADDED ,
[ STAT_STATE_DECREASE_LOST ] = SOUNDS . UAV_DECREASED_POWER_LOST ,
} ,
[ STAT_MITIGATION ] =
{
[ STAT_STATE_IMMUNITY_GAINED ] = SOUNDS . UAV_IMMUNITY_ADDED ,
[ STAT_STATE_IMMUNITY_LOST ] = SOUNDS . UAV_IMMUNITY_LOST ,
[ STAT_STATE_SHIELD_GAINED ] = SOUNDS . UAV_DAMAGE_SHIELD_ADDED ,
[ STAT_STATE_SHIELD_LOST ] = SOUNDS . UAV_DAMAGE_SHIELD_LOST ,
[ STAT_STATE_POSSESSION_APPLIED ] = SOUNDS . UAV_POSSESSION_APPLIED ,
[ STAT_STATE_POSSESSION_REMOVED ] = SOUNDS . UAV_POSSESSION_REMOVED ,
[ STAT_STATE_TRAUMA_GAINED ] = SOUNDS . UAV_TRAUMA_ADDED ,
[ STAT_STATE_TRAUMA_LOST ] = SOUNDS . UAV_TRAUMA_LOST ,
} ,
}
barGroup . forceVisible = false
local bars = { }
local healthBarControls = { GetControl ( healthControl , "BarLeft" ) , GetControl ( healthControl , "BarRight" ) }
healthControl . barControls = healthBarControls
local healthAttributeBar = ZO_PlayerAttributeBar : New ( healthControl , healthBarControls , COMBAT_MECHANIC_FLAGS_HEALTH )
local siegeHealthBarControls = { GetControl ( siegeHealthControl , "BarLeft" ) , GetControl ( siegeHealthControl , "BarRight" ) }
siegeHealthControl . barControls = siegeHealthBarControls
local siegeHealthAttributeBar = ZO_PlayerAttributeBar : New ( siegeHealthControl , siegeHealthBarControls , COMBAT_MECHANIC_FLAGS_HEALTH , "controlledsiege" , "escortedram" )
end
siegeHealthAttributeBar : SetExternalVisibilityRequirement ( function ( ) return IsGameCameraSiegeControlled ( ) or IsPlayerEscortingRam ( ) end )
magickaControl . barControls = magickaBarControls
local magickaAttributeBar = ZO_PlayerAttributeBar : New ( magickaControl , magickaBarControls , COMBAT_MECHANIC_FLAGS_MAGICKA )
werewolfControl . barControls = werewolfBarControls
local werewolfAttributeBar = ZO_PlayerAttributeBar : New ( werewolfControl , werewolfBarControls , COMBAT_MECHANIC_FLAGS_WEREWOLF )
control : RegisterForEvent ( EVENT_WEREWOLF_STATE_CHANGED , function ( ) werewolfAttributeBar : UpdateContextualFading ( ) end )
staminaControl . barControls = staminaBarControls
local staminaAttributeBar = ZO_PlayerAttributeBar : New ( staminaControl , staminaBarControls , COMBAT_MECHANIC_FLAGS_STAMINA )
mountStaminaControl . barControls = mountStaminaBarControls
local mountStaminaAttributeBar = ZO_PlayerAttributeBar : New ( mountStaminaControl , mountStaminaBarControls , COMBAT_MECHANIC_FLAGS_MOUNT_STAMINA )
control : RegisterForEvent ( EVENT_MOUNTED_STATE_CHANGED , function ( ) mountStaminaAttributeBar : UpdateContextualFading ( ) end )
barGroup . bars = bars
if change > 0 then
else
end
end
barGroup . forceShow = false
barGroup . attributeVisualizer = ZO_UnitAttributeVisualizer : New ( "player" , PLAYER_ATTRIBUTE_VISUALIZER_SOUNDS , healthControl , magickaControl , staminaControl , OnExternalControlCountChanged )
barGroup . attributeVisualizer : AddModule ( ZO_UnitVisualizer_ShrinkExpandModule : New ( NORMAL_WIDTH , EXPANDED_WIDTH , SHRUNK_WIDTH ) )
local armorDamageLayoutInfo =
{
increasedArmorBgContainerTemplate = "ZO_IncreasedArmorBgContainerArrow" ,
increasedArmorFrameContainerTemplate = "ZO_IncreasedArmorFrameContainerArrow" ,
decreasedArmorOverlayContainerTemplate = "ZO_DecreasedArmorOverlayContainerArrow" ,
increasedPowerGlowTemplate = "ZO_IncreasedPowerGlowArrow" ,
increasedArmorOffsets =
{
shared =
{
top = - 9 ,
bottom = 9 ,
left = - 8 ,
right = 8 ,
} ,
}
}
local unwaveringLayoutInfo =
{
overlayContainerTemplate = "ZO_UnwaveringOverlayContainerArrow" ,
overlayOffsets =
{
keyboard =
{
top = 3 ,
bottom = - 3 ,
left = 3 ,
right = - 3 ,
} ,
gamepad =
{
top = 3 ,
bottom = - 2 ,
left = 4 ,
right = - 4 ,
} ,
}
}
barGroup . attributeVisualizer : AddModule ( ZO_UnitVisualizer_UnwaveringModule : New ( unwaveringLayoutInfo ) )
local possessionLayoutInfo =
{
overlayContainerTemplate = "ZO_PossessionOverlayContainerArrow" ,
overlayLeftOffset = 3 ,
overlayTopOffset = 3 ,
overlayRightOffset = - 3 ,
overlayBottomOffset = - 3 ,
possessionHaloGlowTemplate = "ZO_PossessionHaloGlowArrow" ,
}
barGroup . attributeVisualizer : AddModule ( ZO_UnitVisualizer_PossessionModule : New ( possessionLayoutInfo ) )
local powerShieldLayoutInfo =
{
barLeftOverlayTemplate = "ZO_PowerShieldBarLeftOverlayArrow" ,
barRightOverlayTemplate = "ZO_PowerShieldBarRightOverlayArrow" ,
}
barGroup . attributeVisualizer : AddModule ( ZO_UnitVisualizer_PowerShieldModule : New ( powerShieldLayoutInfo ) )
control : RegisterForEvent ( EVENT_GAMEPAD_PREFERRED_MODE_CHANGED , function ( ) barGroup : OnGamepadPreferredModeChanged ( ) end )
return barGroup
end
local CHILD_DIRECTIONS = { "Left" , "Right" , "Center" }
local powerTypeTemplates = PAB_TEMPLATES [ bar . powerType ]
local backgroundTemplates = powerTypeTemplates . background
local frameTemplates = powerTypeTemplates . frame
if warnerControl then
local warnerTemplates = powerTypeTemplates . warner
end
local anchorTemplates = powerTypeTemplates . anchors
if anchorTemplates then
else
end
end
else
local anchorTemplates = powerTypeTemplates . smallAnchors
if anchorTemplates then
end
end
end
if resourceNumbersLabel then
ApplyTemplateToControl ( resourceNumbersLabel , ZO_GetPlatformTemplate ( PAB_TEMPLATES . resourceNumbersLabel ) )
end
end
end
end
if forceShow then
else
end
end
end
end
local barAreaWidth = screenWidth - BAR_OFFSET_FROM_SCREEN_EDGE * 2
end
--Events
end
--XML
end |