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