Back to Home

ESO Lua File v100031

ingame/antiquities/antiquitysetdata.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
ZO_AntiquitySet = ZO_Object:Subclass()
function ZO_AntiquitySet:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end
function ZO_AntiquitySet:Initialize(antiquitySetId)
    self.antiquitySetId = antiquitySetId
    self.name = GetAntiquitySetName(antiquitySetId)
    self.icon = GetAntiquitySetIcon(antiquitySetId)
    self.quality = GetAntiquitySetQuality(antiquitySetId)
    self.rewardId = GetAntiquitySetRewardId(antiquitySetId)
    self.antiquities = {}
end
function ZO_AntiquitySet:GetId()
    return self.antiquitySetId
end
function ZO_AntiquitySet:GetType()
    return ZO_ANTIQUITY_TYPE_SET
end
function ZO_AntiquitySet:GetName()
    return self.name
end
function ZO_AntiquitySet:GetFormattedName()
    return ZO_CachedStrFormat(SI_ANTIQUITY_SET_NAME_FORMATTER, self.name)
end
function ZO_AntiquitySet:GetColorizedFormattedName()
    local itemQualityColor = ZO_ColorDef:New(GetInterfaceColor(INTERFACE_COLOR_TYPE_ANTIQUITY_QUALITY_COLORS, self:GetQuality()))
    return itemQualityColor:Colorize(self:GetFormattedName())
end
function ZO_AntiquitySet:GetIcon()
    return self.icon
end
function ZO_AntiquitySet:GetQuality()
    return self.quality
end
function ZO_AntiquitySet:GetRewardId()
    return self.rewardId
end
function ZO_AntiquitySet:HasReward()
    return self.rewardId ~= 0
end
function ZO_AntiquitySet:IsRepeatable()
    for _, antiquityData in self:AntiquityIterator() do
        if antiquityData:IsRepeatable() then
            return true
        end
    end
    return false
end
function ZO_AntiquitySet:HasDiscoveredDigSites()
    for _, antiquityData in self:AntiquityIterator() do
        if antiquityData:HasDiscoveredDigSites() then
            return true
        end
    end
    return false
end
function ZO_AntiquitySet:HasNoDiscoveredDigSites()
    return not self:HasDiscoveredDigSites()
end
function ZO_AntiquitySet:GetNumRecovered()
    local numRecovered
    for _, antiquityData in self:AntiquityIterator() do
        local antiquityNumRecovered = antiquityData:GetNumRecovered()
        numRecovered = numRecovered and math.min(numRecovered, antiquityNumRecovered) or antiquityNumRecovered
    end
    return numRecovered or 0
end
function ZO_AntiquitySet:GetLoreEntries()
    local loreEntries = {}
    for _, antiquityData in self:AntiquityIterator() do
        for _, loreEntry in ipairs(antiquityData:GetLoreEntries()) do
            table.insert(loreEntries, loreEntry)
        end
    end
    return loreEntries
end
function ZO_AntiquitySet:GetNumLoreEntries()
    local numLoreEntries = 0
    for _, antiquityData in self:AntiquityIterator() do
        numLoreEntries = numLoreEntries + antiquityData:GetNumLoreEntries()
    end
    return numLoreEntries
end
function ZO_AntiquitySet:GetNumUnlockedLoreEntries()
    local numUnlockedEntries = 0
    for _, antiquityData in self:AntiquityIterator() do
        numUnlockedEntries = numUnlockedEntries + antiquityData:GetNumUnlockedLoreEntries()
    end
    return numUnlockedEntries
end
function ZO_AntiquitySet:GetNumAntiquities()
    return #self.antiquities
end
function ZO_AntiquitySet:GetNumAntiquitiesRecovered()
    local count = 0
    for _, _ in self:AntiquityIterator({ZO_Antiquity.IsComplete}) do
        count = count + 1
    end
    return count
end
function ZO_AntiquitySet:HasNewLead()
    for _, antiquityData in self:AntiquityIterator() do
        if antiquityData:HasNewLead() then
            return true
        end
    end
    return false
end
function ZO_AntiquitySet:HasDiscovered()
    return self:AntiquityIterator({ZO_Antiquity.HasDiscovered})() ~= nil
end
function ZO_AntiquitySet:HasRecovered()
    return self:AntiquityIterator({function(antiquityData) return not antiquityData:HasRecovered() end})() == nil
end
function ZO_AntiquitySet:IsComplete()
    return self:HasRecovered()
end
function ZO_AntiquitySet:AddAntiquityData(antiquityData)
    table.insert(self.antiquities, antiquityData)
end
function ZO_AntiquitySet:AntiquityIterator(filterFunctions)
    return ZO_FilteredNumericallyIndexedTableIterator(self.antiquities, filterFunctions)
end