ESO Lua File v100012

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
SLASH_COMMANDS = {}
SLASH_COMMANDS[GetString(SI_SLASH_SCRIPT)] = function (txt)
    local f = assert(zo_loadstring(txt))
    f()
end
SLASH_COMMANDS[GetString(SI_SLASH_CHATLOG)] = function(txt)
    if(IsChatLogEnabled()) then
        CHAT_SYSTEM:AddMessage(GetString(SI_CHAT_LOG_ENABLED))
    else
        CHAT_SYSTEM:AddMessage(GetString(SI_CHAT_LOG_DISABLED))
    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_RELEASE_KEEP)] = function(txt)
    ReleaseKeep()
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
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
        ExecuteChatCommand(text)
    end
end
CHAT_SYSTEM:AddCommandPrefix('/', DoCommand)