Back to Home

ESO Lua File v100031

publicallingames/antiquities/antiqtuityloredocument_manager.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
local ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_FILE_HEIGHT = 1024
local ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_FILE_BOTTOM_OFFSET = 643
local ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_FILE_HEIGHT = 512
local ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_FILE_BOTTOM_OFFSET = 453
local ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_FILE_HEIGHT = 256
local ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_FILE_BOTTOM_OFFSET = 256
-- Standard Document Configuration
ZO_ANTIQUITY_LORE_DOCUMENT_CONTROL_WIDTH = 1024
local ANTIQUITY_LORE_DOCUMENT_FILE_WIDTH = 1024
local ANTIQUITY_LORE_DOCUMENT_SCALE_MODIFIER = ZO_ANTIQUITY_LORE_DOCUMENT_CONTROL_WIDTH / ANTIQUITY_LORE_DOCUMENT_FILE_WIDTH
local ANTIQUITY_LORE_DOCUMENT_LARGE_FILE_HEIGHT = 1024
local ANTIQUITY_LORE_DOCUMENT_LARGE_FILE_BOTTOM_OFFSET = 576
ZO_ANTIQUITY_LORE_DOCUMENT_LARGE_CONTROL_HEIGHT = ANTIQUITY_LORE_DOCUMENT_LARGE_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_DOCUMENT_LARGE_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_DOCUMENT_LARGE_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_DOCUMENT_LARGE_FILE_HEIGHT
ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_CONTROL_HEIGHT = ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_FILE_HEIGHT
local ANTIQUITY_LORE_DOCUMENT_MEDIUM_FILE_HEIGHT = 512
local ANTIQUITY_LORE_DOCUMENT_MEDIUM_FILE_BOTTOM_OFFSET = 448
ZO_ANTIQUITY_LORE_DOCUMENT_MEDIUM_CONTROL_HEIGHT = ANTIQUITY_LORE_DOCUMENT_MEDIUM_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_DOCUMENT_MEDIUM_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_DOCUMENT_MEDIUM_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_DOCUMENT_MEDIUM_FILE_HEIGHT
ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_CONTROL_HEIGHT = ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_FILE_HEIGHT
local ANTIQUITY_LORE_DOCUMENT_SMALL_FILE_HEIGHT = 256
local ANTIQUITY_LORE_DOCUMENT_SMALL_FILE_BOTTOM_OFFSET = 256
ZO_ANTIQUITY_LORE_DOCUMENT_SMALL_CONTROL_HEIGHT = ANTIQUITY_LORE_DOCUMENT_SMALL_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_DOCUMENT_SMALL_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_DOCUMENT_SMALL_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_DOCUMENT_SMALL_FILE_HEIGHT
ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_CONTROL_HEIGHT = ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_FILE_HEIGHT
-- Wide Document Configuration
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_CONTROL_WIDTH = 1200
local ANTIQUITY_LORE_WIDE_DOCUMENT_FILE_WIDTH = 1024
local ANTIQUITY_LORE_WIDE_DOCUMENT_SCALE_MODIFIER = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_CONTROL_WIDTH / ANTIQUITY_LORE_WIDE_DOCUMENT_FILE_WIDTH
local ANTIQUITY_LORE_WIDE_DOCUMENT_LARGE_FILE_HEIGHT = 1024
local ANTIQUITY_LORE_WIDE_DOCUMENT_LARGE_FILE_BOTTOM_OFFSET = 576
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_LARGE_CONTROL_HEIGHT = ANTIQUITY_LORE_WIDE_DOCUMENT_LARGE_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_WIDE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_LARGE_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_WIDE_DOCUMENT_LARGE_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_WIDE_DOCUMENT_LARGE_FILE_HEIGHT
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_LARGE_CONTROL_HEIGHT = ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_WIDE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_LARGE_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_FILE_HEIGHT
local ANTIQUITY_LORE_WIDE_DOCUMENT_MEDIUM_FILE_HEIGHT = 512
local ANTIQUITY_LORE_WIDE_DOCUMENT_MEDIUM_FILE_BOTTOM_OFFSET = 448
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_MEDIUM_CONTROL_HEIGHT = ANTIQUITY_LORE_WIDE_DOCUMENT_MEDIUM_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_WIDE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_MEDIUM_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_WIDE_DOCUMENT_MEDIUM_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_WIDE_DOCUMENT_MEDIUM_FILE_HEIGHT
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_MEDIUM_CONTROL_HEIGHT = ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_WIDE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_MEDIUM_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_FILE_HEIGHT
local ANTIQUITY_LORE_WIDE_DOCUMENT_SMALL_FILE_HEIGHT = 256
local ANTIQUITY_LORE_WIDE_DOCUMENT_SMALL_FILE_BOTTOM_OFFSET = 256
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_SMALL_CONTROL_HEIGHT = ANTIQUITY_LORE_WIDE_DOCUMENT_SMALL_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_WIDE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_SMALL_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_WIDE_DOCUMENT_SMALL_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_WIDE_DOCUMENT_SMALL_FILE_HEIGHT
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_SMALL_CONTROL_HEIGHT = ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_FILE_BOTTOM_OFFSET * ANTIQUITY_LORE_WIDE_DOCUMENT_SCALE_MODIFIER
ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_SMALL_TEXTURE_COORDS_BOTTOM = ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_FILE_BOTTOM_OFFSET / ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_FILE_HEIGHT
-- General Configuration
ZO_ANTIQUITY_LORE_MAGIC_MIN_ALPHA = 0.5
ZO_ANTIQUITY_LORE_MAGIC_MAX_ALPHA = 0.1
ZO_ANTIQUITY_LORE_BACKGROUND_PADDING_X = 60
ZO_ANTIQUITY_LORE_BACKGROUND_PADDING_Y = 45
ZO_ANTIQUITY_LORE_BACKGROUND_DOUBLE_PADDING_X = ZO_ANTIQUITY_LORE_BACKGROUND_PADDING_X * 2
ZO_ANTIQUITY_LORE_LABEL_PADDING_Y = 15
local ANTIQUITY_LORE_NON_LABEL_DEADSPACE_Y = ZO_ANTIQUITY_LORE_BACKGROUND_PADDING_Y + ZO_ANTIQUITY_LORE_BACKGROUND_PADDING_Y + ZO_ANTIQUITY_LORE_LABEL_PADDING_Y
local NUM_DOCUMENT_VARIANTS = 10
local LABEL_ALIGNMENTS =
{
    TEXT_ALIGN_LEFT,
    TEXT_ALIGN_CENTER,
    TEXT_ALIGN_RIGHT,
}
local ANTIQUITY_CODEX_TEXTURE_FORMATTER = "EsoUI/Art/Antiquities/Codex/AntiquityLore_%s_%d.dds"
local ANTIQUITY_CODEX_WIDE_TEXTURE_FORMATTER = "EsoUI/Art/Antiquities/Codex/AntiquityLore_%s_%d.dds"
local ANTIQUITY_CODEX_MAGIC_PAPER_TEXTURE_FORMATTER = "EsoUI/Art/Antiquities/Codex/Antiquity_Entry_DIGGING_%s.dds"
local ANTIQUITY_CODEX_END_TEXTURE_FORMATTER = "EsoUI/Art/Antiquities/Codex/Digging_PostGame_End_%s.dds"
local ANTIQUITY_CODEX_MAGIC_TEXTURE_FORMATTER = "EsoUI/Art/Antiquities/Codex/Digging_PostGame_Magic_%s.dds"
ZO_AntiquityLoreDocument_Manager = ZO_CallbackObject:Subclass()
function ZO_AntiquityLoreDocument_Manager:New(...)
    local manager = ZO_CallbackObject.New(self, ...)
    manager:Initialize(...)
    return manager
end
function ZO_AntiquityLoreDocument_Manager:Initialize()
    local widePool = ZO_ControlPool:New("ZO_AntiquityLoreWideDocument", nil, "LoreWideDocument")
    widePool:SetCustomFactoryBehavior(function(control)
        control.highlightAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("ZO_AntiquityLoreDocument_HighlightAnimation", control)
    end)
    widePool:SetCustomAcquireBehavior(function(control)
        ApplyTemplateToControl(control, ZO_GetPlatformTemplate("ZO_AntiquityLoreDocument"))
    end)
    self.wideControlAcquisitionDescriptor =
    {
        pool = widePool,
        metaPools = {},
        fileFormatter = ANTIQUITY_CODEX_WIDE_TEXTURE_FORMATTER,
        sizeDescriptors =
        {
            {
                maxLabelHeight = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_SMALL_CONTROL_HEIGHT - ANTIQUITY_LORE_NON_LABEL_DEADSPACE_Y,
                textureHeight = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_SMALL_CONTROL_HEIGHT,
                textureCoordBottom = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_SMALL_TEXTURE_COORDS_BOTTOM,
                endsTextureHeight = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_SMALL_CONTROL_HEIGHT,
                endsTextureCoordBottom = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_SMALL_TEXTURE_COORDS_BOTTOM,
                imageQualifier = "Small",
            },
            {
                maxLabelHeight = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_MEDIUM_CONTROL_HEIGHT - ANTIQUITY_LORE_NON_LABEL_DEADSPACE_Y,
                textureHeight = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_MEDIUM_CONTROL_HEIGHT,
                textureCoordBottom = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_MEDIUM_TEXTURE_COORDS_BOTTOM,
                endsTextureHeight = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_MEDIUM_CONTROL_HEIGHT,
                endsTextureCoordBottom = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_MEDIUM_TEXTURE_COORDS_BOTTOM,
                imageQualifier = "Medium",
            },
            {
                maxLabelHeight = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_LARGE_CONTROL_HEIGHT - ANTIQUITY_LORE_NON_LABEL_DEADSPACE_Y,
                textureHeight = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_LARGE_CONTROL_HEIGHT,
                textureCoordBottom = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_LARGE_TEXTURE_COORDS_BOTTOM,
                endsTextureHeight = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_LARGE_CONTROL_HEIGHT,
                endsTextureCoordBottom = ZO_ANTIQUITY_LORE_WIDE_DOCUMENT_ENDS_LARGE_TEXTURE_COORDS_BOTTOM,
                imageQualifier = "Large",
            },
        },
    }
    local standardPool = ZO_ControlPool:New("ZO_AntiquityLoreStandardDocument", nil, "LoreStandardDocument")
    standardPool:SetCustomFactoryBehavior(function(control)
        control.highlightAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("ZO_AntiquityLoreDocument_HighlightAnimation", control)
    end)
    standardPool:SetCustomAcquireBehavior(function(control)
        ApplyTemplateToControl(control, ZO_GetPlatformTemplate("ZO_AntiquityLoreDocument"))
    end)
    self.standardControlAcquisitionDescriptor =
    {
        pool = standardPool,
        metaPools = {},
        fileFormatter = ANTIQUITY_CODEX_TEXTURE_FORMATTER,
        sizeDescriptors =
        {
            {
                maxLabelHeight = ZO_ANTIQUITY_LORE_DOCUMENT_SMALL_CONTROL_HEIGHT - ANTIQUITY_LORE_NON_LABEL_DEADSPACE_Y,
                textureHeight = ZO_ANTIQUITY_LORE_DOCUMENT_SMALL_CONTROL_HEIGHT,
                textureCoordBottom = ZO_ANTIQUITY_LORE_DOCUMENT_SMALL_TEXTURE_COORDS_BOTTOM,
                endsTextureHeight = ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_CONTROL_HEIGHT,
                endsTextureCoordBottom = ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_SMALL_TEXTURE_COORDS_BOTTOM,
                imageQualifier = "Small",
            },
            {
                maxLabelHeight = ZO_ANTIQUITY_LORE_DOCUMENT_MEDIUM_CONTROL_HEIGHT - ANTIQUITY_LORE_NON_LABEL_DEADSPACE_Y,
                textureHeight = ZO_ANTIQUITY_LORE_DOCUMENT_MEDIUM_CONTROL_HEIGHT,
                textureCoordBottom = ZO_ANTIQUITY_LORE_DOCUMENT_MEDIUM_TEXTURE_COORDS_BOTTOM,
                endsTextureHeight = ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_CONTROL_HEIGHT,
                endsTextureCoordBottom = ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_MEDIUM_TEXTURE_COORDS_BOTTOM,
                imageQualifier = "Medium",
            },
            {
                maxLabelHeight = ZO_ANTIQUITY_LORE_DOCUMENT_LARGE_CONTROL_HEIGHT - ANTIQUITY_LORE_NON_LABEL_DEADSPACE_Y,
                textureHeight = ZO_ANTIQUITY_LORE_DOCUMENT_LARGE_CONTROL_HEIGHT,
                textureCoordBottom = ZO_ANTIQUITY_LORE_DOCUMENT_LARGE_TEXTURE_COORDS_BOTTOM,
                endsTextureHeight = ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_CONTROL_HEIGHT,
                endsTextureCoordBottom = ZO_ANTIQUITY_LORE_DOCUMENT_ENDS_LARGE_TEXTURE_COORDS_BOTTOM,
                imageQualifier = "Large",
            },
        },
    }
end
-- Never hold on to a control indefinitely. Make sure to always call ReleaseAllObjects when you no longer need them, or at least when leaving your scene
function ZO_AntiquityLoreDocument_Manager:AcquireWideDocumentForLoreEntry(parentControl, antiquityId, loreEntryIndex, useMagicView)
    return self:InternalAcquireDocumentForLoreEntry(self.wideControlAcquisitionDescriptor, parentControl, antiquityId, loreEntryIndex, useMagicView)
end
-- Never hold on to a control indefinitely. Make sure to always call ReleaseAllObjects when you no longer need them, or at least when leaving your scene
function ZO_AntiquityLoreDocument_Manager:AcquireDocumentForLoreEntry(parentControl, antiquityId, loreEntryIndex, useMagicView)
    return self:InternalAcquireDocumentForLoreEntry(self.standardControlAcquisitionDescriptor, parentControl, antiquityId, loreEntryIndex, useMagicView)
end
function ZO_AntiquityLoreDocument_Manager:InternalAcquireDocumentForLoreEntry(acquisitionDescriptor, parentControl, antiquityId, loreEntryIndex, useMagicView)
    local loreEntryData = nil
    if ANTIQUITY_DATA_MANAGER then
        local antiquityData = ANTIQUITY_DATA_MANAGER:GetAntiquityData(antiquityId)
        if antiquityData then
            loreEntryData = antiquityData:GetLoreEntry(loreEntryIndex)
        end
    else
        -- Internal doesn't have the manager, so just build the data manually
        local numEntries = GetNumAntiquityLoreEntries(antiquityId)
        if loreEntryIndex <= numEntries then
            local displayName, description = GetAntiquityLoreEntry(antiquityId, loreEntryIndex)
            loreEntryData =
            {
                displayName = displayName,
                description = description,
                unlocked = GetNumAntiquityLoreEntriesAcquired(antiquityId) >= loreEntryIndex,
            }
        end
    end
    if not loreEntryData then
        -- Invalid lore entry args
        return nil
    end
    -- Spread the seeds far apart because seeds that are very close to eachother typically have the same first number, then throw out the first number for good measure
    -- This will allow for 20 lore per antiquity with 20k antiquities (numbers we "should" never hit)
    -- http://lua-users.org/lists/lua-l/2007-03/msg00564.html
    local seed = (loreEntryIndex * 100000000) + (antiquityId * 1000)
    zo_randomseed(seed)
    zo_random()
    -- BEGIN DETERMINISTIC "RANDOM" SPECIFICATIONS --
    local documentVariant = zo_random(NUM_DOCUMENT_VARIANTS)
    local titleAlignment = LABEL_ALIGNMENTS[zo_random(#LABEL_ALIGNMENTS)]
    local flipHorizontalTextureCoords = zo_random() > 0.5
    local colorR = 1
    local colorG = 1
    local colorB = 1
    local alpha = 1
    local desaturation = nil
    if loreEntryData.unlocked then
        colorR = zo_random(90, 100) / 100
        colorG = zo_random(90, 100) / 100
        colorB = zo_random(90, 100) / 100
        desaturation = zo_random(0, 25) / 100
    else
        alpha = 0.4
        desaturation = 1
    end
    -- END DETERMINISTIC "RANDOM" SPECIFICATIONS --
    -- Every system gets a meta pool
    local metaPool = acquisitionDescriptor.metaPools[parentControl]
    if not metaPool then
        metaPool = ZO_MetaPool:New(acquisitionDescriptor.pool)
        acquisitionDescriptor.metaPools[parentControl] = metaPool
    end
    local control = metaPool:AcquireObject()
    control.titleLabel:SetText(loreEntryData.displayName)
    control.bodyLabel:SetText(loreEntryData.description)
    local totalLabelHeight = control.titleLabel:GetHeight() + control.bodyLabel:GetHeight()
    -- Choose the correctly sized control info
    local sizeDescriptor = nil
    for index, descriptor in ipairs(acquisitionDescriptor.sizeDescriptors) do
        if totalLabelHeight <= descriptor.maxLabelHeight or index == #acquisitionDescriptor.sizeDescriptors then
            sizeDescriptor = descriptor
            break
        end
    end
    
    control:SetAlpha(alpha)
    local backgroundTexturePath
    if useMagicView then
        backgroundTexturePath = string.format(ANTIQUITY_CODEX_MAGIC_PAPER_TEXTURE_FORMATTER, sizeDescriptor.imageQualifier)
        flipHorizontalTextureCoords = true
    else
        backgroundTexturePath = string.format(acquisitionDescriptor.fileFormatter, sizeDescriptor.imageQualifier, documentVariant)
    end
    local backgroundTexture = control.backgroundTexture
    backgroundTexture:SetTexture(backgroundTexturePath)
    if flipHorizontalTextureCoords then
        backgroundTexture:SetTextureCoords(1, 0, 0, sizeDescriptor.textureCoordBottom)
    else
        backgroundTexture:SetTextureCoords(0, 1, 0, sizeDescriptor.textureCoordBottom)
    end
    backgroundTexture:SetHeight(sizeDescriptor.textureHeight)
    backgroundTexture:SetVertexColors(VERTEX_POINTS_TOPLEFT, colorR, colorG, colorB, alpha)
    backgroundTexture:SetVertexColors(VERTEX_POINTS_TOPRIGHT, 0.9 * colorR, 0.9 * colorG, 0.9 * colorB, alpha)
    backgroundTexture:SetVertexColors(VERTEX_POINTS_BOTTOMLEFT, 0.65 * colorR, 0.65 * colorG, 0.65 * colorB, alpha)
    backgroundTexture:SetVertexColors(VERTEX_POINTS_BOTTOMRIGHT, 0.25 * colorR, 0.25 * colorG, 0.25 * colorB, alpha)
    backgroundTexture:SetDesaturation(desaturation)
    local leftEndTexture, rightEndTexture = control.leftEndTexture, control.rightEndTexture
    local magicTexture = control.magicTexture
    if useMagicView then
        leftEndTexture:SetHidden(false)
        rightEndTexture:SetHidden(false)
        local endTexturePath = string.format(ANTIQUITY_CODEX_END_TEXTURE_FORMATTER, sizeDescriptor.imageQualifier)
        leftEndTexture:SetTexture(endTexturePath)
        leftEndTexture:SetHeight(sizeDescriptor.endsTextureHeight)
        leftEndTexture:SetTextureCoords(0, 1, 0, sizeDescriptor.endsTextureCoordBottom)
        rightEndTexture:SetTexture(endTexturePath)
        rightEndTexture:SetHeight(sizeDescriptor.endsTextureHeight)
        rightEndTexture:SetTextureCoords(1, 0, 0, sizeDescriptor.endsTextureCoordBottom)
        magicTexture:SetHidden(false)
        magicTexture:SetTexture(string.format(ANTIQUITY_CODEX_MAGIC_TEXTURE_FORMATTER, sizeDescriptor.imageQualifier))
        magicTexture.sparkleTimeline:PlayFromStart()
        magicTexture.flowTimeline:GetFirstAnimation():SetBaseTextureCoords(0, 1, 0, sizeDescriptor.textureCoordBottom)
        magicTexture.flowTimeline:PlayFromStart()
    else
        leftEndTexture:SetHidden(true)
        rightEndTexture:SetHidden(true)
        magicTexture:SetHidden(true)
        magicTexture.sparkleTimeline:Stop()
        magicTexture.flowTimeline:Stop()
    end
    
    control.titleLabel:SetHorizontalAlignment(titleAlignment)
    control.titleLabel:SetHidden(not loreEntryData.unlocked)
    control.bodyLabel:SetHidden(not loreEntryData.unlocked)
    control:SetHeight(sizeDescriptor.textureHeight)
    control:SetParent(parentControl)
    return control
end
function ZO_AntiquityLoreDocument_Manager:ReleaseAllObjects(parentControl)
    local metaPool = self.wideControlAcquisitionDescriptor.metaPools[parentControl]
    if metaPool then
        metaPool:ReleaseAllObjects()
    end
    local metaPool = self.standardControlAcquisitionDescriptor.metaPools[parentControl]
    if metaPool then
        metaPool:ReleaseAllObjects()
    end
end
    local easedProgress = ZO_EaseInCubic(progress)
    local animatedControl = control:GetAnimatedControl()
    animatedControl.backgroundTexture:SetTextureSampleProcessingWeight(TEX_SAMPLE_PROCESSING_WEIGHT_RGB, zo_lerp(0.4, 1.5, easedProgress))
    local drawLayer = progress > 0 and DL_CONTROLS or DL_BACKGROUND
    animatedControl:SetDrawLayer(drawLayer)
    animatedControl.backgroundTexture:SetDrawLayer(drawLayer)
end
ANTIQUITY_LORE_DOCUMENT_MANAGER = ZO_AntiquityLoreDocument_Manager:New()