ESO Lua File v100011

ingame/reticle/reticle.lua

[◄ back to folders ]
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
ZO_Reticle = ZO_Object:Subclass()
function ZO_Reticle:New(...)
    local reticle = ZO_Object.New(self)
    reticle:Initialize(...)
    
    return reticle
end
function ZO_Reticle:Initialize(control)
    self.control = control
    self.interact = control:GetNamedChild("Interact")
    self.interactKeybindButton = self.interact:GetNamedChild("KeybindButton")
    self.interactContext = self.interact:GetNamedChild("Context")
    self.additionalInfo = self.interact:GetNamedChild("AdditionalInfo")
    self.nonInteract = control:GetNamedChild("NonInteract")
    self.nonInteractText = self.nonInteract:GetNamedChild("Text")
    self.reticleTexture = control:GetNamedChild("Reticle")
    self.padlockOverlayTexture = control:GetNamedChild("PadlockOverlay")
    self.stealthIcon = ZO_StealthIcon:New(control:GetNamedChild("StealthIcon"))
    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() self:OnUpdate() end)
    if IsPlayerActivated() then
        self:SetupReticle()
    end
end
function ZO_Reticle:SetupReticle()
end
function ZO_Reticle:OnStealthStateChanged(newState)
    self.stealthIcon:OnStealthStateChanged(newState)
end
function ZO_Reticle:OnDisguiseStateChanged(newState)
    self.stealthIcon:OnDisguiseStateChanged(newState)
end
function ZO_Reticle:TryHandlingQuestInteraction(questInteraction, questTargetBased, questJournalIndex, questToolIndex, questToolOnCooldown)
    if questInteraction then
        local questToolName = select(4, GetQuestToolInfo(questJournalIndex, questToolIndex))
        self.interactKeybindButton:SetText(zo_strformat(SI_GAME_CAMERA_ACTION_QUEST_ITEM, questToolName))
        if not questInteraction or questTargetBased then
            self.interactContext:SetText(GetNameOfGameCameraQuestToolTarget())
        else
            self.interactContext:SetText("")
        end
        self.interactKeybindButton:SetEnabled(not questToolOnCooldown)
        return true
    end
end
function ZO_Reticle:TryHandlingInteraction(interactionPossible)
    if interactionPossible then
        local action, interactableName, interactionBlocked, isOwned, additionalInteractInfo, context, contextLink = GetGameCameraInteractableActionInfo()
        local interactKeybindButtonColor = ZO_NORMAL_TEXT
        local additionalInfoLabelColor = ZO_CONTRAST_TEXT
        self.interactKeybindButton:ShowKeyIcon()
        if action and interactableName then
            if additionalInteractInfo == ADDITIONAL_INTERACT_INFO_NONE or additionalInteractInfo == ADDITIONAL_INTERACT_INFO_INSTANCE_TYPE then
                self.interactKeybindButton:SetText(zo_strformat(SI_GAME_CAMERA_TARGET, action))
                if (isOwned) then 
                    interactKeybindButtonColor = ZO_ERROR_COLOR
                end
            elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_EMPTY then
                self.interactKeybindButton:SetText(zo_strformat(SI_FORMAT_BULLET_TEXT, GetString(SI_GAME_CAMERA_ACTION_EMPTY)))
                self.interactKeybindButton:HideKeyIcon()
            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 (isOwned) then 
                    TriggerTutorial(TUTORIAL_TRIGGER_OWNED_LOCK_VIEWED)
                    interactKeybindButtonColor = ZO_ERROR_COLOR
                end
            elseif additionalInteractInfo == ADDITIONAL_INTERACT_INFO_FISHING_NODE then
                self.additionalInfo:SetHidden(false)
                self.additionalInfo:SetText(GetString(SI_HOLD_TO_SELECT_BAIT))
                local lure = GetFishingLure()
                if lure then
                    local name = GetFishingLureInfo(lure)
                    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
                local itemName = GetItemLinkName(contextLink)
                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
                    self.isInBonus, isHostile, self.percentChance, difficulty, isEmpty, prospectiveResult = GetGameCameraPickpocketingBonusInfo()
                -- Prevent your success chance from going over 100%
                self.percentChance = zo_min(self.percentChance, 100)
                local additionalInfoText
                if prospectiveResult ~= PROSPECTIVE_PICKPOCKET_RESULT_CAN_ATTEMPT then
                    additionalInfoText = GetString("SI_PROSPECTIVEPICKPOCKETRESULT", prospectiveResult)
                else
                    additionalInfoText = (isEmpty and GetString(SI_JUSTICE_PICKPOCKET_TARGET_EMPTY) or GetString("SI_PICKPOCKETDIFFICULTYTYPE", difficulty))
                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
                    TriggerTutorial(TUTORIAL_TRIGGER_PICKPOCKET_PROMPT_VIEWED)
                    self.additionalInfo:SetHidden(false)
                    additionalInfoLabelColor = (self.isInBonus and ZO_SUCCEEDED_TEXT or ZO_CONTRAST_TEXT)
                    if(self.isInBonus and not self.wasInBonus) then
                        self.bonusScrollTimeline:PlayForward()
                        PlaySound(SOUNDS.JUSTICE_PICKPOCKET_BONUS)
                        self.wasInBonus = true
                    elseif(not self.isInBonus and self.wasInBonus) then
                        self.bonusScrollTimeline:PlayBackward()
                        self.wasInBonus = false
                    elseif(not self.bonusScrollTimeline:IsPlaying()) then
                        self.additionalInfo:SetText(zo_strformat(SI_PICKPOCKET_SUCCESS_CHANCE, self.percentChance))
                        self.oldPercentChance = self.percentChance
                    end
                else
                    self.additionalInfo:SetHidden(true)
                end
            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.interactContext:SetText(interactContextString)
            self.interactionBlocked = interactionBlocked
            self.interactKeybindButton:SetNormalTextColor(interactKeybindButtonColor)
            self.additionalInfo:SetColor(additionalInfoLabelColor:UnpackRGBA())  
            return true
        end
    end
end
function ZO_Reticle:TryHandlingGroundTargetingError()
    local error = GetGroundTargetingError()
    if error then
        self.nonInteractText:SetText(zo_strformat(GetString("SI_ACTIONRESULT", error)))
        return true
    end
    return false
end
function ZO_Reticle:TryHandlingNonInteractableFixture()
    local nonInteractableName = GetGameCameraNonInteractableName()
    if nonInteractableName then
        self.nonInteractText:SetText(zo_strformat(SI_TOOLTIP_FIXTURE_INSTANCE, nonInteractableName))
        return true
    end
    return false
end
function ZO_Reticle:UpdateInteractText()
    self.additionalInfo:SetHidden(true)
    if IsGameCameraActive() and not IsGameCameraUIModeActive() then
        --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.interact:SetHidden(true)
        self.nonInteract:SetHidden(true)
        self.interactionBlocked = false
        self.interactKeybindButton:SetNormalTextColor(ZO_NORMAL_TEXT)
          local interactionType = GetInteractionType()
        -- 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
        if IsPlayerGroundTargeting() then
            if self:TryHandlingGroundTargetingError() then
                self.nonInteract:SetHidden(false)
            end
        else
            local interactionExists, interactionAvailableNow, questInteraction, questTargetBased, questJournalIndex, questToolIndex, questToolOnCooldown = GetGameCameraInteractableInfo()
            if questTargetBased and self:TryHandlingQuestInteraction(questInteraction, questTargetBased, questJournalIndex, questToolIndex, questToolOnCooldown) then
                self.interact:SetHidden(false)
            elseif self:TryHandlingInteraction(interactionExists) then
                self.interact:SetHidden(false)
            elseif self:TryHandlingQuestInteraction(questInteraction, questTargetBased, questJournalIndex, questToolIndex, questToolOnCooldown) then
                self.interact:SetHidden(false)
            elseif self:TryHandlingNonInteractableFixture() then
                self.nonInteract:SetHidden(false)
            end
        end
          local showBusy = interactionType ~= INTERACTION_NONE and interactionType ~= INTERACTION_FISH and interactionType ~= INTERACTION_PICKPOCKET
          self.interactKeybindButton:SetEnabled(not showBusy and not self.interactionBlocked)
    end
end
function ZO_Reticle:OnUpdate()
    local interactionPossible = not self.interact:IsHidden()
    if interactionPossible or PLAYER_TO_PLAYER:HasTarget() or IsGameCameraUnitHighlightedAttackable() then
        self.reticleOpenCloseTimeline:PlayForward()
    else
        self.reticleOpenCloseTimeline:PlayBackward()
    end
end
function ZO_Reticle:RequestHidden(hidden)
    self.reticleHiddenExternalRequest = hidden
end
function ZO_Reticle:UpdateHiddenState()
    local reticleHidden = IsReticleHidden() or self.reticleHiddenExternalRequest
    local inStealthOrDisguise = GetUnitDisguiseState("player") ~= DISGUISE_STATE_NONE or GetUnitStealthState("player") ~= STEALTH_STATE_NONE
    self.control:SetHidden(reticleHidden)
    self.reticleTexture:SetHidden(inStealthOrDisguise)
    if not inStealthOrDisguise then
        self.stealthIcon:AnimateInStealthText()
    end
end
function ZO_Reticle:OnImpactfulHit()
    self.hitIndicatorTimeline:PlayFromStart()
end
function ZO_Reticle:AnimatePickpocketBonus(progress)
    local animatedChance = zo_floor((self.percentChance - (self.oldPercentChance or 0)) * progress) + (self.oldPercentChance or 0)
    self.additionalInfo:SetText(zo_strformat(SI_PICKPOCKET_SUCCESS_CHANCE, animatedChance))
end
    RETICLE:AnimatePickpocketBonus(progress)
end
    RETICLE = ZO_Reticle:New(control)
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,
}
ZO_StealthIcon = ZO_Object:Subclass()
--
-- Lifecycle
--
function ZO_StealthIcon:New(...)
    local stealthIcon = ZO_Object.New(self)
    stealthIcon:Initialize(...)
    
    return stealthIcon
end
function ZO_StealthIcon:Initialize(control)
    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.control = control
    self.stealthEyeTexture = control:GetNamedChild("StealthEye")
    self.stealthText = control:GetNamedChild("StealthText")
    self.stealthEyeTimeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("StealthIconStealthEyeAnimation", self.stealthEyeTexture)
    self.stealthEyeTimeline:SetHandler("OnStop", function(timeline) timeline:ClearAllCallbacks() end)
    self.currentStealthState = STEALTH_STATE_NONE
    self.stealthTextTimeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("StealthIconStealthTextFadeAnimation", self.stealthText)
end
--
-- Animations and updates
--
function ZO_StealthIcon:AnimateInStealthText(stringId)
    if stringId then
        self.stealthText:SetText(zo_strformat(stringId))
        if not self.stealthTextStringId or not stringId == self.stealthTextStringId then
            self.stealthTextTimeline:PlayFromStart()
        end
    end
    self.stealthTextStringId = stringId
end
function ZO_StealthIcon:HideStealthText()
    self.stealthTextStringId = nil
    self.stealthTextTimeline:PlayInstantlyToEnd()
end
function ZO_StealthIcon:SnapEyeAnimationToPoint(animPoint)
    if animPoint == STEALTH_ANIMATION_START then
        self.stealthEyeTexture:SetTextureCoords(0, 1 / STEALTH_ANIMATION_FRAMES, 0, 1)
    elseif animPoint == STEALTH_ANIMATION_MID then
        self.stealthEyeTexture:SetTextureCoords(0.5 - 1 / STEALTH_ANIMATION_FRAMES, 0.5, 0, 1)
    elseif animPoint == STEALTH_ANIMATION_END then
        self.stealthEyeTexture:SetTextureCoords(1 - 1 / STEALTH_ANIMATION_FRAMES, 1, 0, 1)
    end
end
function ZO_StealthIcon:UpdateStealthEye(stealthState)
    self.stealthEyeTexture:SetHidden(stealthState == STEALTH_STATE_NONE)
    self.stealthEyeTimeline:Stop()
    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:GetFirstAnimation():SetDuration(STEALTH_ANIMATION_DEFAULT_DURATION)
            self.stealthEyeTimeline:InsertCallback(function(timeline) timeline:Stop(); timeline:ClearAllCallbacks() end, STEALTH_ANIMATION_DEFAULT_DURATION)
            self.stealthEyeTimeline:PlayFromStart(STEALTH_ANIMATION_DEFAULT_DURATION * .5)
        else
            PlaySound(SOUNDS.STEALTH_HIDDEN)
            self:SnapEyeAnimationToPoint(STEALTH_ANIMATION_END)
            self:AnimateInStealthText(SI_STEALTH_HIDDEN)
        end
    elseif stealthState == STEALTH_STATE_DETECTED then
        if self.currentStealthState == STEALTH_STATE_STEALTH_ALMOST_DETECTED or self.currentStealthState == STEALTH_STATE_HIDDEN_ALMOST_DETECTED then
            PlaySound(SOUNDS.STEALTH_DETECTED)
            self.stealthEyeTimeline:GetFirstAnimation():SetDuration(STEALTH_ANIMATION_DEFAULT_DURATION)
            self.stealthEyeTimeline:PlayFromEnd(STEALTH_ANIMATION_DEFAULT_DURATION * .5)
        elseif self.currentStealthState == STEALTH_STATE_STEALTH or self.currentStealthState == STEALTH_STATE_HIDDEN then
            PlaySound(SOUNDS.STEALTH_DETECTED)
            self.stealthEyeTimeline:GetFirstAnimation():SetDuration(STEALTH_ANIMATION_DEFAULT_DURATION)
            self.stealthEyeTimeline:PlayFromEnd()
        else
            self:SnapEyeAnimationToPoint(STEALTH_ANIMATION_START)
        end
    elseif stealthState == STEALTH_STATE_HIDING then
        local currentTime = GetFrameTimeSeconds()
        local hidingEndTime = GetUnitHidingEndTime("player")
        local hidingTimeRemaining = zo_max(zo_ceil(hidingEndTime - currentTime), 0)
        self.stealthEyeTimeline:GetFirstAnimation():SetDuration(hidingTimeRemaining * 1000)
        self.stealthEyeTimeline:PlayFromStart()
    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:GetFirstAnimation():SetDuration(STEALTH_ANIMATION_DEFAULT_DURATION)
            self.stealthEyeTimeline:InsertCallback(function(timeline) timeline:Stop() timeline:ClearAllCallbacks() end, STEALTH_ANIMATION_DEFAULT_DURATION * .5)
            self.stealthEyeTimeline:PlayFromEnd()
        else
            self:SnapEyeAnimationToPoint(STEALTH_ANIMATION_MID)
            if stealthState == STEALTH_STATE_HIDDEN_ALMOST_DETECTED then
                self:AnimateInStealthText(SI_STEALTH_HIDDEN)
            end
        end
    end
    self.currentStealthState = stealthState
end
--
-- Event Handlers
--
function ZO_StealthIcon:OnStealthStateChanged(stealthState)
    -- Update the text
    if self.hiddenStates[stealthState] then
        self:AnimateInStealthText(SI_STEALTH_HIDDEN)
    elseif stealthState == STEALTH_STATE_DETECTED then
        self:AnimateInStealthText(SI_STEALTH_DETECTED)
    else
        self:HideStealthText()
    end
    -- Then update the eye
    self:UpdateStealthEye(stealthState)
end
function ZO_StealthIcon:OnDisguiseStateChanged(disguiseState)
    -- Update the text
    if disguiseState == DISGUISE_STATE_DISGUISED then
        self:AnimateInStealthText(SI_DISGUISE_DISGUISED)
    elseif disguiseState == DISGUISE_STATE_DANGER then
        self:AnimateInStealthText(SI_DISGUISE_DANGER)
    elseif disguiseState == DISGUISE_STATE_SUSPICIOUS then
        self:AnimateInStealthText(SI_DISGUISE_SUSPICIOUS)
    elseif disguiseState == DISGUISE_STATE_DISCOVERED then
        self:AnimateInStealthText(SI_DISGUISE_DISCOVERED)
    else
        self:HideStealthText()
    end
    -- Then update the eye
    if DisguiseToStealthState[disguiseState] then
        self:UpdateStealthEye(DisguiseToStealthState[disguiseState])
    else
        self:OnStealthStateChanged(GetUnitStealthState("player"))
    end
end