Back to Home

ESO Lua File v101036

ingame/companion/companion_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
-----------------------------
-- Companion Manager
-----------------------------
ZO_Companion_Manager = ZO_InitializingCallbackObject:Subclass()
function ZO_Companion_Manager:Initialize()
    self.companionInteraction =
    {
        type = "Companion",
        interactTypes = { INTERACTION_COMPANION_MENU },
    }
    -- Shared search for companion equipment
    local filterTargetDescriptor =
    {
        [BACKGROUND_LIST_FILTER_TARGET_BAG_SLOT] =
        {
            searchFilterList =
            {
                BACKGROUND_LIST_FILTER_TYPE_NAME,
            },
            primaryKeys =
            {
                BAG_BACKPACK,
                BAG_COMPANION_WORN,
            }
        },
    }
    TEXT_SEARCH_MANAGER:SetupContextTextSearch("companionEquipmentTextSearch", filterTargetDescriptor)
end
function ZO_Companion_Manager:GetInteraction()
    return self.companionInteraction
end
function ZO_Companion_Manager:GetLevelInfo()
    --The companion's current level and the amount of experience the companion has earned at that level
    local level, currentXpInLevel = GetActiveCompanionLevelInfo()
    --The total amount of experience required to go from the current level to the next
    local totalXpInLevel = GetNumExperiencePointsInCompanionLevel(level + 1) or 0
    local isMaxLevel = totalXpInLevel == 0
    return level, currentXpInLevel, totalXpInLevel, isMaxLevel
end
function ZO_Companion_Manager:GetActiveCompanionIcon()
    local companionId = GetActiveCompanionDefId()
    local collectibleId = GetCompanionCollectibleId(companionId)
    return GetCollectibleIcon(collectibleId)
end
function ZO_Companion_Manager:GetActiveCompanionPassivePerkAbilityId()
    local companionId = GetActiveCompanionDefId()
    return GetCompanionPassivePerkAbilityId(companionId)
end
ZO_COMPANION_MANAGER = ZO_Companion_Manager:New()
    return HasActiveCompanion() or HasBlockedCompanion()
end