ESO Lua File v100010

pregame/console/hackfunctions.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
--[[
TODO: HACK: The functions in here are intended to mirror the APIs of the IGS changes to support console.
This file is a hack intended to provide dummy wrappers for some of the console functionality for PC usage.
It should never be included in a public build of the game, and should be removed once the console code
is integrated with the rest of the UI code.
As a rule of thumb, all variables and functions defined are actually implemented functions from the
console code, unless the name begins with HACK_.
]]
--
--[[------------------------------------------------------------------------------
Configuration options. These are used to easily test various common configuration and error conditions.
]]
--------------------------------------------------------------------------------
local HACK_CREATE_SUCCEED = true
local HACK_LINK_SUCCEED = true
local HACK_SET_QUICK_LAUNCH = false
local HACK_LINKED = (GetCVar("QuickLaunch") == "1")
HACK_DEFAULT_USERID = GetCVar("AccountName")
HACK_DEFAULT_PASSWORD = GetCVar("AccountPassword")
HACK_DEFAULT_WORLD_NAME = GetCVar("LastRealm")
--[[------------------------------------------------------------------------------
Functions that are not defined in the console code, but which are really hacks, and
should be replaced with some better data source.
]]
--------------------------------------------------------------------------------
    return {
                {name="United Arab Emirates"},
                {name="United Kingdom"},
                {name="United States"},
                {name="Uruguay"},
                {name="Uzbekistan"},
                {name="Vanuatu"},
                {name="Venezuela"},
                {name="Vietnam"},
                {name="Virgin Islands"},
            }
end
--[[------------------------------------------------------------------------------
Functions that are actually defined in the console code, with correct returns nad
arguments, but with the functionality using temporary implementations.
]]
--------------------------------------------------------------------------------
-- Function to link the account specified.
function PregameLinkAccount(username, password)
    HACK_TriggerEventNoArgs(EVENT_ACCOUNT_LINK_REQUESTED)
    if HACK_LINK_SUCCEED then
        HACK_LINKED = true
        if HACK_SET_QUICK_LAUNCH then
            SetCVar("QuickLaunch", "1")
        end
        HACK_DEFAULT_USERID = username
        HACK_DEFAULT_PASSWORD = password
        HACK_TriggerEventNoArgs(EVENT_ACCOUNT_LINK_SUCCESSFUL)
    else
        HACK_TriggerEventString(EVENT_ACCOUNT_LINK_FAIL, "The ability to create link accounts is temporary disabled (see ConsoleHackFunctions.lua).")
    end
end
-- Function to create an account. (implemented as linking the default account)
function PregameCreateAccount(userEmail)
    HACK_TriggerEventNoArgs(EVENT_ACCOUNT_CREATE_REQUESTED)
    if HACK_CREATE_SUCCEED then
        HACK_LINKED = true
        if HACK_SET_QUICK_LAUNCH then
            SetCVar("QuickLaunch", "1")
        end
        HACK_TriggerEventNoArgs(EVENT_ACCOUNT_CREATE_SUCCESSFUL)
    else
        HACK_TriggerEventString(EVENT_ACCOUNT_CREATE_FAIL, "The ability to create new accounts is temporary disabled (see ConsoleHackFunctions.lua).")
    end
end
-- Function to attempt a quick login.
    local username = ""
    local password = ""
    
    if HACK_LINKED then
        username = HACK_DEFAULT_USERID
        password = HACK_DEFAULT_PASSWORD
    end
    if (username == nil) or (username == "") then
        HACK_TriggerEventNoArgs(EVENT_PROFILE_NOT_LINKED)
    else
        PregameLogin(username, password)
    end
end
-- Function to get the currently active console online ID.
    return "My_console_IDTag"
end