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 |
local COUNTDOWN_TIMER_START_MS = 5000
local ROUND_CSA_START_MS = 15000
local COUNTDOWN_TIMER_END_BATTLEGROUND_MS = ZO_ONE_MINUTE_IN_MILLISECONDS
--------------------
--Battleground HUD Fragment
--------------------
end
control : RegisterForEvent ( EVENT_BATTLEGROUND_RULESET_CHANGED , function ( ) self : OnBattlegroundRulesetChanged ( ) end )
end
do
local KEYBOARD_STYLE =
{
hudTemplate = "ZO_BattlegroundHudTopLevel_Keyboard" ,
keybindButtonTemplate = "ZO_KeybindButton_Keyboard_Template" ,
}
local GAMEPAD_STYLE =
{
hudTemplate = "ZO_BattlegroundHudTopLevel_Gamepad" ,
keybindButtonTemplate = "ZO_KeybindButton_Gamepad_Template" ,
}
self . platformStyle = ZO_PlatformStyle : New ( function ( style ) self : ApplyPlatformStyle ( style ) end , KEYBOARD_STYLE , GAMEPAD_STYLE )
end
end
if battlegroundType ~= BATTLEGROUND_GAME_TYPE_NONE then
else
end
end
end
end
if currentBattlegroundId ~= 0 then
else
end
end
return ZO_FormatTime ( zo_ceil ( self . currentBattlegroundTimeMS / 1000 ) , TIME_FORMAT_STYLE_COLONS , TIME_FORMAT_PRECISION_SECONDS , TIME_FORMAT_DIRECTION_DESCENDING )
end
do
local PRE_SHUTDOWN_WARNING_TIME_MS = 10000
local previousBattlegroundState = 0
if battlegroundState == BATTLEGROUND_STATE_PREROUND then
text = ZO_NORMAL_TEXT : Colorize ( zo_strformat ( SI_BATTLEGROUND_STATE_PREGAME , ZO_SELECTED_TEXT : Colorize ( self : GetFormattedTimer ( ) ) ) )
if previousShutdownTimerMS >= PRE_SHUTDOWN_WARNING_TIME_MS and self . shutdownTimerMS < PRE_SHUTDOWN_WARNING_TIME_MS then
local shutdownImminentMessage = zo_strformat ( SI_BATTLEGROUND_SHUTDOWN_IMMINENT , PRE_SHUTDOWN_WARNING_TIME_S )
end
end
elseif battlegroundState == BATTLEGROUND_STATE_STARTING then
text = self : GetRoundAndTimeText ( SI_BATTLEGROUND_STATE_STARTING_ROUND , SI_BATTLEGROUND_STATE_STARTING_MATCH , currentRound , numRounds , self : GetFormattedTimer ( ) )
if DoesBattlegroundHaveRounds ( battlegroundId ) and self . currentBattlegroundTimeMS <= ROUND_CSA_START_MS then
if previousBattlegroundTimeMS > ROUND_CSA_START_MS then
--Check if this is the final round
if currentRound == numRounds then
local isTied = true
local previousRoundsWon
--Determine if the teams are tied
for i = 1 , numTeams do
if previousRoundsWon and previousRoundsWon ~= roundsWon then
isTied = false
break
end
previousRoundsWon = roundsWon
end
if isTied then
messageParams : SetText ( GetString ( SI_BATTLEGROUND_ROUND_CSA_FINAL_ROUND ) , GetString ( SI_BATTLEGROUND_ROUND_CSA_TIEBREAKER ) )
else
messageParams : SetText ( GetString ( SI_BATTLEGROUND_ROUND_CSA_FINAL_ROUND ) , zo_strformat ( SI_BATTLEGROUND_ROUND_CSA_TOTAL_ROUNDS , numRounds ) )
end
else
messageParams : SetText ( zo_strformat ( SI_BATTLEGROUND_ROUND_CSA_CURRENT_ROUND , currentRound ) , zo_strformat ( SI_BATTLEGROUND_ROUND_CSA_TOTAL_ROUNDS , numRounds ) )
end
end
end
if previousBattlegroundTimeMS > COUNTDOWN_TIMER_START_MS then
local messageParams = CENTER_SCREEN_ANNOUNCE : CreateMessageParams ( CSA_CATEGORY_COUNTDOWN_TEXT , SOUNDS . BATTLEGROUND_COUNTDOWN_FINISH )
messageParams : SetIconData ( ZO_GetCountdownBattlegroundTeamSymbolIcon ( GetUnitBattlegroundTeam ( "player" ) ) )
end
end
end
elseif battlegroundState == BATTLEGROUND_STATE_RUNNING then
text = self : GetRoundAndTimeText ( SI_BATTLEGROUND_STATE_RUNNING_ROUND , SI_BATTLEGROUND_STATE_RUNNING_MATCH , GetCurrentBattlegroundRoundIndex ( ) , GetBattlegroundNumRounds ( battlegroundId ) , self : GetFormattedTimer ( ) )
if self . currentBattlegroundTimeMS <= COUNTDOWN_TIMER_END_BATTLEGROUND_MS and previousBattlegroundTimeMS > COUNTDOWN_TIMER_END_BATTLEGROUND_MS then
local messageParams = CENTER_SCREEN_ANNOUNCE : CreateMessageParams ( CSA_CATEGORY_MAJOR_TEXT , SOUNDS . BATTLEGROUND_ONE_MINUTE_WARNING )
end
end
if previousShutdownTimerMS >= PRE_SHUTDOWN_WARNING_TIME_MS and self . shutdownTimerMS < PRE_SHUTDOWN_WARNING_TIME_MS then
local shutdownImminentMessage = zo_strformat ( SI_BATTLEGROUND_SHUTDOWN_IMMINENT , PRE_SHUTDOWN_WARNING_TIME_S )
end
end
elseif battlegroundState == BATTLEGROUND_STATE_POSTROUND then
if previousBattlegroundState ~= battlegroundState then
end
end
elseif battlegroundState == BATTLEGROUND_STATE_FINISHED then
end
end
else
end
previousBattlegroundState = battlegroundState
end
end
-- textForRounds: (string) Text for a match with multiple rounds. "Round One: 3:57"
-- textForMatch: (string) Text for a match with only one round. "Match: 3:57"
-- currentRound: (number) Round number to display, if multiple rounds.
-- numRounds: (number) Number of rounds. We display round match text when this is > 1.
-- timerText: (string) Current timer.
function BattlegroundHUDFragment : GetRoundAndTimeText ( textForRounds , textForMatch , currentRound , numRounds , timerText )
if numRounds > 1 then
text = ZO_NORMAL_TEXT : Colorize ( zo_strformat ( textForRounds , currentRound , ZO_SELECTED_TEXT : Colorize ( timerText ) ) )
else
end
end
end
--[[ xml functions ]] --
end |