-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.lua
More file actions
68 lines (56 loc) · 2.19 KB
/
utils.lua
File metadata and controls
68 lines (56 loc) · 2.19 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
local SetTimeout = SetTimeout
local World3dToScreen2d = World3dToScreen2d
local SetTextScale = SetTextScale
local SetTextCentre = SetTextCentre
local SetTextDropShadow = SetTextDropShadow
local SetTextColour = SetTextColour
local SetTextOutline = SetTextOutline
local SetTextEntry = SetTextEntry
local AddTextComponentString = AddTextComponentString
local DrawText = DrawText
function CombatLog:_stateNotification(count)
self:_countNotification(count)
if not Config.ShowStateNotification then return end
local stateText = count and locale("combatlog_enabled") or locale("combatlog_disabled")
local stateType = count and "success" or "error"
lib.notify({
title = locale("combatlog_title"),
description = stateText,
type = stateType,
icon = "person",
})
end
local lastSeconds = Config.Cache.Duration // 1000
function CombatLog:_countNotification(count)
if not Config.ShowCountNotification then return end
if not count then return end
SetTimeout(Config.CountDelay, function()
local countText = locale("combatlog_found_count", count, Config.Cache.Distance, lastSeconds)
lib.notify({
title = locale("combatlog_title"),
description = countText,
type = "info",
icon = "person",
})
end)
end
local fontText = ("<font face='%s'>%s</font>"):format(Config.TextStyle.CustomFont.Name, "%s")
local r, g, b, a = table.unpack(Config.TextStyle.Color)
function CombatLog:_draw3dText(data, distance)
local onScreen, screenX, screenY = World3dToScreen2d(data.coords.x, data.coords.y, data.coords.z)
if not onScreen then return end
local text = Config.TextStyle.CustomFont.Enabled and fontText:format(data.text) or data.text
local scale = Config.TextStyle.Scale * (1.0 - (distance / Config.Display.Distance) * 0.5)
scale = lib.math.clamp(scale, Config.TextStyle.Scale * 0.5, Config.TextStyle.Scale)
SetTextScale(scale, scale)
SetTextCentre(1)
SetTextDropShadow()
SetTextColour(r, g, b, a)
if Config.TextStyle.Outline then
SetTextOutline()
end
SetTextEntry("string")
AddTextComponentString(text)
DrawText(screenX, screenY)
return true
end