-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstatisticMessages.lua
80 lines (68 loc) · 1.94 KB
/
statisticMessages.lua
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
--[[
Defines the Omnified game statistic messaging schema.
Written By: Matt Weber (https://badecho.com) (https://twitch.tv/omni)
Copyright 2024 Bad Echo LLC
Bad Echo Technologies are licensed under the
GNU Affero General Public License v3.0.
See accompanying file LICENSE.md or a copy at:
https://www.gnu.org/licenses/agpl-3.0.html
--]]
require("utility")
StatisticType = defineEnum {
"Whole",
"Fractional",
"Coordinate",
"Group"
}
function WholeStatistic(name, value, isCritical, format)
local wholeStatistic = {
Type = StatisticType.Whole,
Statistic = {
Name = name,
IsCritical = isCritical,
Format = format,
Value = value
}
}
return wholeStatistic
end
function FractionalStatistic(name, currentValue, maximumValue, primaryBarColor, secondaryBarColor, isHidden)
local isHidden = (isHidden == true)
local fractionalStatistic = {
Type = StatisticType.Fractional,
Statistic = {
Name = name,
CurrentValue = currentValue,
MaximumValue = maximumValue,
PrimaryBarColor = primaryBarColor,
SecondaryBarColor = secondaryBarColor,
IsHidden = isHidden
}
}
return fractionalStatistic
end
function CoordinateStatistic(name, x, y, z, isHidden)
local isHidden = (isHidden == true)
local coordinateStatistic = {
Type = StatisticType.Coordinate,
Statistic = {
Name = name,
Format = "{0:0.000}",
X = x,
Y = y,
Z = z,
IsHidden = isHidden
}
}
return coordinateStatistic
end
function StatisticGroup(name, statistics)
local statisticGroup = {
Type = StatisticType.Group,
Statistic = {
Name = name,
Statistics = statistics
}
}
return statisticGroup
end