Back to Home

ESO Lua File v100021

ingame/quickchat/quickchatmanager.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
local QuickChatManager = ZO_Object:Subclass()
local CUSTOM_QUICK_CHAT_ID_START = 1000
function QuickChatManager:New()
    local obj = ZO_Object.New(self)
    obj:Initialize()
    return obj
end
function QuickChatManager:Initialize()
    self.formattedNames = {}
end
function QuickChatManager:GetNumQuickChats()
    return GetNumDefaultQuickChats()
end
function QuickChatManager:GetQuickChatIcon()
    return "EsoUI/Art/Emotes/Gamepad/gp_emoteIcon_quickchat.dds"
end
function QuickChatManager:IsDefaultQuickChat(id)
    return id < CUSTOM_QUICK_CHAT_ID_START
end
function QuickChatManager:GetQuickChatId(index)
    return index
end
function QuickChatManager:HasQuickChat(id)
    if self:IsDefaultQuickChat(id) then
        return id <= GetNumDefaultQuickChats()
    end
end
function QuickChatManager:GetQuickChatName(id)
    if self:IsDefaultQuickChat(id) then
        return GetDefaultQuickChatName(id)
    end
end
function QuickChatManager:GetFormattedQuickChatName(id)
    if not self.formattedNames[id] then
        self.formattedNames[id] = zo_strformat(SI_GAMEPAD_PLAYER_EMOTE_NAME, self:GetQuickChatName(id))
    end
    return self.formattedNames[id]
end
function QuickChatManager:GetQuickChatMessage(id)
    if self:IsDefaultQuickChat(id) then
        return GetDefaultQuickChatMessage(id)
    end
end
function QuickChatManager:PlayQuickChat(id)
    if self:IsDefaultQuickChat(id) then
        return PlayDefaultQuickChat(id)
    end
end
function QuickChatManager:BuildQuickChatList()
    local quickChats = {}
    local numChats = self:GetNumQuickChats()
    for index = 1, numChats do
        table.insert(quickChats, self:GetQuickChatId(index))
    end
    return quickChats
end
QUICK_CHAT_MANAGER = QuickChatManager:New()