ESO Lua File v100010

ingame/contacts/socialmanager.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
SOCIAL_NAME_SEARCH = 1
ZO_SocialManager = ZO_Object:Subclass()
function ZO_SocialManager:New()
    local manager = ZO_Object.New(self)
    ZO_SocialManager.Initialize(manager)
    return manager
end
function ZO_SocialManager:Initialize()
    -- a list of lists that will be updated when notifications are received
    self.lists = {}
    self.masterList = {}
    self.search = ZO_StringSearch:New()
    self.search:AddProcessor(SOCIAL_NAME_SEARCH, function(stringSearch, data, searchTerm, cache) return self:ProcessDisplayName(stringSearch, data, searchTerm, cache) end)
end
function ZO_SocialManager:GetMasterList()
    return self.masterList
end
function ZO_SocialManager:BuildMasterList()
    -- Meant to be overridden
end
function ZO_SocialManager:AddList(list)
    table.insert(self.lists, list)
end
function ZO_SocialManager:CallFunctionOnLists(funcName, ...)
    for i,list in ipairs(self.lists) do
        if list[funcName] then
            list[funcName](list, ...)
        end
    end
end
function ZO_SocialManager:RefreshSort()
    self:CallFunctionOnLists("RefreshSort")
end
function ZO_SocialManager:RefreshFilters()
    self:CallFunctionOnLists("RefreshFilters")
end
function ZO_SocialManager:RefreshData()
    self:CallFunctionOnLists("RefreshData")
end
function ZO_SocialManager:RefreshVisible()
    self:CallFunctionOnLists("RefreshVisible")
end
function ZO_SocialManager:IsMatch(searchTerm, data)
    return self.search:IsMatch(searchTerm, data)
end
function ZO_SocialManager:ProcessDisplayName(stringSearch, data, searchTerm, cache)
    local lowerSearchTerm = searchTerm:lower()
    if(zo_plainstrfind(data.displayName:lower(), lowerSearchTerm)) then
        return true
    end
    if(data.characterName ~= nil and zo_plainstrfind(data.characterName:lower(), lowerSearchTerm)) then
        return true
    end
end