|
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 |
return reticleenddo 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) 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) endendendendend-- Used for tutorials that are only shown after hovering on an appropriate target for a certain amount of time-- Currently used by STOLEN_ITEM_TARGETED, OWNED_LOCK_VIEWED, and LIVESTOCK_TARGETEDlocal TUTORIAL_HOVER_TIME_SECONDS = 0.75 if tutorialTrigger ~= TUTORIAL_TRIGGER_NONE then -- We've reticled over something, from nothing end else if tutorialTrigger == TUTORIAL_TRIGGER_NONE then -- We've reticled over nothing, from something else -- We've reticled over something, from something else end end end if self.delayedTutorialTimestampSeconds and self.delayedTutorialTrigger and currentFrameTimeSeconds - self.delayedTutorialTimestampSeconds >= TUTORIAL_HOVER_TIME_SECONDS then endendfunction 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 endend if interactionPossible then local action, interactableName, interactionBlocked, isOwned, additionalInteractInfo, context, contextLink, isCriminalInteract = GetGameCameraInteractableActionInfo() local interactKeybindButtonColor = ZO_NORMAL_TEXT local additionalInfoLabelColor = ZO_CONTRAST_TEXT if isOwned or isCriminalInteract then interactKeybindButtonColor = ZO_ERROR_COLOR end if additionalInteractInfo == ADDITIONAL_INTERACT_INFO_NONE or additionalInteractInfo == ADDITIONAL_INTERACT_INFO_INSTANCE_TYPE or additionalInteractInfo == ADDITIONAL_INTERACT_INFO_HOUSE_BANK or additionalInteractInfo == ADDITIONAL_INTERACT_INFO_HOUSE_INSTANCE_DOOR then 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 self.interactKeybindButton:SetText(zo_strformat(SI_GAME_CAMERA_TARGET_ADDITIONAL_INFO, action, GetString("SI_LOCKQUALITY", context))) additionalInfoLabelColor = ZO_SUCCEEDED_TEXT local INHERIT_COLOR = true self.additionalInfo:SetText(zo_iconTextFormat("EsoUI/Art/TreeIcons/gamepad/GP_collection_indexIcon_Companions.dds", iconSize, iconSize, GetLockpickingCompanionBonusName(), INHERIT_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 end else end elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_WEREWOLF_ACTIVE_WHILE_ATTEMPTING_TO_CRAFT then elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_WEREWOLF_ACTIVE_WHILE_ATTEMPTING_TO_EXCAVATE then elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_IN_HIDEYHOLE then end local interactContextString = interactableName if additionalInteractInfo == ADDITIONAL_INTERACT_INFO_INSTANCE_TYPE then local zoneDisplayType = context if zoneDisplayType ~= ZONE_DISPLAY_TYPE_NONE then local zoneDisplayTypeString = zo_iconTextFormat(ZO_GetZoneDisplayTypeIcon(zoneDisplayType), 34, 34, GetString("SI_ZONEDISPLAYTYPE", zoneDisplayType)) if zoneDisplayType == ZONE_DISPLAY_TYPE_ENDLESS_DUNGEON then -- Hacky stop gap solution to the Zone and the feature having the same name -- Design asked us to suppress the zone name and let the zone display type do the work interactContextString = zoneDisplayTypeString else interactContextString = zo_strformat(SI_ZONE_DOOR_RETICLE_INSTANCE_TYPE_FORMAT, interactableName, zoneDisplayTypeString) end end elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_HOUSE_BANK then --Don't attempt to add the collectible nickname to the prompt if it isn't our house bank local bankBag = context if collectibleId ~= 0 then if collectibleData then if nickname ~= "" then interactContextString = zo_strformat(SI_RETICLE_HOUSE_BANK_WITH_NICKNAME_FORMAT, interactableName, nickname) end end end end elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_HOUSE_INSTANCE_DOOR then local zoneDisplayType = ZONE_DISPLAY_TYPE_HOUSING local zoneDisplayTypeString = zo_iconTextFormat(ZO_GetZoneDisplayTypeIcon(zoneDisplayType), 34, 34, GetString("SI_ZONEDISPLAYTYPE", zoneDisplayType)) if collectibleData then --Theoretically it should be impossible for the nickname to be blank, but guard against it just in case if nickname ~= "" then interactContextString = zo_strformat(SI_HOUSE_DOOR_RETICLE_INSTANCE_TYPE_FORMAT, interactableName, nickname, zoneDisplayTypeString) else interactContextString = zo_strformat(SI_ZONE_DOOR_RETICLE_INSTANCE_TYPE_FORMAT, interactableName, zoneDisplayTypeString) end end end return true end endend return true end return falseend if nonInteractableName then return true end return falseend --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 -- 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()) endend if interactionPossible or PLAYER_TO_PLAYER:HasTarget() or IsGameCameraUnitHighlightedAttackable() then else endendendend local inStealthOrDisguise = GetUnitDisguiseState("player") ~= DISGUISE_STATE_NONE or GetUnitStealthState("player") ~= STEALTH_STATE_NONE if not inStealthOrDisguise then endendend local animatedChance = zo_floor((self.percentChance - (self.oldPercentChance or 0)) * progress) + (self.oldPercentChance or 0)endendend--------------------------------- Stealth icon-------------------------------local STEALTH_ANIMATION_FRAMES = 64local STEALTH_ANIMATION_DEFAULT_DURATION = 500local STEALTH_ANIMATION_START = 0local STEALTH_ANIMATION_MID = 1local STEALTH_ANIMATION_END = 2local 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 stealthIconenddo local STEALTH_KEYBOARD_STYLE = { font = "ZoInteractionPrompt", } local STEALTH_GAMEPAD_STYLE = { font = "ZoFontGamepad36", } end { [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, } { [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.stealthTextTimeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("StealthIconStealthTextFadeAnimation", self.stealthText) ZO_PlatformStyle:New(function(style) self:ApplyPlatformStyle(style) end, STEALTH_KEYBOARD_STYLE, STEALTH_GAMEPAD_STYLE) endend---- Animations and updates-- if stringId then end endendend if animPoint == STEALTH_ANIMATION_START then elseif animPoint == STEALTH_ANIMATION_MID then elseif animPoint == STEALTH_ANIMATION_END then endend 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 endend-- -- Event Handlers-- -- Update the text else end -- Then update the eye else endendendend |