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 |
return reticle
end
do
local RETICLE_KEYBOARD_STYLE =
{
font = "ZoInteractionPrompt" ,
keybindButtonStyle = KEYBIND_STRIP_STANDARD_STYLE ,
}
local RETICLE_GAMEPAD_STYLE =
{
font = "ZoFontGamepad42" ,
keybindButtonStyle = KEYBIND_STRIP_GAMEPAD_STYLE ,
}
end
self . reticleOpenCloseTimeline = ANIMATION_MANAGER : CreateTimelineFromVirtual ( "ReticleOpenCloseAnimation" , self . reticleTexture )
self . hitIndicatorTimeline = ANIMATION_MANAGER : CreateTimelineFromVirtual ( "ReticleHitIndicatorAnimation" , self . reticleTexture )
self . bonusScrollTimeline = ANIMATION_MANAGER : CreateTimelineFromVirtual ( "PickpocketBonusScrollAnimation" , self . additionalInfo )
self . control : RegisterForEvent ( EVENT_RETICLE_HIDDEN_UPDATE , function ( event , ... ) self : UpdateHiddenState ( ... ) end )
self . control : RegisterForEvent ( EVENT_STEALTH_STATE_CHANGED , function ( event , unitTag , ... ) if unitTag == "player" then self : OnStealthStateChanged ( ... ) end end )
self . control : RegisterForEvent ( EVENT_DISGUISE_STATE_CHANGED , function ( event , unitTag , ... ) if unitTag == "player" then self : OnDisguiseStateChanged ( ... ) end end )
self . control : RegisterForEvent ( EVENT_PLAYER_ACTIVATED , function ( event , ... ) self : SetupReticle ( ... ) end )
self . control : RegisterForEvent ( EVENT_IMPACTFUL_HIT , function ( event , ... ) self : OnImpactfulHit ( ... ) end )
self . control : RegisterForEvent ( EVENT_NO_INTERACT_TARGET , function ( event , ... ) PlaySound ( SOUNDS . NO_INTERACT_TARGET ) end )
self . control : RegisterForEvent ( EVENT_RETICLE_TARGET_CHANGED , function ( event , ... ) self : OnReticleTargetChanged ( ... ) end )
local hideUnbound = false
self . interactKeybindButton : SetKeybind ( "GAME_CAMERA_INTERACT" , hideUnbound , "GAMEPAD_JUMP_OR_INTERACT" )
self . control : SetHandler ( "OnUpdate" , function ( control , currentFrameTimeSeconds ) self : OnUpdate ( currentFrameTimeSeconds ) end )
end
ZO_PlatformStyle : New ( function ( style ) self : ApplyPlatformStyle ( style ) end , RETICLE_KEYBOARD_STYLE , RETICLE_GAMEPAD_STYLE )
end
end
end
end
end
end
local STEALING_TUTORIAL_SHOWN_AFTER_SECONDS = 1.5
self . stealingItemTimestampSeconds = nil
end
if self . stealingItemTimestampSeconds == nil then
self . stealingItemTimestampSeconds = currentFrameTimeSeconds
elseif currentFrameTimeSeconds - self . stealingItemTimestampSeconds >= STEALING_TUTORIAL_SHOWN_AFTER_SECONDS then
self . stealingItemTimestampSeconds = nil
end
end
function ZO_Reticle : TryHandlingQuestInteraction ( questInteraction , questTargetBased , questJournalIndex , questToolIndex , questToolOnCooldown )
if questInteraction then
if not questInteraction or questTargetBased then
else
end
if not questToolOnCooldown then
end
return true
end
end
if interactionPossible then
local action , interactableName , interactionBlocked , isOwned , additionalInteractInfo , context , contextLink , isCriminalInteract = GetGameCameraInteractableActionInfo ( )
local interactKeybindButtonColor = ZO_NORMAL_TEXT
local additionalInfoLabelColor = ZO_CONTRAST_TEXT
local isOwnedOrCriminalInteract = isOwned or isCriminalInteract
if additionalInteractInfo == ADDITIONAL_INTERACT_INFO_NONE or additionalInteractInfo == ADDITIONAL_INTERACT_INFO_INSTANCE_TYPE then
local isStealingPossible = false
if ( isOwnedOrCriminalInteract ) then
interactKeybindButtonColor = ZO_ERROR_COLOR
if isOwned and additionalInteractInfo == ADDITIONAL_INTERACT_INFO_NONE then
-- Assuming that the only INSTANCE_TYPE owned interactables are doors and that everything else is pilferable...
isStealingPossible = true
end
end
if not isStealingPossible then
end
elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_EMPTY then
self . interactKeybindButton : SetText ( zo_strformat ( SI_FORMAT_BULLET_TEXT , GetString ( SI_GAME_CAMERA_ACTION_EMPTY ) ) )
elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_LOCKED then
local lockQuality = context
self . interactKeybindButton : SetText ( zo_strformat ( SI_GAME_CAMERA_TARGET_ADDITIONAL_INFO , action , GetString ( "SI_LOCKQUALITY" , lockQuality ) ) )
if ( isOwnedOrCriminalInteract ) then
interactKeybindButtonColor = ZO_ERROR_COLOR
end
elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_FISHING_NODE then
if lure then
self . interactKeybindButton : SetText ( zo_strformat ( SI_GAME_CAMERA_TARGET_ADDITIONAL_INFO_BAIT , action , name ) )
else
self . interactKeybindButton : SetText ( zo_strformat ( SI_GAME_CAMERA_TARGET_ADDITIONAL_INFO , action , GetString ( SI_NO_BAIT_OR_LURE_SELECTED ) ) )
end
elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_REQUIRES_KEY then
if interactionBlocked == true then
self . interactKeybindButton : SetText ( zo_strformat ( SI_GAME_CAMERA_TARGET_ADDITIONAL_INFO_REQUIRES_KEY , action , itemName ) )
else
self . interactKeybindButton : SetText ( zo_strformat ( SI_GAME_CAMERA_TARGET_ADDITIONAL_INFO_WILL_CONSUME_KEY , action , itemName ) )
end
elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_PICKPOCKET_CHANCE then
local isHostile , difficulty , isEmpty , prospectiveResult , monsterSocialClassString , monsterSocialClass
self . isInBonus , isHostile , self . percentChance , difficulty , isEmpty , prospectiveResult , monsterSocialClassString , monsterSocialClass = GetGameCameraPickpocketingBonusInfo ( )
-- Prevent your success chance from going over 100%
local additionalInfoText
if ( isEmpty and prospectiveResult == PROSPECTIVE_PICKPOCKET_RESULT_INVENTORY_FULL ) then
elseif prospectiveResult ~= PROSPECTIVE_PICKPOCKET_RESULT_CAN_ATTEMPT then
else
additionalInfoText = isEmpty and GetString ( SI_JUSTICE_PICKPOCKET_TARGET_EMPTY ) or monsterSocialClassString
end
self . interactKeybindButton : SetText ( zo_strformat ( SI_GAME_CAMERA_TARGET_ADDITIONAL_INFO , action , additionalInfoText ) )
interactKeybindButtonColor = ( ( not isHostile ) and ZO_ERROR_COLOR or ZO_NORMAL_TEXT )
if not interactionBlocked then
additionalInfoLabelColor = ( self . isInBonus and ZO_SUCCEEDED_TEXT or ZO_CONTRAST_TEXT )
if ( self . isInBonus and not self . wasInBonus ) then
self . wasInBonus = true
elseif ( not self . isInBonus and self . wasInBonus ) then
self . wasInBonus = false
self . oldPercentChance = self . percentChance
end
else
end
elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_WEREWOLF_ACTIVE_WHILE_ATTEMPTING_TO_CRAFT then
elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_IN_HIDEYHOLE then
end
local interactContextString = interactableName ;
if ( additionalInteractInfo == ADDITIONAL_INTERACT_INFO_INSTANCE_TYPE ) then
local instanceType = context
if instanceType ~= INSTANCE_DISPLAY_TYPE_NONE then
local instanceTypeString = zo_iconTextFormat ( GetInstanceDisplayTypeIcon ( instanceType ) , 34 , 34 , GetString ( "SI_INSTANCEDISPLAYTYPE" , instanceType ) )
interactContextString = zo_strformat ( SI_ZONE_DOOR_RETICLE_INSTANCE_TYPE_FORMAT , interactableName , instanceTypeString )
end
end
self . interactionBlocked = interactionBlocked
return true
end
end
end
return true
end
return false
end
if nonInteractableName then
return true
end
return false
end
--Priority is
--1. Ground targeting
--2. Target based quest item
--3. Unit interaction
--4. Non-target based quest item
--5. Non-interactable fixtures, such as signs
self . interactionBlocked = false
-- The loot window does some fancy stuff with this text...wait until it is gone to show it again
if interactionType == INTERACTION_LOOT then
return
end
end
else
local interactionExists , interactionAvailableNow , questInteraction , questTargetBased , questJournalIndex , questToolIndex , questToolOnCooldown = GetGameCameraInteractableInfo ( )
if questTargetBased and self : TryHandlingQuestInteraction ( questInteraction , questTargetBased , questJournalIndex , questToolIndex , questToolOnCooldown ) then
elseif self : TryHandlingQuestInteraction ( questInteraction , questTargetBased , questJournalIndex , questToolIndex , questToolOnCooldown ) then
end
end
local showBusy = interactionType ~= INTERACTION_NONE and interactionType ~= INTERACTION_FISH and interactionType ~= INTERACTION_PICKPOCKET and interactionType ~= INTERACTION_HIDEYHOLE or ( IsInGamepadPreferredMode ( ) and IsBlockActive ( ) )
end
end
if interactionPossible or PLAYER_TO_PLAYER : HasTarget ( ) or IsGameCameraUnitHighlightedAttackable ( ) then
else
end
end
self . reticleHiddenExternalRequest = hidden
end
end
local inStealthOrDisguise = GetUnitDisguiseState ( "player" ) ~= DISGUISE_STATE_NONE or GetUnitStealthState ( "player" ) ~= STEALTH_STATE_NONE
if not inStealthOrDisguise then
end
end
end
local animatedChance = zo_floor ( ( self . percentChance - ( self . oldPercentChance or 0 ) ) * progress ) + ( self . oldPercentChance or 0 )
end
end
end
-------------------------------
-- Stealth icon
-------------------------------
local STEALTH_ANIMATION_FRAMES = 64
local STEALTH_ANIMATION_DEFAULT_DURATION = 500
local STEALTH_ANIMATION_START = 0
local STEALTH_ANIMATION_MID = 1
local STEALTH_ANIMATION_END = 2
local DisguiseToStealthState =
{
[ DISGUISE_STATE_DISGUISED ] = STEALTH_STATE_STEALTH ,
[ DISGUISE_STATE_DANGER ] = STEALTH_STATE_STEALTH_ALMOST_DETECTED ,
[ DISGUISE_STATE_SUSPICIOUS ] = STEALTH_STATE_STEALTH_ALMOST_DETECTED ,
[ DISGUISE_STATE_DISCOVERED ] = STEALTH_STATE_DETECTED ,
}
--
-- Lifecycle
--
return stealthIcon
end
do
local STEALTH_KEYBOARD_STYLE =
{
font = "ZoInteractionPrompt" ,
}
local STEALTH_GAMEPAD_STYLE =
{
font = "ZoFontGamepad36" ,
}
end
self . hiddenStates =
{
[ STEALTH_STATE_HIDDEN ] = true ,
[ STEALTH_STATE_STEALTH ] = true ,
[ STEALTH_STATE_HIDDEN_ALMOST_DETECTED ] = true ,
[ STEALTH_STATE_STEALTH_ALMOST_DETECTED ] = true ,
[ STEALTH_STATE_NONE ] = false ,
[ STEALTH_STATE_DETECTED ] = false ,
}
self . stealthSounds =
{
[ STEALTH_STATE_HIDDEN ] = SOUNDS . STEALTH_HIDDEN ,
[ STEALTH_STATE_STEALTH ] = SOUNDS . STEALTH_HIDDEN ,
[ STEALTH_STATE_DETECTED ] = SOUNDS . STEALTH_DETECTED ,
}
self . stealthEyeTimeline = ANIMATION_MANAGER : CreateTimelineFromVirtual ( "StealthIconStealthEyeAnimation" , self . stealthEyeTexture )
self . currentStealthState = STEALTH_STATE_NONE
self . nextStealthState = STEALTH_STATE_NONE
self . disguiseState = DISGUISE_STATE_NONE
self . stealthTextTimeline = ANIMATION_MANAGER : CreateTimelineFromVirtual ( "StealthIconStealthTextFadeAnimation" , self . stealthText )
ZO_PlatformStyle : New ( function ( style ) self : ApplyPlatformStyle ( style ) end , STEALTH_KEYBOARD_STYLE , STEALTH_GAMEPAD_STYLE )
end
end
--
-- Animations and updates
--
if stringId then
if not self . stealthTextStringId or not stringId == self . stealthTextStringId then
end
end
self . stealthTextStringId = stringId
end
self . stealthTextStringId = nil
end
if animPoint == STEALTH_ANIMATION_START then
elseif animPoint == STEALTH_ANIMATION_MID then
elseif animPoint == STEALTH_ANIMATION_END then
end
end
if stealthState == STEALTH_STATE_STEALTH or stealthState == STEALTH_STATE_HIDDEN then
if self . currentStealthState == STEALTH_STATE_STEALTH_ALMOST_DETECTED or self . currentStealthState == STEALTH_STATE_HIDDEN_ALMOST_DETECTED then
self . stealthEyeTimeline : InsertCallback ( function ( timeline ) timeline : Stop ( ) ; timeline : ClearAllCallbacks ( ) end , STEALTH_ANIMATION_DEFAULT_DURATION )
else
end
elseif stealthState == STEALTH_STATE_DETECTED then
if self . currentStealthState == STEALTH_STATE_STEALTH_ALMOST_DETECTED or self . currentStealthState == STEALTH_STATE_HIDDEN_ALMOST_DETECTED then
elseif self . currentStealthState == STEALTH_STATE_STEALTH or self . currentStealthState == STEALTH_STATE_HIDDEN then
else
end
elseif stealthState == STEALTH_STATE_HIDING then
elseif stealthState == STEALTH_STATE_STEALTH_ALMOST_DETECTED or stealthState == STEALTH_STATE_HIDDEN_ALMOST_DETECTED then
if self . currentStealthState == STEALTH_STATE_STEALTH or self . currentStealthState == STEALTH_STATE_HIDDEN then
self . stealthEyeTimeline : InsertCallback ( function ( timeline ) timeline : Stop ( ) timeline : ClearAllCallbacks ( ) end , STEALTH_ANIMATION_DEFAULT_DURATION * . 5 )
else
if stealthState == STEALTH_STATE_HIDDEN_ALMOST_DETECTED then
end
end
end
self . currentStealthState = stealthState
end
--
-- Event Handlers
--
-- Update the text
if self . disguiseState == DISGUISE_STATE_DISGUISED then
elseif self . disguiseState == DISGUISE_STATE_DANGER then
elseif self . disguiseState == DISGUISE_STATE_SUSPICIOUS then
elseif self . disguiseState == DISGUISE_STATE_DISCOVERED then
elseif self . hiddenStates [ self . nextStealthState ] then
elseif self . nextStealthState == STEALTH_STATE_DETECTED then
else
end
-- Then update the eye
if DisguiseToStealthState [ self . disguiseState ] then
else
end
end
self . nextStealthState = stealthState
end
self . disguiseState = disguiseState
end |