Back to Home

ESO Lua File v101041

ingame/zonestories/zonestorytracker.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
local ZoneStoryTracker = ZO_HUDTracker_Base:Subclass()
function ZoneStoryTracker:New(...)
    return ZO_HUDTracker_Base.New(self, ...)
end
function ZoneStoryTracker:Initialize(control)
    ZO_HUDTracker_Base.Initialize(self, control)
    self.iconControl = self.container:GetNamedChild("Icon")
    ZONE_STORY_TRACKER_FRAGMENT = self:GetFragment()
end
function ZoneStoryTracker:InitializeStyles()
    self.styles =
    {
        keyboard =
        {
            FONT_HEADER = "ZoFontGameShadow",
            FONT_SUBLABEL = "ZoFontGameShadow",
            TEXT_TYPE_HEADER = MODIFY_TEXT_TYPE_NONE,
            TOP_LEVEL_PRIMARY_ANCHOR_TO_QUEST_TRACKER = ZO_Anchor:New(TOPLEFT, ZO_FocusedQuestTrackerPanelContainerQuestContainer, BOTTOMLEFT, 0, 10),
            -- The quest timer anchors are very old and bizarre and they screw everything up
            -- So these anchors match what the quest tracker normally does. If we get the time to redo quest timer/tracker in a not insane way, we should fix this
            -- Everything else should anchor to the bottom of the activity tracker, cause it got all the hard stuff out of the way and made it intuitive from here on
            TOP_LEVEL_PRIMARY_ANCHOR_TO_QUEST_TIMER = ZO_Anchor:New(TOPLEFT, ZO_FocusedQuestTrackerPanelTimerAnchor, BOTTOMLEFT, 35, 10),
            TOP_LEVEL_SECONDARY_ANCHOR = ZO_Anchor:New(RIGHT, GuiRoot, RIGHT, 0, 10, ANCHOR_CONSTRAINS_X),
            CONTAINER_PRIMARY_ANCHOR = ZO_Anchor:New(TOPLEFT),
            CONTAINER_SECONDARY_ANCHOR = ZO_Anchor:New(TOPRIGHT),
            SUBLABEL_PRIMARY_ANCHOR_OFFSET_Y = 2,
        },
        gamepad =
        {
            FONT_HEADER = "ZoFontGamepadBold27",
            FONT_SUBLABEL = "ZoFontGamepad34",
            TEXT_TYPE_HEADER = MODIFY_TEXT_TYPE_UPPERCASE,
            TOP_LEVEL_PRIMARY_ANCHOR_TO_QUEST_TRACKER = ZO_Anchor:New(TOPRIGHT, ZO_FocusedQuestTrackerPanelContainerQuestContainer, BOTTOMRIGHT, 0, 20),
            TOP_LEVEL_PRIMARY_ANCHOR_TO_QUEST_TIMER = ZO_Anchor:New(TOPRIGHT, ZO_FocusedQuestTrackerPanelTimerAnchor, BOTTOMRIGHT, -44, 20),
            CONTAINER_PRIMARY_ANCHOR = ZO_Anchor:New(TOPRIGHT),
            SUBLABEL_PRIMARY_ANCHOR_OFFSET_Y = 10,
        }
    }
    ZO_HUDTracker_Base.InitializeStyles(self)
end
function ZoneStoryTracker:RegisterEvents()
    ZO_HUDTracker_Base.RegisterEvents(self)
    local function Update()
        self:Update()
    end
    self.control:RegisterForEvent(EVENT_ZONE_STORY_ACTIVITY_TRACKED, Update)
    self.control:RegisterForEvent(EVENT_ZONE_STORY_ACTIVITY_UNTRACKED, Update)
    self.control:RegisterForEvent(EVENT_ZONE_STORY_ACTIVITY_TRACKING_INIT, Update)
end
function ZoneStoryTracker:Update()
    local zoneId, completionType, activityId = GetTrackedZoneStoryActivityInfo()
    if zoneId ~= 0 then
        local data = ZONE_STORIES_MANAGER:GetZoneData(zoneId)
        local subLabelText = GetZoneStoryShortDescriptionByActivityId(zoneId, completionType, activityId)
        self:SetHeaderText(ZO_CachedStrFormat(SI_ZONE_STORY_TRACKER_TITLE, data.name))
        self:SetSubLabelText(subLabelText)
    end
end
function ZoneStoryTracker:GetPrimaryAnchor()
    local style = self.currentStyle
    if FOCUSED_QUEST_TRACKER_FRAGMENT:IsShowing() then
        return style.TOP_LEVEL_PRIMARY_ANCHOR_TO_QUEST_TRACKER
    else
        return style.TOP_LEVEL_PRIMARY_ANCHOR_TO_QUEST_TIMER
    end
end
function ZoneStoryTracker:GetSecondaryAnchor()
    return self.currentStyle.TOP_LEVEL_SECONDARY_ANCHOR
end
function ZoneStoryTracker:SetHidden(isHidden)
    ZO_HUDTracker_Base.SetHidden(self, isHidden)
    self.iconControl:SetHidden(isHidden)
end
    ZONE_STORY_TRACKER = ZoneStoryTracker:New(control)
end