@quenty/elo 7.19.3 → 7.19.4-canary.11a5dcf.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.19.4-canary.11a5dcf.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/elo@7.19.3...@quenty/elo@7.19.4-canary.11a5dcf.0) (2025-05-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/elo
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [7.19.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/elo@7.19.2...@quenty/elo@7.19.3) (2025-04-10)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @quenty/elo
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/elo",
|
|
3
|
-
"version": "7.19.
|
|
3
|
+
"version": "7.19.4-canary.11a5dcf.0",
|
|
4
4
|
"description": "Elo rating utility library.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@quenty/blend": "
|
|
33
|
-
"@quenty/loader": "
|
|
34
|
-
"@quenty/maid": "
|
|
32
|
+
"@quenty/blend": "12.18.4-canary.11a5dcf.0",
|
|
33
|
+
"@quenty/loader": "10.8.4-canary.11a5dcf.0",
|
|
34
|
+
"@quenty/maid": "3.4.4-canary.11a5dcf.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@quenty/probability": "
|
|
37
|
+
"@quenty/probability": "2.3.1"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "11a5dcf7d4c7a0bfbf3337e97d30e8346ea09d3f"
|
|
40
40
|
}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
]=]
|
|
5
5
|
|
|
6
6
|
return table.freeze(setmetatable({
|
|
7
|
-
PLAYER_ONE_WIN = 1
|
|
8
|
-
DRAW = 0.5
|
|
9
|
-
PLAYER_TWO_WIN = 0
|
|
7
|
+
PLAYER_ONE_WIN = 1,
|
|
8
|
+
DRAW = 0.5,
|
|
9
|
+
PLAYER_TWO_WIN = 0,
|
|
10
10
|
}, {
|
|
11
11
|
__index = function()
|
|
12
12
|
error("Bad index onto EloMatchResult")
|
|
13
|
-
end
|
|
14
|
-
}))
|
|
13
|
+
end,
|
|
14
|
+
}))
|
|
@@ -27,7 +27,7 @@ end
|
|
|
27
27
|
@param eloMatchResultList any
|
|
28
28
|
@return boolean
|
|
29
29
|
]=]
|
|
30
|
-
function EloMatchResultUtils.isEloMatchResultList(eloMatchResultList: {number }): boolean
|
|
30
|
+
function EloMatchResultUtils.isEloMatchResultList(eloMatchResultList: { number }): boolean
|
|
31
31
|
if type(eloMatchResultList) ~= "table" then
|
|
32
32
|
return false
|
|
33
33
|
end
|
|
@@ -41,4 +41,4 @@ function EloMatchResultUtils.isEloMatchResultList(eloMatchResultList: {number })
|
|
|
41
41
|
return true
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
return EloMatchResultUtils
|
|
44
|
+
return EloMatchResultUtils
|
package/src/Shared/EloUtils.lua
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
@class EloUtils.spec.lua
|
|
4
4
|
]]
|
|
5
5
|
|
|
6
|
-
local require =
|
|
6
|
+
local require =
|
|
7
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
7
8
|
|
|
8
9
|
local EloMatchResult = require("EloMatchResult")
|
|
9
10
|
local EloUtils = require("EloUtils")
|
|
@@ -24,39 +25,27 @@ describe("EloUtils.getNewElo", function()
|
|
|
24
25
|
local newPlayerDrawRating, newOpponentDrawRating
|
|
25
26
|
|
|
26
27
|
it("should change on win", function()
|
|
27
|
-
newPlayerWinRating, newOpponentWinRating = EloUtils.getNewElo(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
opponentRating,
|
|
31
|
-
{
|
|
32
|
-
EloMatchResult.PLAYER_ONE_WIN;
|
|
33
|
-
})
|
|
28
|
+
newPlayerWinRating, newOpponentWinRating = EloUtils.getNewElo(config, playerRating, opponentRating, {
|
|
29
|
+
EloMatchResult.PLAYER_ONE_WIN,
|
|
30
|
+
})
|
|
34
31
|
|
|
35
32
|
expect(newPlayerWinRating > playerRating).toBe(true)
|
|
36
33
|
expect(newOpponentWinRating < opponentRating).toBe(true)
|
|
37
34
|
end)
|
|
38
35
|
|
|
39
36
|
it("should change on a loss", function()
|
|
40
|
-
newPlayerLossRating, newOpponentLossRating = EloUtils.getNewElo(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
opponentRating,
|
|
44
|
-
{
|
|
45
|
-
EloMatchResult.PLAYER_TWO_WIN;
|
|
46
|
-
})
|
|
37
|
+
newPlayerLossRating, newOpponentLossRating = EloUtils.getNewElo(config, playerRating, opponentRating, {
|
|
38
|
+
EloMatchResult.PLAYER_TWO_WIN,
|
|
39
|
+
})
|
|
47
40
|
|
|
48
41
|
expect(newPlayerLossRating < playerRating).toBe(true)
|
|
49
42
|
expect(newOpponentLossRating > opponentRating).toBe(true)
|
|
50
43
|
end)
|
|
51
44
|
|
|
52
45
|
it("should change on a draw", function()
|
|
53
|
-
newPlayerDrawRating, newOpponentDrawRating = EloUtils.getNewElo(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
opponentRating,
|
|
57
|
-
{
|
|
58
|
-
EloMatchResult.DRAW;
|
|
59
|
-
})
|
|
46
|
+
newPlayerDrawRating, newOpponentDrawRating = EloUtils.getNewElo(config, playerRating, opponentRating, {
|
|
47
|
+
EloMatchResult.DRAW,
|
|
48
|
+
})
|
|
60
49
|
|
|
61
50
|
expect(newPlayerDrawRating > playerRating).toBe(true)
|
|
62
51
|
expect(newOpponentDrawRating < opponentRating).toBe(true)
|
|
@@ -68,7 +57,7 @@ describe("EloUtils.getNewElo", function()
|
|
|
68
57
|
local lossChange = math.abs(playerRating - newPlayerLossRating)
|
|
69
58
|
|
|
70
59
|
expect(winChange > lossChange).toBe(true)
|
|
71
|
-
expect(winChange > drawChange
|
|
60
|
+
expect(winChange > drawChange).toBe(true)
|
|
72
61
|
expect(drawChange > lossChange).toBe(true)
|
|
73
62
|
end)
|
|
74
63
|
|
|
@@ -77,4 +66,4 @@ describe("EloUtils.getNewElo", function()
|
|
|
77
66
|
|
|
78
67
|
expect(percentile).toBeCloseTo(0.5, 5)
|
|
79
68
|
end)
|
|
80
|
-
end)
|
|
69
|
+
end)
|
|
@@ -2,120 +2,122 @@
|
|
|
2
2
|
@class EloUtils.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
|
-
local Maid = require("Maid")
|
|
8
8
|
local Blend = require("Blend")
|
|
9
9
|
local EloUtils = require("EloUtils")
|
|
10
|
+
local Maid = require("Maid")
|
|
10
11
|
|
|
11
12
|
local function TextLabel(props)
|
|
12
13
|
return Blend.New "TextLabel" {
|
|
13
|
-
Size = props.Size
|
|
14
|
-
TextXAlignment = props.TextXAlignment
|
|
15
|
-
TextYAlignment = props.TextYAlignment
|
|
16
|
-
BackgroundTransparency = 1
|
|
17
|
-
Font = Enum.Font.FredokaOne
|
|
18
|
-
AnchorPoint = props.AnchorPoint
|
|
19
|
-
Position = props.Position
|
|
20
|
-
TextColor3 = props.TextColor3
|
|
21
|
-
TextSize = props.TextSize or 20
|
|
22
|
-
Text = props.Text
|
|
23
|
-
RichText = props.RichText
|
|
14
|
+
Size = props.Size,
|
|
15
|
+
TextXAlignment = props.TextXAlignment,
|
|
16
|
+
TextYAlignment = props.TextYAlignment,
|
|
17
|
+
BackgroundTransparency = 1,
|
|
18
|
+
Font = Enum.Font.FredokaOne,
|
|
19
|
+
AnchorPoint = props.AnchorPoint,
|
|
20
|
+
Position = props.Position,
|
|
21
|
+
TextColor3 = props.TextColor3,
|
|
22
|
+
TextSize = props.TextSize or 20,
|
|
23
|
+
Text = props.Text,
|
|
24
|
+
RichText = props.RichText,
|
|
24
25
|
}
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
local function MatchResultCard(props)
|
|
28
29
|
return Blend.New "Frame" {
|
|
29
|
-
Name = "MatchResultCard"
|
|
30
|
-
Size = UDim2.new(0, 140, 0, 0)
|
|
31
|
-
AutomaticSize = Enum.AutomaticSize.Y
|
|
32
|
-
BackgroundTransparency = 1
|
|
30
|
+
Name = "MatchResultCard",
|
|
31
|
+
Size = UDim2.new(0, 140, 0, 0),
|
|
32
|
+
AutomaticSize = Enum.AutomaticSize.Y,
|
|
33
|
+
BackgroundTransparency = 1,
|
|
33
34
|
|
|
34
35
|
TextLabel {
|
|
35
|
-
Name = "PlayerLabel"
|
|
36
|
-
Size = UDim2.new(1, 0, 0, 30)
|
|
37
|
-
TextXAlignment = Enum.TextXAlignment.Center
|
|
38
|
-
BackgroundTransparency = 1
|
|
39
|
-
TextSize = 25
|
|
36
|
+
Name = "PlayerLabel",
|
|
37
|
+
Size = UDim2.new(1, 0, 0, 30),
|
|
38
|
+
TextXAlignment = Enum.TextXAlignment.Center,
|
|
39
|
+
BackgroundTransparency = 1,
|
|
40
|
+
TextSize = 25,
|
|
40
41
|
TextColor3 = Blend.Computed(props.Change, function(change)
|
|
41
42
|
if change > 0 then
|
|
42
43
|
return Color3.fromRGB(61, 83, 60)
|
|
43
44
|
else
|
|
44
45
|
return Color3.fromRGB(103, 39, 39)
|
|
45
46
|
end
|
|
46
|
-
end)
|
|
47
|
+
end),
|
|
47
48
|
Text = Blend.Computed(props.OldElo, props.NewElo, props.IsWinner, function(oldElo, newElo, winner)
|
|
48
49
|
if winner then
|
|
49
50
|
return string.format("%d → %d", oldElo, newElo)
|
|
50
51
|
else
|
|
51
52
|
return string.format("%d → %d", oldElo, newElo)
|
|
52
53
|
end
|
|
53
|
-
end)
|
|
54
|
-
}
|
|
54
|
+
end),
|
|
55
|
+
},
|
|
55
56
|
|
|
56
57
|
Blend.New "Frame" {
|
|
57
|
-
Name = "Elo change"
|
|
58
|
+
Name = "Elo change",
|
|
58
59
|
BackgroundColor3 = Blend.Computed(props.Change, function(change)
|
|
59
60
|
if change > 0 then
|
|
60
61
|
return Color3.fromRGB(61, 83, 60)
|
|
61
62
|
else
|
|
62
63
|
return Color3.fromRGB(103, 39, 39)
|
|
63
64
|
end
|
|
64
|
-
end)
|
|
65
|
-
Size = UDim2.new(0, 60, 0, 30)
|
|
65
|
+
end),
|
|
66
|
+
Size = UDim2.new(0, 60, 0, 30),
|
|
66
67
|
|
|
67
68
|
Blend.New "UICorner" {
|
|
68
|
-
CornerRadius = UDim.new(0.5, 0)
|
|
69
|
-
}
|
|
69
|
+
CornerRadius = UDim.new(0.5, 0),
|
|
70
|
+
},
|
|
70
71
|
|
|
71
72
|
TextLabel {
|
|
72
|
-
Size = UDim2.new(1, 0, 0, 30)
|
|
73
|
-
BackgroundTransparency = 1
|
|
73
|
+
Size = UDim2.new(1, 0, 0, 30),
|
|
74
|
+
BackgroundTransparency = 1,
|
|
74
75
|
TextColor3 = Blend.Computed(props.Change, function(change)
|
|
75
76
|
if change > 0 then
|
|
76
77
|
return Color3.fromRGB(221, 255, 223)
|
|
77
78
|
else
|
|
78
79
|
return Color3.fromRGB(255, 219, 219)
|
|
79
80
|
end
|
|
80
|
-
end)
|
|
81
|
+
end),
|
|
81
82
|
Text = Blend.Computed(props.Change, function(change)
|
|
82
83
|
if change > 0 then
|
|
83
84
|
return string.format("+%d", change)
|
|
84
85
|
else
|
|
85
86
|
return string.format("%d", change)
|
|
86
87
|
end
|
|
87
|
-
end)
|
|
88
|
-
}
|
|
89
|
-
}
|
|
88
|
+
end),
|
|
89
|
+
},
|
|
90
|
+
},
|
|
90
91
|
|
|
91
92
|
Blend.New "UIListLayout" {
|
|
92
|
-
FillDirection = Enum.FillDirection.Vertical
|
|
93
|
-
HorizontalAlignment = Enum.HorizontalAlignment.Center
|
|
94
|
-
Padding = UDim.new(0, 5)
|
|
95
|
-
}
|
|
93
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
94
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
|
95
|
+
Padding = UDim.new(0, 5),
|
|
96
|
+
},
|
|
96
97
|
}
|
|
97
98
|
end
|
|
98
99
|
|
|
99
100
|
local function PlayerScoreChange(props)
|
|
100
|
-
local playerOneWin = EloUtils.countPlayerOneWins(props.MatchResults)
|
|
101
|
+
local playerOneWin = EloUtils.countPlayerOneWins(props.MatchResults)
|
|
102
|
+
> EloUtils.countPlayerTwoWins(props.MatchResults)
|
|
101
103
|
|
|
102
104
|
return Blend.New "Frame" {
|
|
103
|
-
Name = "PlayerScoreChange"
|
|
104
|
-
Size = UDim2.new(0, 0, 0, 0)
|
|
105
|
-
AutomaticSize = Enum.AutomaticSize.XY
|
|
106
|
-
BackgroundColor3 = Color3.new(0.9, 0.9, 0.9)
|
|
107
|
-
BackgroundTransparency = 0
|
|
105
|
+
Name = "PlayerScoreChange",
|
|
106
|
+
Size = UDim2.new(0, 0, 0, 0),
|
|
107
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
108
|
+
BackgroundColor3 = Color3.new(0.9, 0.9, 0.9),
|
|
109
|
+
BackgroundTransparency = 0,
|
|
108
110
|
|
|
109
111
|
Blend.New "UIPadding" {
|
|
110
|
-
PaddingTop = UDim.new(0, 10)
|
|
111
|
-
PaddingBottom = UDim.new(0, 10)
|
|
112
|
-
PaddingLeft = UDim.new(0, 10)
|
|
113
|
-
PaddingRight = UDim.new(0, 10)
|
|
114
|
-
}
|
|
112
|
+
PaddingTop = UDim.new(0, 10),
|
|
113
|
+
PaddingBottom = UDim.new(0, 10),
|
|
114
|
+
PaddingLeft = UDim.new(0, 10),
|
|
115
|
+
PaddingRight = UDim.new(0, 10),
|
|
116
|
+
},
|
|
115
117
|
|
|
116
118
|
Blend.New "UICorner" {
|
|
117
|
-
CornerRadius = UDim.new(0, 10)
|
|
118
|
-
}
|
|
119
|
+
CornerRadius = UDim.new(0, 10),
|
|
120
|
+
},
|
|
119
121
|
|
|
120
122
|
Blend.New "UIGradient" {
|
|
121
123
|
Color = Blend.Computed(playerOneWin, function(winner)
|
|
@@ -124,135 +126,142 @@ local function PlayerScoreChange(props)
|
|
|
124
126
|
else
|
|
125
127
|
return ColorSequence.new(Color3.fromRGB(255, 197, 197), Color3.fromRGB(208, 255, 194))
|
|
126
128
|
end
|
|
127
|
-
end)
|
|
128
|
-
}
|
|
129
|
+
end),
|
|
130
|
+
},
|
|
129
131
|
|
|
130
132
|
Blend.New "UIListLayout" {
|
|
131
|
-
FillDirection = Enum.FillDirection.Horizontal
|
|
132
|
-
VerticalAlignment = Enum.VerticalAlignment.Center
|
|
133
|
-
Padding = UDim.new(0, 5)
|
|
134
|
-
}
|
|
133
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
134
|
+
VerticalAlignment = Enum.VerticalAlignment.Center,
|
|
135
|
+
Padding = UDim.new(0, 5),
|
|
136
|
+
},
|
|
135
137
|
|
|
136
138
|
MatchResultCard({
|
|
137
|
-
IsWinner = playerOneWin
|
|
138
|
-
NewElo = props.PlayerOne.New
|
|
139
|
-
OldElo = props.PlayerOne.Old
|
|
140
|
-
Change = props.PlayerOne.New - props.PlayerOne.Old
|
|
141
|
-
})
|
|
139
|
+
IsWinner = playerOneWin,
|
|
140
|
+
NewElo = props.PlayerOne.New,
|
|
141
|
+
OldElo = props.PlayerOne.Old,
|
|
142
|
+
Change = props.PlayerOne.New - props.PlayerOne.Old,
|
|
143
|
+
}),
|
|
142
144
|
|
|
143
145
|
Blend.New "Frame" {
|
|
144
|
-
Name = "MatchResults"
|
|
145
|
-
Size = UDim2.new(0, 90, 0, 40)
|
|
146
|
-
BackgroundColor3 = Color3.fromRGB(185, 185, 185)
|
|
146
|
+
Name = "MatchResults",
|
|
147
|
+
Size = UDim2.new(0, 90, 0, 40),
|
|
148
|
+
BackgroundColor3 = Color3.fromRGB(185, 185, 185),
|
|
147
149
|
|
|
148
150
|
Blend.New "UICorner" {
|
|
149
|
-
CornerRadius = UDim.new(0.5, 0)
|
|
150
|
-
}
|
|
151
|
+
CornerRadius = UDim.new(0.5, 0),
|
|
152
|
+
},
|
|
151
153
|
|
|
152
154
|
TextLabel {
|
|
153
|
-
RichText = true
|
|
154
|
-
Size = UDim2.new(1, 0, 0, 30)
|
|
155
|
-
TextColor3 = Color3.fromRGB(24, 24, 24)
|
|
156
|
-
AnchorPoint = Vector2.new(0.5, 0.5)
|
|
157
|
-
Position = UDim2.fromScale(0.5, 0.5)
|
|
158
|
-
BackgroundTransparency = 1
|
|
155
|
+
RichText = true,
|
|
156
|
+
Size = UDim2.new(1, 0, 0, 30),
|
|
157
|
+
TextColor3 = Color3.fromRGB(24, 24, 24),
|
|
158
|
+
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
159
|
+
Position = UDim2.fromScale(0.5, 0.5),
|
|
160
|
+
BackgroundTransparency = 1,
|
|
159
161
|
Text = Blend.Computed(props.MatchResults, function(matchScores)
|
|
160
162
|
local playerOneWins = EloUtils.countPlayerOneWins(matchScores)
|
|
161
163
|
local playerTwoWins = EloUtils.countPlayerTwoWins(matchScores)
|
|
162
164
|
|
|
163
165
|
if playerOneWins > playerTwoWins then
|
|
164
|
-
return string.format(
|
|
166
|
+
return string.format(
|
|
167
|
+
"<font color='#355024'><stroke color='#9dd59a'>%d</stroke></font> - %d",
|
|
168
|
+
playerOneWins,
|
|
169
|
+
playerTwoWins
|
|
170
|
+
)
|
|
165
171
|
else
|
|
166
|
-
return string.format(
|
|
172
|
+
return string.format(
|
|
173
|
+
"%d - <font color='#355024'><stroke color='#9dd59a'>%d</stroke></font>",
|
|
174
|
+
playerOneWins,
|
|
175
|
+
playerTwoWins
|
|
176
|
+
)
|
|
167
177
|
end
|
|
168
|
-
end)
|
|
169
|
-
TextSize = 20
|
|
170
|
-
}
|
|
171
|
-
}
|
|
178
|
+
end),
|
|
179
|
+
TextSize = 20,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
172
182
|
|
|
173
183
|
MatchResultCard({
|
|
174
|
-
IsWinner = not playerOneWin
|
|
175
|
-
NewElo = props.PlayerTwo.New
|
|
176
|
-
OldElo = props.PlayerTwo.Old
|
|
177
|
-
Change = props.PlayerTwo.New - props.PlayerTwo.Old
|
|
178
|
-
})
|
|
184
|
+
IsWinner = not playerOneWin,
|
|
185
|
+
NewElo = props.PlayerTwo.New,
|
|
186
|
+
OldElo = props.PlayerTwo.Old,
|
|
187
|
+
Change = props.PlayerTwo.New - props.PlayerTwo.Old,
|
|
188
|
+
}),
|
|
179
189
|
}
|
|
180
190
|
end
|
|
181
191
|
|
|
182
192
|
local function EloGroup(props)
|
|
183
193
|
return Blend.New "Frame" {
|
|
184
|
-
Name = "EloGroup"
|
|
185
|
-
AutomaticSize = Enum.AutomaticSize.XY
|
|
186
|
-
BackgroundTransparency = 1
|
|
194
|
+
Name = "EloGroup",
|
|
195
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
196
|
+
BackgroundTransparency = 1,
|
|
187
197
|
|
|
188
198
|
Blend.New "Frame" {
|
|
189
|
-
BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
|
|
190
|
-
AutomaticSize = Enum.AutomaticSize.XY
|
|
199
|
+
BackgroundColor3 = Color3.new(0.1, 0.1, 0.1),
|
|
200
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
191
201
|
|
|
192
202
|
Blend.New "UICorner" {
|
|
193
|
-
CornerRadius = UDim.new(0, 15)
|
|
194
|
-
}
|
|
203
|
+
CornerRadius = UDim.new(0, 15),
|
|
204
|
+
},
|
|
195
205
|
|
|
196
206
|
Blend.New "UIStroke" {
|
|
197
|
-
Color = Color3.fromRGB(69, 170, 156)
|
|
198
|
-
Thickness = 3
|
|
199
|
-
}
|
|
207
|
+
Color = Color3.fromRGB(69, 170, 156),
|
|
208
|
+
Thickness = 3,
|
|
209
|
+
},
|
|
200
210
|
|
|
201
211
|
Blend.New "UIListLayout" {
|
|
202
|
-
FillDirection = Enum.FillDirection.Vertical
|
|
203
|
-
HorizontalAlignment = Enum.HorizontalAlignment.Center
|
|
204
|
-
Padding = UDim.new(0, 5)
|
|
205
|
-
}
|
|
212
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
213
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
|
214
|
+
Padding = UDim.new(0, 5),
|
|
215
|
+
},
|
|
206
216
|
|
|
207
217
|
Blend.New "Frame" {
|
|
208
|
-
Name = "Children"
|
|
209
|
-
AutomaticSize = Enum.AutomaticSize.XY
|
|
210
|
-
BackgroundTransparency = 1
|
|
218
|
+
Name = "Children",
|
|
219
|
+
AutomaticSize = Enum.AutomaticSize.XY,
|
|
220
|
+
BackgroundTransparency = 1,
|
|
211
221
|
|
|
212
222
|
Blend.New "UIListLayout" {
|
|
213
|
-
FillDirection = Enum.FillDirection.Vertical
|
|
214
|
-
HorizontalAlignment = Enum.HorizontalAlignment.Center
|
|
215
|
-
Padding = UDim.new(0, 5)
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
props.Items;
|
|
219
|
-
};
|
|
223
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
224
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
|
225
|
+
Padding = UDim.new(0, 5),
|
|
226
|
+
},
|
|
220
227
|
|
|
228
|
+
props.Items,
|
|
229
|
+
},
|
|
221
230
|
|
|
222
231
|
Blend.New "UIPadding" {
|
|
223
|
-
PaddingTop = UDim.new(0, 25)
|
|
224
|
-
PaddingBottom = UDim.new(0, 10)
|
|
225
|
-
PaddingLeft = UDim.new(0, 10)
|
|
226
|
-
PaddingRight = UDim.new(0, 10)
|
|
227
|
-
}
|
|
228
|
-
}
|
|
232
|
+
PaddingTop = UDim.new(0, 25),
|
|
233
|
+
PaddingBottom = UDim.new(0, 10),
|
|
234
|
+
PaddingLeft = UDim.new(0, 10),
|
|
235
|
+
PaddingRight = UDim.new(0, 10),
|
|
236
|
+
},
|
|
237
|
+
},
|
|
229
238
|
|
|
230
239
|
Blend.New "UIPadding" {
|
|
231
|
-
PaddingTop = UDim.new(0, 30)
|
|
232
|
-
}
|
|
240
|
+
PaddingTop = UDim.new(0, 30),
|
|
241
|
+
},
|
|
233
242
|
|
|
234
243
|
Blend.New "Frame" {
|
|
235
|
-
Name = "Header"
|
|
236
|
-
Size = UDim2.new(0, 200, 0, 30)
|
|
237
|
-
AnchorPoint = Vector2.new(0.5, 0.5)
|
|
238
|
-
Position = UDim2.fromScale(0.5, 0)
|
|
239
|
-
BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
|
|
244
|
+
Name = "Header",
|
|
245
|
+
Size = UDim2.new(0, 200, 0, 30),
|
|
246
|
+
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
247
|
+
Position = UDim2.fromScale(0.5, 0),
|
|
248
|
+
BackgroundColor3 = Color3.new(0.1, 0.1, 0.1),
|
|
240
249
|
|
|
241
250
|
Blend.New "UIStroke" {
|
|
242
|
-
Color = Color3.fromRGB(69, 170, 156)
|
|
243
|
-
Thickness = 3
|
|
244
|
-
}
|
|
251
|
+
Color = Color3.fromRGB(69, 170, 156),
|
|
252
|
+
Thickness = 3,
|
|
253
|
+
},
|
|
245
254
|
|
|
246
255
|
Blend.New "UICorner" {
|
|
247
|
-
CornerRadius = UDim.new(0.5, 0)
|
|
248
|
-
}
|
|
256
|
+
CornerRadius = UDim.new(0.5, 0),
|
|
257
|
+
},
|
|
249
258
|
|
|
250
259
|
TextLabel({
|
|
251
|
-
TextColor3 = Color3.new(1, 1, 1)
|
|
252
|
-
Text = props.HeaderText
|
|
253
|
-
Size = UDim2.fromScale(1, 1)
|
|
254
|
-
})
|
|
255
|
-
}
|
|
260
|
+
TextColor3 = Color3.new(1, 1, 1),
|
|
261
|
+
Text = props.HeaderText,
|
|
262
|
+
Size = UDim2.fromScale(1, 1),
|
|
263
|
+
}),
|
|
264
|
+
},
|
|
256
265
|
}
|
|
257
266
|
end
|
|
258
267
|
|
|
@@ -262,45 +271,55 @@ return function(target)
|
|
|
262
271
|
local options = {}
|
|
263
272
|
local config = EloUtils.createConfig()
|
|
264
273
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
for playerTwoEloDiff=-400, 400, 100 do
|
|
274
|
+
for playerOneElo = 800, 2400, 200 do
|
|
275
|
+
for playerTwoEloDiff = -400, 400, 100 do
|
|
268
276
|
local groupOptions = {}
|
|
269
277
|
local playerTwoElo = playerOneElo + playerTwoEloDiff
|
|
270
278
|
|
|
271
279
|
local matchResultTypes = {
|
|
272
|
-
string.format("%d wins vs %d", playerOneElo, playerTwoElo)
|
|
280
|
+
string.format("%d wins vs %d", playerOneElo, playerTwoElo),
|
|
273
281
|
|
|
274
282
|
{
|
|
275
|
-
results = { EloUtils.MatchResult.PLAYER_ONE_WIN }
|
|
276
|
-
}
|
|
283
|
+
results = { EloUtils.MatchResult.PLAYER_ONE_WIN },
|
|
284
|
+
},
|
|
277
285
|
{
|
|
278
|
-
results = {
|
|
279
|
-
|
|
286
|
+
results = {
|
|
287
|
+
EloUtils.MatchResult.PLAYER_ONE_WIN,
|
|
288
|
+
EloUtils.MatchResult.PLAYER_ONE_WIN,
|
|
289
|
+
EloUtils.MatchResult.PLAYER_TWO_WIN,
|
|
290
|
+
},
|
|
291
|
+
},
|
|
280
292
|
{
|
|
281
|
-
results = { EloUtils.MatchResult.PLAYER_ONE_WIN, EloUtils.MatchResult.PLAYER_ONE_WIN }
|
|
282
|
-
}
|
|
293
|
+
results = { EloUtils.MatchResult.PLAYER_ONE_WIN, EloUtils.MatchResult.PLAYER_ONE_WIN },
|
|
294
|
+
},
|
|
283
295
|
|
|
284
|
-
string.format("%d loses vs %d", playerOneElo, playerTwoElo)
|
|
296
|
+
string.format("%d loses vs %d", playerOneElo, playerTwoElo),
|
|
285
297
|
|
|
286
298
|
{
|
|
287
|
-
results = { EloUtils.MatchResult.PLAYER_TWO_WIN }
|
|
288
|
-
}
|
|
299
|
+
results = { EloUtils.MatchResult.PLAYER_TWO_WIN },
|
|
300
|
+
},
|
|
289
301
|
{
|
|
290
|
-
results = {
|
|
291
|
-
|
|
302
|
+
results = {
|
|
303
|
+
EloUtils.MatchResult.PLAYER_TWO_WIN,
|
|
304
|
+
EloUtils.MatchResult.PLAYER_TWO_WIN,
|
|
305
|
+
EloUtils.MatchResult.PLAYER_ONE_WIN,
|
|
306
|
+
},
|
|
307
|
+
},
|
|
292
308
|
{
|
|
293
|
-
results = { EloUtils.MatchResult.PLAYER_TWO_WIN, EloUtils.MatchResult.PLAYER_TWO_WIN }
|
|
294
|
-
}
|
|
309
|
+
results = { EloUtils.MatchResult.PLAYER_TWO_WIN, EloUtils.MatchResult.PLAYER_TWO_WIN },
|
|
310
|
+
},
|
|
295
311
|
}
|
|
296
312
|
|
|
297
313
|
for _, matchResultType in matchResultTypes do
|
|
298
314
|
if type(matchResultType) == "string" then
|
|
299
|
-
table.insert(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
315
|
+
table.insert(
|
|
316
|
+
groupOptions,
|
|
317
|
+
TextLabel({
|
|
318
|
+
TextColor3 = Color3.new(1, 1, 1),
|
|
319
|
+
Text = matchResultType,
|
|
320
|
+
Size = UDim2.new(0, 100, 0, 30),
|
|
321
|
+
})
|
|
322
|
+
)
|
|
304
323
|
|
|
305
324
|
continue
|
|
306
325
|
end
|
|
@@ -308,51 +327,57 @@ return function(target)
|
|
|
308
327
|
local matchResults = matchResultType.results
|
|
309
328
|
|
|
310
329
|
local scoreA, scoreB = EloUtils.getNewElo(config, playerOneElo, playerTwoElo, matchResults)
|
|
311
|
-
table.insert(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
330
|
+
table.insert(
|
|
331
|
+
groupOptions,
|
|
332
|
+
PlayerScoreChange({
|
|
333
|
+
MatchResults = matchResults,
|
|
334
|
+
PlayerOne = {
|
|
335
|
+
Old = playerOneElo,
|
|
336
|
+
New = scoreA,
|
|
337
|
+
},
|
|
338
|
+
PlayerTwo = {
|
|
339
|
+
Old = playerTwoElo,
|
|
340
|
+
New = scoreB,
|
|
341
|
+
},
|
|
342
|
+
})
|
|
343
|
+
)
|
|
322
344
|
end
|
|
323
345
|
|
|
324
|
-
table.insert(
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
346
|
+
table.insert(
|
|
347
|
+
options,
|
|
348
|
+
EloGroup {
|
|
349
|
+
HeaderText = string.format("%d vs %d", playerOneElo, playerTwoElo),
|
|
350
|
+
Items = groupOptions,
|
|
351
|
+
}
|
|
352
|
+
)
|
|
328
353
|
end
|
|
329
354
|
end
|
|
330
355
|
|
|
331
356
|
maid:GiveTask(Blend.mount(target, {
|
|
332
357
|
Blend.New "ScrollingFrame" {
|
|
333
|
-
Size = UDim2.new(1, 0, 1, 0)
|
|
334
|
-
BackgroundTransparency = 1
|
|
335
|
-
CanvasSize = UDim2.new(0, 0, 0, 0)
|
|
336
|
-
AutomaticCanvasSize = Enum.AutomaticSize.Y
|
|
358
|
+
Size = UDim2.new(1, 0, 1, 0),
|
|
359
|
+
BackgroundTransparency = 1,
|
|
360
|
+
CanvasSize = UDim2.new(0, 0, 0, 0),
|
|
361
|
+
AutomaticCanvasSize = Enum.AutomaticSize.Y,
|
|
337
362
|
|
|
338
363
|
Blend.New "UIPadding" {
|
|
339
|
-
PaddingTop = UDim.new(0, 10)
|
|
340
|
-
PaddingBottom = UDim.new(0, 10)
|
|
341
|
-
PaddingLeft = UDim.new(0, 10)
|
|
342
|
-
PaddingRight = UDim.new(0, 10)
|
|
343
|
-
}
|
|
364
|
+
PaddingTop = UDim.new(0, 10),
|
|
365
|
+
PaddingBottom = UDim.new(0, 10),
|
|
366
|
+
PaddingLeft = UDim.new(0, 10),
|
|
367
|
+
PaddingRight = UDim.new(0, 10),
|
|
368
|
+
},
|
|
344
369
|
|
|
345
370
|
Blend.New "UIListLayout" {
|
|
346
|
-
FillDirection = Enum.FillDirection.Vertical
|
|
347
|
-
HorizontalAlignment = Enum.HorizontalAlignment.Center
|
|
348
|
-
Padding = UDim.new(0, 10)
|
|
349
|
-
}
|
|
371
|
+
FillDirection = Enum.FillDirection.Vertical,
|
|
372
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
|
373
|
+
Padding = UDim.new(0, 10),
|
|
374
|
+
},
|
|
350
375
|
|
|
351
|
-
options
|
|
352
|
-
}
|
|
376
|
+
options,
|
|
377
|
+
},
|
|
353
378
|
}))
|
|
354
379
|
|
|
355
380
|
return function()
|
|
356
381
|
maid:DoCleaning()
|
|
357
382
|
end
|
|
358
|
-
end
|
|
383
|
+
end
|