ESO Lua File v100010

ingame/globals/globals.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
TIME_TO_HOLD_KEY_MS = 250
local function OnGlobalMouseUp(eventCode, button, ctrl, alt, shift, command)
    if(button == 2) then
        ClearCursor()
    end
end
local function ShowLogoutDialog(dialogName, deferralTimeMS)
    if(ZO_Dialogs_IsShowing(dialogName)) then
        -- Update the dialog with the new deferral time
        ZO_Dialogs_UpdateDialogMainText(ZO_Dialogs_FindDialog(dialogName), nil, {deferralTimeMS})
    else
        -- Show the initial dialog
        if(deferralTimeMS) then
            ZO_Dialogs_ShowDialog(dialogName, { endTime = deferralTimeMS + GetFrameTimeMilliseconds() }, {mainTextParams = {deferralTimeMS}})
        else
            ZO_Dialogs_ShowDialog(dialogName)
        end
    end
end
local function OnLogoutDeferred(eventCode, deferralTimeMS, wasQuitRequest)
    if(wasQuitRequest) then
        ShowLogoutDialog("QUIT_DEFERRED", deferralTimeMS)
    else
        ShowLogoutDialog("LOGOUT_DEFERRED", deferralTimeMS)
    end
end
local function OnLogoutDisallowed(eventCode, wasQuitRequest)
    if(wasQuitRequest) then
        ShowLogoutDialog("QUIT_PREVENTED")
    end
end
local function OnCombatStateChanged(eventCode, inCombat)
    if(inCombat) then
        ZO_Dialogs_ReleaseDialog("QUIT_PREVENTED")
        ZO_Dialogs_ReleaseDialog("QUIT_DEFERRED")
        ZO_Dialogs_ReleaseDialog("LOGOUT_DEFERRED")
    end
end
EVENT_MANAGER:RegisterForEvent("Globals", EVENT_GLOBAL_MOUSE_UP, OnGlobalMouseUp)
EVENT_MANAGER:RegisterForEvent("Globals", EVENT_LOGOUT_DEFERRED, OnLogoutDeferred)
EVENT_MANAGER:RegisterForEvent("Globals", EVENT_LOGOUT_DISALLOWED, OnLogoutDisallowed)
EVENT_MANAGER:RegisterForEvent("Globals", EVENT_PLAYER_COMBAT_STATE, OnCombatStateChanged)
-- Item sounds for slotting actions should mirror the equip sounds according to the audio department.
-- This is globally overridden here...
ITEM_SOUND_ACTION_SLOT = ITEM_SOUND_ACTION_EQUIP
--
-- Gamepad action/binding script handlers
--
CHECK_MOVEMENT_BEFORE_INTERACT_OR_ACTION = false
do
    local JUMP_OR_INTERACT_DID_NOTHING = 0
    local JUMP_OR_INTERACT_DID_JUMP = 1
    local JUMP_OR_INTERACT_DID_INTERACT = 2
    local jumpPerformedByJumpOrInteract = JUMP_OR_INTERACT_DID_NOTHING
    local function TryingToMove()
        -- treat the player like they're never trying to move if we're not doing the check
        return CHECK_MOVEMENT_BEFORE_INTERACT_OR_ACTION and IsPlayerTryingToMove()
    end
    JumpOrInteractDown = function()
        jumpPerformedByJumpOrInteract = JUMP_OR_INTERACT_DID_NOTHING
        local interactionExists, interactionAvailableNow, questInteraction = GetGameCameraInteractableInfo()
        if(TryingToMove() or not (interactionAvailableNow or questInteraction) or IsBlockActive()) then        
            local gamepadTemplate = GetGamepadTemplate()
            if gamepadTemplate == GAMEPAD_TEMPLATE_DEFAULT then
                jumpPerformedByJumpOrInteract = JUMP_OR_INTERACT_DID_JUMP
                JumpAscendStart()
            end
        else
            jumpPerformedByJumpOrInteract = JUMP_OR_INTERACT_DID_INTERACT
            if not FISHING:StartInteraction() then GameCameraInteractStart() end
        end
    end
    
    JumpOrInteractUp = function()
        if(JUMP_OR_INTERACT_DID_INTERACT == jumpPerformedByJumpOrInteract) then
            FISHING:StopInteraction()
        elseif(JUMP_OR_INTERACT_DID_JUMP == jumpPerformedByJumpOrInteract) then
            AscendStop()
        end
    end
end
end
    JumpOrInteractUp()
end