Back to Home

ESO Lua File v100023

ingame/slashcommands/slashcommands_shared.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
SLASH_COMMANDS = {}
if not IsConsoleUI() or IsInternalBuild() then
    SLASH_COMMANDS[GetString(SI_SLASH_SCRIPT)] = function (txt)
        local f = assert(zo_loadstring(txt))
        f()
    end
end
if not IsConsoleUI() then
    SLASH_COMMANDS[GetString(SI_SLASH_CHATLOG)] = function(txt)
        SetChatLogEnabled(not IsChatLogEnabled())
        if(IsChatLogEnabled()) then
            CHAT_SYSTEM:AddMessage(GetString(SI_CHAT_LOG_ENABLED))
        else
            CHAT_SYSTEM:AddMessage(GetString(SI_CHAT_LOG_DISABLED))
        end
    end
end
SLASH_COMMANDS[GetString(SI_SLASH_GROUP_INVITE)] = function(txt)
    GroupInviteByName(txt)
    CHAT_SYSTEM:AddMessage(zo_strformat(GetString("SI_GROUPINVITERESPONSE", GROUP_INVITE_RESPONSE_INVITED), txt))
end
SLASH_COMMANDS[GetString(SI_SLASH_JUMP_TO_LEADER)] = function(txt)
    JumpToGroupLeader(txt)
end
SLASH_COMMANDS[GetString(SI_SLASH_JUMP_TO_GROUP_MEMBER)] = function(txt)
    JumpToGroupMember(txt)
end
SLASH_COMMANDS[GetString(SI_SLASH_JUMP_TO_FRIEND)] = function(txt)
    JumpToFriend(txt)
end
SLASH_COMMANDS[GetString(SI_SLASH_JUMP_TO_GUILD_MEMBER)] = function(txt)
    JumpToGuildMember(txt)
end
SLASH_COMMANDS[GetString(SI_SLASH_RELOADUI)] = function(txt)
    ReloadUI("ingame")
end
SLASH_COMMANDS[GetString(SI_SLASH_PLAYED_TIME)] = function(args)
    local playedTime = ZO_FormatTime(GetSecondsPlayed(), TIME_FORMAT_STYLE_DESCRIPTIVE, TIME_FORMAT_PRECISION_SECONDS)
    CHAT_SYSTEM:AddMessage(zo_strformat(SI_CHAT_MESSAGE_PLAYED_TIME, GetRawUnitName("player"), playedTime))
end
SLASH_COMMANDS[GetString(SI_SLASH_READY_CHECK)] = ZO_SendReadyCheck
SLASH_COMMANDS[GetString(SI_SLASH_DUEL_INVITE)] = function(txt)
    ChallengeTargetToDuel(txt)
end
function DoCommand(text)
    local command, arguments = zo_strmatch(text, "^(/%S+)%s?(.*)")
    command = zo_strlower(command or "")
    local fn = SLASH_COMMANDS[command]
    
    if(fn)
    then
        fn(arguments or "")
    else
          if IsInternalBuild() then
               ExecuteChatCommand(text)
          else
               ZO_Alert(UI_ALERT_CATEGORY_ALERT, nil, SI_ERROR_INVALID_COMMAND)
          end
    end
end
    SCENE_MANAGER:CreateStackFromScratch("mainMenuGamepad", "helpRootGamepad")
end
CHAT_SYSTEM:AddCommandPrefix('/', DoCommand)