Back to Home

ESO Lua File v101042

ingame/housingeditor/gamepad/housingfurnitureretrieval_gamepad.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
ZO_HousingFurnitureRetrieval_Gamepad = ZO_HousingFurnitureList_Gamepad:Subclass()
function ZO_HousingFurnitureRetrieval_Gamepad:New(...)
    return ZO_HousingFurnitureList_Gamepad.New(self, ...)
end
function ZO_HousingFurnitureRetrieval_Gamepad:Initialize(...)
    ZO_HousingFurnitureList_Gamepad.Initialize(self, ...)
    SHARED_FURNITURE:RegisterCallback("RetrievableFurnitureChanged", function(fromSearch)
        if fromSearch then
            self:ResetSavedPositions()
        end
    end)
end
function ZO_HousingFurnitureRetrieval_Gamepad:InitializeKeybindStripDescriptors()
    ZO_HousingFurnitureList_Gamepad.InitializeKeybindStripDescriptors(self)
        order = 0,
        name = GetString(SI_HOUSING_EDITOR_MODIFY),
        keybind = "UI_SHORTCUT_PRIMARY",
        callback = function()
            local targetData = self.furnitureList.list:GetTargetData()
            if targetData.furnitureObject:GetDataType() == ZO_HOUSING_PATH_NODE_DATA_TYPE then
                ZO_HousingFurnitureBrowser_Base.SelectNodeForReplacement(targetData.furnitureObject)
            else
                ZO_HousingFurnitureBrowser_Base.SelectFurnitureForReplacement(targetData.furnitureObject)
            end
            SCENE_MANAGER:HideCurrentScene()
        end,
        visible = function()
            local targetData = self.furnitureList.list:GetTargetData()
            if not targetData then
                return false
            end
            return HOUSING_EDITOR_STATE:CanLocalPlayerEditHouse()
        end,
    })
        order = 1,
        name = GetString(SI_HOUSING_EDITOR_PRECISION_EDIT),
        keybind = "UI_SHORTCUT_QUINARY",
        callback = function()
            local targetData = self.furnitureList.list:GetTargetData()
            if targetData.furnitureObject:GetDataType() == ZO_HOUSING_PATH_NODE_DATA_TYPE then
                ZO_HousingFurnitureBrowser_Base.SelectNodeForPrecisionEdit(targetData.furnitureObject)
            else
                ZO_HousingFurnitureBrowser_Base.SelectFurnitureForPrecisionEdit(targetData.furnitureObject)
            end
            SCENE_MANAGER:HideCurrentScene()
        end,
        visible = function()
            local targetData = self.furnitureList.list:GetTargetData()
            if not targetData then
                return false
            end
            return HOUSING_EDITOR_STATE:CanLocalPlayerEditHouse()
        end,
    })
        order = 4,
        name = function()
            local targetData = self.furnitureList.list:GetTargetData()
            if targetData.furnitureObject:GetDataType() == ZO_HOUSING_PATH_NODE_DATA_TYPE then
                return GetString(SI_HOUSING_EDITOR_PATH_REMOVE_NODE)
            else
                return GetString(SI_HOUSING_EDITOR_PUT_AWAY)
            end
        end,
        keybind = "UI_SHORTCUT_SECONDARY",
        callback = function()
            local targetData = self.furnitureList.list:GetTargetData()
            if targetData.furnitureObject:GetDataType() == ZO_RECALLABLE_HOUSING_DATA_TYPE then
                ZO_HousingFurnitureBrowser_Base.PutAwayFurniture(targetData.furnitureObject)
            else
                ZO_HousingFurnitureBrowser_Base.PutAwayNode(targetData.furnitureObject)
            end
        end,
        visible = function()
            local targetData = self.furnitureList.list:GetTargetData()
            if not targetData then
                return false
            end
            if targetData.furnitureObject:GetDataType() == ZO_HOUSING_PATH_NODE_DATA_TYPE then
                return HOUSING_EDITOR_STATE:CanLocalPlayerEditHouse()
            else
                return HOUSING_EDITOR_STATE:IsLocalPlayerHouseOwner()
            end
        end,
    })
        order = 6,
        name = GetString(SI_WORLD_MAP_ACTION_SET_PLAYER_WAYPOINT),
        keybind = "UI_SHORTCUT_RIGHT_STICK",
        callback = function()
            local targetData = self.furnitureList.list:GetTargetData()
            SHARED_FURNITURE:SetPlayerWaypointTo(targetData.furnitureObject)
        end,
        enabled = function()
            local targetData = self.furnitureList.list:GetTargetData()
            if not targetData then
                return false
            end
            local dataType = targetData.furnitureObject:GetDataType()
            return dataType == ZO_RECALLABLE_HOUSING_DATA_TYPE or dataType == ZO_HOUSING_PATH_NODE_DATA_TYPE
        end,
    })
        order = 5,
        name = GetString(SI_HOUSING_FURNITURE_SET_STARTING_NODE),
        keybind = "UI_SHORTCUT_QUATERNARY",
        callback = function()
            local targetData = self.furnitureList.list:GetTargetData()
            ZO_HousingFurnitureBrowser_Base.SetAsStartingNode(targetData.furnitureObject)
        end,
        visible = function()
            local targetData = self.furnitureList.list:GetTargetData()
            return targetData and targetData.furnitureObject:GetDataType() == ZO_HOUSING_PATH_NODE_DATA_TYPE and not targetData.furnitureObject:IsStartingPathNode() and HOUSING_EDITOR_STATE:CanLocalPlayerEditHouse()
        end,
    })
end
--Overridden from ZO_HousingFurnitureList_Gamepad
function ZO_HousingFurnitureRetrieval_Gamepad:InitializeOptionsDialogLayoutInfo()
    self.optionsDialogLayoutInfo =
    {
        dialogName = "GAMEPAD_FURNITURE_RETRIEVAL_OPTIONS",
        boundFilterEnabled = true,
        locationFilterEnabled = false,
        limitFilterEnabled = true,
        getFiltersFunction = function()
            local boundFilters = SHARED_FURNITURE:GetRetrievableFurnitureBoundFilters()
            local locationFilters = nil
            local limitFilters = SHARED_FURNITURE:GetRetrievableFurnitureLimitFilters()
            return boundFilters, locationFilters, limitFilters
        end,
        updateFiltersHandler = function(boundFilterValues, locationFilterValues, limitFilterValues)
            SHARED_FURNITURE:SetRetrievableFurnitureFilters(boundFilterValues, limitFilterValues)
        end,
    }
end
--Overridden from ZO_HousingFurnitureList_Gamepad
function ZO_HousingFurnitureRetrieval_Gamepad:GetCategoryTreeDataRoot()
    return SHARED_FURNITURE:GetRetrievableFurnitureCategoryTreeData()
end
--Overridden from ZO_HousingFurnitureList_Gamepad
function ZO_HousingFurnitureRetrieval_Gamepad:GetNoItemText()
    if SHARED_FURNITURE:DoesPlayerHaveRetrievableFurniture() then
        return GetString(SI_HOUSING_FURNITURE_NO_SEARCH_RESULTS)
    else
        return GetString(SI_HOUSING_FURNITURE_NO_RETRIEVABLE_FURNITURE)
    end
end
--Overridden from ZO_HousingFurnitureList_Gamepad
function ZO_HousingFurnitureRetrieval_Gamepad:CompareFurnitureEntries(a, b)
    return a:CompareTo(b)
end