Skip to content

Commit 294e285

Browse files
committed
Revert "Revert to 14/01/2020 stable."
This reverts commit 432ac31.
1 parent 5bf7171 commit 294e285

18 files changed

Lines changed: 142 additions & 140 deletions

File tree

ChobbyLauncher/ChobbyLauncher.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@
4242
<Reference Include="GameAnalytics.Mono, Version=1.0.6235.22073, Culture=neutral, processorArchitecture=MSIL">
4343
<HintPath>..\packages\GameAnalytics.Mono.SDK.1.1.6\lib\net45\GameAnalytics.Mono.dll</HintPath>
4444
</Reference>
45-
<Reference Include="Neo.Lua, Version=5.3.0.0, Culture=neutral, PublicKeyToken=fdb0cd4fe8a6e3b2, processorArchitecture=MSIL">
46-
<HintPath>..\packages\NeoLua.1.1.5\lib\net45\Neo.Lua.dll</HintPath>
47-
</Reference>
48-
<Reference Include="Neo.Lua.Desktop, Version=5.3.0.0, Culture=neutral, PublicKeyToken=fdb0cd4fe8a6e3b2, processorArchitecture=MSIL">
49-
<HintPath>..\packages\NeoLua.1.1.5\lib\net45\Neo.Lua.Desktop.dll</HintPath>
50-
</Reference>
5145
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
5246
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
5347
</Reference>

ChobbyLauncher/Chobbyla.cs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Threading.Tasks;
77
using System.Windows.Forms;
88
using GameAnalyticsSDK.Net;
9-
using Neo.IronLua;
109
using Newtonsoft.Json;
1110
using PlasmaDownloader;
1211
using PlasmaDownloader.Packages;
@@ -108,7 +107,7 @@ public async Task<bool> Prepare()
108107
else internalName = "Chobby $VERSION";
109108

110109

111-
engine = engine ?? GetSteamEngine() ?? QueryDefaultEngine() ?? ExtractEngineFromLua(ver) ?? GlobalConst.DefaultEngineOverride;
110+
engine = engine ?? GetSteamEngine() ?? QueryDefaultEngine() ?? GlobalConst.DefaultEngineOverride;
112111

113112
try
114113
{
@@ -197,21 +196,7 @@ public bool Run(ulong initialConnectLobbyID, TextWriter writer)
197196
return ret;
198197
}
199198
}
200-
201-
202-
private dynamic ExtractEngineFromLua(PackageDownloader.Version ver)
203-
{
204-
if (ver != null)
205-
{
206-
var mi = ver.ReadFile(paths, "modinfo.lua");
207-
var lua = new Lua();
208-
var luaEnv = lua.CreateEnvironment();
209-
dynamic result = luaEnv.DoChunk(new StreamReader(mi), "dummy.lua");
210-
var engineVersion = result.engine;
211-
return engineVersion;
212-
}
213-
return null;
214-
}
199+
215200

216201
private string GetSteamEngine()
217202
{

Shared/PlasmaShared/GlobalConst.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ public static BasicHttpBinding CreateBasicHttpBinding()
131131
public const int CommanderProfileCount = 6;
132132
public const int NumCommanderLevels = 5;
133133
public const int MaxCommanderNameLength = 20;
134-
public const int MillisecondsPerCharacter = 50; //Maximum allowed chat messaging rate before it is considered spam, 80ms is equivalent to 120 WPM, which covers typing speeds of anyone short of a stenographer.
135-
public const int MinMillisecondsBetweenMessages = 1000; //Disallow sending more than one message per this interval
136134

137135
public const string DefaultEngineOverride = "104.0.1-287-gf7b0fcc"; // hack for ZKL using tasclient's engine - override here for missions etc
138136

@@ -244,6 +242,8 @@ public static BasicHttpBinding CreateBasicHttpBinding()
244242

245243
public const int LobbyThrottleBytesPerSecond = 2000;
246244
public const int LobbyMaxMessageSize = 2000;
245+
public const int MillisecondsPerCharacter = 50; //Maximum allowed chat messaging rate before it is considered spam, 80ms is equivalent to 120 WPM, which covers typing speeds of anyone short of a stenographer.
246+
public const int MinMillisecondsBetweenMessages = 1000; //Disallow sending more than one message per this interval
247247

248248

249249
public static int UdpHostingPortStart;

SteamRoot/Zero-K_linux32.sh

100644100755
File mode changed.
774 KB
Binary file not shown.

SteamRoot/linux64/libc.so

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* GNU ld script
2+
Use the shared library, but some functions are only in
3+
the static library, so try that secondarily. */
4+
OUTPUT_FORMAT(elf64-x86-64)
5+
GROUP ( /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a AS_NEEDED ( /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ) )

Zero-K.info/Views/Maps/MapTags.cshtml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,25 @@
55
}
66

77
@if (m.MapIsFfa == true) {
8-
<img src='/img/map_tags/ffa.png' style="width: 32px; height: 32px" title="Free For All" />
8+
<img src='/img/map_tags/ffa.png' style="width: 32px; height: 32px" title="Suitable for Free For All" />
99
}
10-
@if (m.MapWaterLevel > 0) {
11-
<img src='/img/map_tags/sea@(m.MapWaterLevel).png' style="width:32px; height: 32px" title="Sea coverage"/>
10+
11+
@if (m.MapWaterLevel == 1) {
12+
<img src='/img/map_tags/sea1.png' style="width:32px; height: 32px" title="Land map, little to no water"/>
13+
} else if (m.MapWaterLevel == 2) {
14+
<img src='/img/map_tags/sea2.png' style="width:32px; height: 32px" title="Mixed sea/land map, decent amounts of water"/>
15+
} else if (m.MapWaterLevel == 3) {
16+
<img src='/img/map_tags/sea3.png' style="width:32px; height: 32px" title="Sea map, lots of water"/>
1217
}
13-
@if (m.MapHills > 0) {
14-
<img src='/img/map_tags/hill@(m.MapHills).png' style="width:32px; height: 32px" title="Terrain"/>
18+
19+
@if (m.MapHills == 1) {
20+
<img src='/img/map_tags/hill1.png' style="width:32px; height: 32px" title="Flat map, little height variation"/>
21+
} else if (m.MapHills == 2) {
22+
<img src='/img/map_tags/hill2.png' style="width:32px; height: 32px" title="Hilly map, decent height variation"/>
23+
} else if (m.MapHills == 3) {
24+
<img src='/img/map_tags/hill3.png' style="width:32px; height: 32px" title="Mountainous map, high height variation"/>
1525
}
26+
1627
@if (m.MapIsSpecial == true) {
1728
<img src='/img/map_tags/special.png' style="width: 32px; height: 32px" title="Map has special features" />
1829
}

Zero-K.info/Views/Users/AdminUserDetail.cshtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,14 @@
130130

131131
@if (Model.SteamID != null)
132132
{
133-
<span>Unlink from Steam:</span>
133+
<span>User IS linked with Steam. Unlink from Steam:</span>
134134
<form method="post" action="@Url.Action("UnlinkSteamID", "Users", new { accountID = Model.AccountID })">
135135
@Html.AntiForgeryToken()
136136
Delete this account's Steam name and ID, allowing the user to link their Steam account to another ZK account.'
137137
<input type="submit" class="js_confirm" />
138138
</form>
139+
} else {
140+
<span>User IS NOT linked with Steam. </span>
139141
}
140142

141143
<br />

ZkData/Ef/Account.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ public enum BadgeType
631631
donator_2 = 4,
632632
[Description("Diamond donator")]
633633
donator_3 = 8,
634-
[Description("External developer")]
634+
[Description("Content contributor")]
635635
dev_content = 5,
636636
[Description("Game developer")]
637637
dev_game = 6,

ZkData/Ef/WHR/Game.cs

Lines changed: 46 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -11,99 +11,97 @@ public class Game
1111
{
1212
public readonly int day;
1313
public readonly int id;
14-
public ICollection<Player> whitePlayers;
15-
public ICollection<Player> blackPlayers;
16-
public bool blackWins;
17-
public Dictionary<Player, PlayerDay> whiteDays = new Dictionary<Player, PlayerDay>();
18-
public Dictionary<Player, PlayerDay> blackDays = new Dictionary<Player, PlayerDay>();
14+
public List<ICollection<Player>> loserPlayers;
15+
public ICollection<Player> winnerPlayers;
16+
public Dictionary<Player, PlayerDay> loserDays = new Dictionary<Player, PlayerDay>();
17+
public Dictionary<Player, PlayerDay> winnerDays = new Dictionary<Player, PlayerDay>();
18+
public Dictionary<Player, int> playerFinder = new Dictionary<Player, int>();
1919

20-
public Game(ICollection<Player> black, ICollection<Player> white, bool blackWins, int time_step, int id)
20+
public Game(ICollection<Player> winner, List<ICollection<Player>> loser, int time_step, int id)
2121
{
2222
this.id = id;
2323
day = time_step;
24-
whitePlayers = white;
25-
blackPlayers = black;
26-
this.blackWins = blackWins;
24+
loserPlayers = loser;
25+
winnerPlayers = winner;
26+
for (int i = 0; i < loser.Count; i++)
27+
{
28+
loser[i].ForEach(p => playerFinder.Add(p, i));
29+
}
2730
}
2831

29-
private float GetWhiteNaturalRating()
32+
private float GetLoserNaturalRating(int team)
3033
{
3134
float ret = 0;
3235
float w;
33-
float totWeight = 0;
34-
foreach (PlayerDay pd in whiteDays.Values)
36+
foreach (Player p in loserPlayers[team])
3537
{
38+
PlayerDay pd = loserDays[p];
3639
w = GetPlayerWeight(pd.player);
37-
totWeight += w;
3840
ret += pd.GetNaturalRating() * w;
3941
}
40-
return ret / totWeight;
42+
return ret;
4143
}
4244

4345
private float GetBlackNaturalRating()
4446
{
4547
float ret = 0;
4648
float w;
47-
float totWeight = 0;
48-
foreach (PlayerDay pd in blackDays.Values)
49+
foreach (PlayerDay pd in winnerDays.Values)
4950
{
5051
w = GetPlayerWeight(pd.player);
51-
totWeight += w;
5252
ret += pd.GetNaturalRating() * w;
5353
}
54-
return ret / totWeight;
54+
return ret;
5555
}
5656

5757
public float GetPlayerWeight(Player p)
5858
{
59-
return 1.0f / GetPlayerTeammates(p).Count;
59+
int size = playerFinder.ContainsKey(p) ? loserPlayers[playerFinder[p]].Count : winnerPlayers.Count;
60+
return 1.0f / size;
6061
}
6162

62-
private float GetWhiteGamma()
63+
private float GetLoserGamma(int team)
6364
{
64-
return (float)Math.Exp(GetWhiteNaturalRating());
65+
return (float)Math.Exp(GetLoserNaturalRating(team));
66+
}
67+
private float GetLosersGamma()
68+
{
69+
float sum = 0;
70+
for (int i = 0; i < loserPlayers.Count; i++) sum += GetLoserGamma(i);
71+
return sum;
6572
}
6673

67-
private float GetBlackGamma()
74+
private float GetWinnerGamma()
6875
{
6976
return (float)Math.Exp(GetBlackNaturalRating());
7077
}
7178

7279
public float GetOpponentsAdjustedGamma(Player player)
7380
{
74-
75-
float opponent_naturalrating = 0;
76-
float blackNaturalRating = GetBlackNaturalRating();
77-
float whiteNaturalRating = GetWhiteNaturalRating();
78-
if ((whitePlayers.Contains(player)))
79-
{
80-
opponent_naturalrating = blackNaturalRating + 0 * (-whiteNaturalRating + whiteDays[player].GetNaturalRating())/* / (float)Math.sqrt(whiteDays.Count)*/;
81-
}
82-
else
83-
{
84-
opponent_naturalrating = whiteNaturalRating + 0 * (-blackNaturalRating + blackDays[player].GetNaturalRating())/* / (float)Math.sqrt(blackDays.Count)*/;
85-
}
86-
float rval = (float)Math.Exp(opponent_naturalrating);
81+
82+
float rval = GetWinnerGamma() + GetLosersGamma() - GetAlliesAdjustedGamma(player, false);
8783
if (rval == 0 || float.IsInfinity(rval) || float.IsNaN(rval))
8884
{
8985
Trace.TraceError("WHR: Gamma out of bounds");
9086
}
9187
return rval;
9288
}
9389

94-
public float GetAlliesAdjustedGamma(Player player)
90+
public float GetAlliesAdjustedGamma(Player player, bool excludeMe = true)
9591
{
9692

9793
float ally_naturalrating = 0;
9894
float blackNaturalRating = GetBlackNaturalRating();
99-
float whiteNaturalRating = GetWhiteNaturalRating();
100-
if ((whitePlayers.Contains(player)))
95+
if ((playerFinder.ContainsKey(player)))
10196
{
102-
ally_naturalrating = whiteNaturalRating - whiteDays[player].GetNaturalRating() * GetPlayerWeight(player);
97+
float whiteNaturalRating = GetLoserNaturalRating(playerFinder[player]);
98+
ally_naturalrating = whiteNaturalRating ;
99+
if (excludeMe) ally_naturalrating -= loserDays[player].GetNaturalRating() * GetPlayerWeight(player);
103100
}
104101
else
105102
{
106-
ally_naturalrating = blackNaturalRating - blackDays[player].GetNaturalRating() * GetPlayerWeight(player);
103+
ally_naturalrating = blackNaturalRating;
104+
if (excludeMe) ally_naturalrating -= winnerDays[player].GetNaturalRating() * GetPlayerWeight(player);
107105
}
108106
float rval = (float)Math.Exp(ally_naturalrating);
109107
if (rval == 0 || float.IsInfinity(rval) || float.IsNaN(rval))
@@ -117,13 +115,13 @@ public float GetMyAdjustedGamma(Player player)
117115
{
118116

119117
float my_naturalrating = 0;
120-
if ((whitePlayers.Contains(player)))
118+
if ((playerFinder.ContainsKey(player)))
121119
{
122-
my_naturalrating = whiteDays[player].GetNaturalRating() * GetPlayerWeight(player);
120+
my_naturalrating = loserDays[player].GetNaturalRating() * GetPlayerWeight(player);
123121
}
124122
else
125123
{
126-
my_naturalrating = blackDays[player].GetNaturalRating() * GetPlayerWeight(player);
124+
my_naturalrating = winnerDays[player].GetNaturalRating() * GetPlayerWeight(player);
127125
}
128126
float rval = (float)Math.Exp(my_naturalrating);
129127
if (rval == 0 || float.IsInfinity(rval) || float.IsNaN(rval))
@@ -133,26 +131,14 @@ public float GetMyAdjustedGamma(Player player)
133131
return rval;
134132
}
135133

136-
public ICollection<Player> GetPlayerTeammates(Player player)
137-
{
138-
if ((whitePlayers.Contains(player)))
139-
{
140-
return whitePlayers;
141-
}
142-
else
143-
{
144-
return blackPlayers;
145-
}
146-
}
147-
148-
public float GetBlackWinProbability()
134+
public float GetWinProbability()
149135
{
150-
if (whiteDays.Count == 0 || blackDays.Count == 0)
136+
if (loserDays.Count == 0 || winnerDays.Count == 0)
151137
{
152-
whitePlayers.ForEach(p => p.FakeGame(this));
153-
blackPlayers.ForEach(p => p.FakeGame(this));
138+
loserPlayers.ForEach(t => t.ForEach(p => p.FakeGame(this)));
139+
winnerPlayers.ForEach(p => p.FakeGame(this));
154140
}
155-
return GetBlackGamma() / (GetWhiteGamma() + GetBlackGamma());
141+
return GetWinnerGamma() / (GetLosersGamma() + GetWinnerGamma());
156142
}
157143

158144
public override int GetHashCode()

0 commit comments

Comments
 (0)