-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbrFishing.lua
More file actions
49 lines (42 loc) · 1.36 KB
/
brFishing.lua
File metadata and controls
49 lines (42 loc) · 1.36 KB
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
---@type _,br,_
local _,br,_ = ...
---@type br.Logging, br.Settings
local Log,Settings = br.Logging,br.Settings
---@class br.Fishing
local Fishing = {}
Fishing.Active = false
function Fishing:Fish()
local player = br.ActivePlayer
if player.InCombat then
Log:Log("Cannot fish while in combat.")
self.Active = false
return
end
local name, text, texture, startTimeMS, endTimeMS, isTradeSkill, notInterruptible, spellId = br.api.UnitChannelInfo("player")
if name == nil then
---@type SpellInfo
local spellName = C_Spell.GetSpellInfo(131474) -- 131474 is the spell ID for "Fishing"
Log:LogCast(spellName.name)
br.CastSpellByName(spellName.name)
end
local callbackTime = math.random(2000,3000)/1000
C_Timer.After(callbackTime, function()
if self.Active then
self:Fish()
end
end)
end
local g = CreateFrame("Frame")
g:RegisterEvent("LOOT_BIND_CONFIRM")
g:RegisterEvent("EQUIP_BIND_CONFIRM")
g:SetScript("OnEvent", function(self, event, id)
if event == "LOOT_BIND_CONFIRM" then
Log:Log(" Loot Bind Confirmed for ID: " .. tostring(id))
local callbackTime = math.random(200,400)/1000
C_Timer.After(callbackTime, function()
ConfirmLootSlot(id)
end)
end
end)
br.Fishing = Fishing
Log:Log("BR Fishing module loaded")