ESO Lua File v100011

ingame/gamepad/gamepadgamercard.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
--Helper functions for displaying gamercards
function ShowGamerCardFromCharName(charName)
    local accountName, consoleId, wasFound = GetConsoleInfoFromCharName(charName)
    if(wasFound) then
        local undecoratedName = UndecorateDisplayName(accountName);
        ShowGamerCard(undecoratedName, consoleId)
    else
        ZO_Dialogs_ShowGamepadDialog("WAITING_FOR_GAMERCARD", {charName = charName, startTime = GetFrameTimeSeconds()})
    end
end
function ShowGamerCardFromAccountId(accountId)
    local accountName, consoleId, wasFound = GetConsoleInfoFromAccountId(accountId)
    if(wasFound) then
        local undecoratedName = UndecorateDisplayName(accountName);
        ShowGamerCard(undecoratedName, consoleId)
    else
        ZO_Dialogs_ShowGamepadDialog("WAITING_FOR_GAMERCARD", {accountId = accountId, startTime = GetFrameTimeSeconds()})
    end
end
local function OnConsoleInfoRecieved(accountId, charName, success)
    local dialog = ZO_Dialogs_FindDialog("WAITING_FOR_GAMERCARD")
    if(dialog) then
        local data = dialog.data
        local eventMatches = (data.accountId and data.accountId == accountId) or (data.charName and data.charName == charName or eventMatches)
        if(eventMatches) then
            ZO_Dialogs_ReleaseDialog(dialog)
            if(success) then
                local accountName, consoleId
                if(data.accountId) then
                    accountName, consoleId = GetConsoleInfoFromAccountId(dialog.data.accountId)
                elseif(data.charName) then
                    accountName, consoleId = GetConsoleInfoFromCharName(dialog.data.charName)
                end
                local undecoratedName = UndecorateDisplayName(accountName);
                ShowGamerCard(undecoratedName, consoleId)
            else
                ZO_Dialogs_ShowGamepadDialog("GAMERCARD_UNAVAILABLE")
            end
        end
    end
end
EVENT_MANAGER:RegisterForEvent("GamepadGamerCard_ConsoleInfoRecieved", EVENT_CONSOLE_INFO_RECIEVED, function(event, ...) OnConsoleInfoRecieved(...) end)
function GetGamertagStringId()
    return GetUIPlatform() == UI_PLATFORM_PS4 and SI_GAMEPAD_CONTACTS_OPTIONS_PSN_ID
           or SI_GAMEPAD_CONTACTS_OPTIONS_GAMERTAG
end
    return GetUIPlatform() == UI_PLATFORM_PS4 and SI_PLAYER_TO_PLAYER_VIEW_PSN_PROFILE
           or SI_PLAYER_TO_PLAYER_VIEW_GAMER_CARD
end