Back to Home

ESO Lua File v100032

ingame/map/keyboard/worldmapquests_keyboard.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
local WorldMapQuests = ZO_WorldMapQuests_Shared:Subclass()
local QUEST_DATA = 1
function WorldMapQuests:New(...)
    local object = ZO_WorldMapQuests_Shared.New(self, ...)
    return object
end
function WorldMapQuests:Initialize(control)
    ZO_WorldMapQuests_Shared.Initialize(self, control)
    self.control = control
    self.noQuestsLabel = control:GetNamedChild("NoQuests")
    self.headerPool = ZO_ControlPool:New("ZO_WorldMapQuestHeader", control:GetNamedChild("PaneScrollChild"), "Header")
    WORLD_MAP_QUESTS_FRAGMENT = ZO_FadeSceneFragment:New(control)
    FOCUSED_QUEST_TRACKER:RegisterCallback("QuestTrackerAssistStateChanged", function(...) self:RefreshHeaders() end)
end
function WorldMapQuests:LayoutList()
    
    local prevHeader
    self.headerPool:ReleaseAllObjects()
    for i, data in ipairs(self.data.masterList) do
        local header = self.headerPool:AcquireObject(i)
        if(prevHeader) then
            header:SetAnchor(TOPLEFT, prevHeader, BOTTOMLEFT, 0, 4)
        else
            header:SetAnchor(TOPLEFT, nil, TOPLEFT, 0, 0)
        end
        prevHeader = header
    end
    self:RefreshHeaders()
end
function WorldMapQuests:RefreshHeaders()
    for i, header in ipairs(self.headerPool:GetActiveObjects()) do
        self:SetupQuestHeader(header, self.data.masterList[i])
    end
end
function WorldMapQuests:SetupQuestHeader(control, data)
    if (data == nil) then return end
    --Quest Name
    local nameControl = GetControl(control, "Name")
    nameControl:SetText(data.name)
    ZO_SelectableLabel_SetNormalColor(nameControl, ZO_ColorDef:New(GetColorForCon(GetCon(data.level))))
        
    --Assisted State
    local isAssisted = FOCUSED_QUEST_TRACKER:IsTrackTypeAssisted(TRACK_TYPE_QUEST, data.questIndex)
    local assistedTexture = GetControl(control, "AssistedIcon")
    assistedTexture:SetHidden(not isAssisted)
    control.data = data
    local nameWidth, nameHeight = nameControl:GetTextDimensions()
    control:SetHeight(zo_max(24, nameHeight))
end
function WorldMapQuests:QuestHeader_OnClicked(header, button)
    if button == MOUSE_BUTTON_INDEX_LEFT then
        local data = header.data
        ZO_WorldMap_PanToQuest(data.questIndex)
        ZO_ZoneStories_Manager.StopZoneStoryTracking()
        FOCUSED_QUEST_TRACKER:ForceAssist(data.questIndex)
    end
end
function WorldMapQuests:QuestHeader_OnMouseEnter(header)
    InitializeTooltip(ZO_MapQuestDetailsTooltip, header, RIGHT, -25)
    ZO_MapQuestDetailsTooltip:SetQuest(header.data.questIndex)
end
--Local XML
    WORLD_MAP_QUESTS:QuestHeader_OnMouseEnter(header)
end
    ClearTooltip(ZO_MapQuestDetailsTooltip)
end
    local name = GetControl(header, "Name")
    name:SetAnchor(TOPLEFT, nil, TOPLEFT, 26, 2)
end
    local name = GetControl(header, "Name")
    name:SetAnchor(TOPLEFT, nil, TOPLEFT, 26, 0)
    WORLD_MAP_QUESTS:QuestHeader_OnClicked(header, button)
end
--Global XML
    WORLD_MAP_QUESTS = WorldMapQuests:New(self)
end
--Quest Tooltip
-------------------
do
    local function SetQuest(self, questIndex)
        local labels, width = ZO_WorldMapQuests_Shared_SetupQuestDetails(self, questIndex)
        for i = 1, #labels do
            local label = labels[i]
            label:SetWidth(width)
            self:AddControl(label)
            label:SetAnchor(CENTER)
            self:AddVerticalPadding(-8)
        end
    end
        self.labelPool:ReleaseAllObjects()
    end
        self.labelPool = ZO_ControlPool:New("ZO_MapQuestDetailsCondition", self, "Label")
        self.SetQuest = SetQuest
    end
end