Back to Home

ESO Lua File v100026

ingame/fishing/fishing.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
ZO_Fishing = ZO_InteractiveRadialMenuController:Subclass()
function ZO_Fishing:New(...)
    return ZO_InteractiveRadialMenuController.New(self, ...)
end
-- Overridden from base
function ZO_Fishing:PrepareForInteraction()
    if not SCENE_MANAGER:IsInUIMode() then
        local additionalInfo = select(5, GetGameCameraInteractableActionInfo())
        if additionalInfo == ADDITIONAL_INTERACT_INFO_FISHING_NODE then
            if GetFishingLure() == 0 then
                self:ShowMenu()
            end
            return true
        end
    end
    return false
end
function ZO_Fishing:SetupEntryControl(entryControl, lureIndex)
    local selected = lureIndex == GetFishingLure()
    local _, _, stackCount = GetFishingLureInfo(lureIndex)
    ZO_SetupSelectableItemRadialMenuEntryTemplate(entryControl, selected, stackCount > 0 and stackCount or nil)
end
function ZO_Fishing:PopulateMenu()
    for i=1, GetNumFishingLures() do
        local name, icon, stack = GetFishingLureInfo(i)
        if stack > 0 then
            self.menu:AddEntry(zo_strformat(SI_TOOLTIP_ITEM_NAME, name), icon, icon, function() SetFishingLure(i) end, i)
        else
            self.menu:AddEntry(GetString(SI_NO_BAIT_IN_SLOT), "EsoUI/Art/Fishing/bait_emptySlot.dds", "EsoUI/Art/Fishing/bait_emptySlot.dds", nil, i)
        end
    end
end
--Fishing Manager
local FishingManager = ZO_Object:Subclass()
function FishingManager:New()
    return ZO_Object.New(self)
end
function FishingManager:StartInteraction()
    self.gamepad = IsInGamepadPreferredMode()
    if self.gamepad then
        return FISHING_GAMEPAD:StartInteraction()
    else
        return FISHING_KEYBOARD:StartInteraction()
    end
end
function FishingManager:StopInteraction()
    if self.gamepad then
        return FISHING_GAMEPAD:StopInteraction()
    else
        return FISHING_KEYBOARD:StopInteraction()
    end
end
FISHING_MANAGER = FishingManager:New()