Skip to content

Commit

Permalink
Merge branch 'master' into sprunk-patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
Licho1 authored Apr 6, 2024
2 parents cdf3a86 + 50cf0a7 commit 91c6c69
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ jobs:
shell: cmd

- name: Test Report C#
if: (github.event.pull_request.head.repo.full_name == github.repository) && (success() || failure()) # run this step even if previous step failed but not on PR from forked repo
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Test results C# # Name of the check run which will be created
path: TestResults/test-results.trx
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,12 @@ Zero-K.info/img/missions/169.png
Thumbs.db

# User specific
**/.idea/**/workspace.xml
**/.idea/**
**/.idea/**/tasks.xml
**/.idea/shelf/*
**/.idea/dictionaries
**/.idea/httpRequests/
**/.idea/copilot/**

# Sensitive or high-churn files
**/.idea/**/dataSources/
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Zero-K-Infrastructure
=====================
# Zero-K-Infrastructure

Website, lobby, tools and other vital parts of Zero-K infrastructure
This repository contains the website, lobby, tools, and other vital parts of Zero-K infrastructure.

For more information on this and other Zero-K repositories, please visit our [development wiki](https://zero-k.info/mediawiki/Zero-K:Developing).
3 changes: 3 additions & 0 deletions Shared/LobbyClient/ScriptGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public static string GenerateHostScript(SpringBattleContext context, int loopbac
// send desync to server
script.AppendFormat(" DumpGameStateOnDesync=1;\n");

// set the "connecting to: xyz" message during early engine load
script.AppendFormat(" ShowServerName={0};\n", context.LobbyStartContext.Title.Replace(';', ' '));

if (loopbackListenPort >0) script.AppendFormat(" AutohostPort={0};\n", loopbackListenPort);
script.AppendLine();
script.AppendFormat(" HostIP={0};\n", context.IpAddress);
Expand Down
Binary file modified SteamRoot/sqlite3.dll
Binary file not shown.
45 changes: 40 additions & 5 deletions Zero-K.info/Controllers/TourneyController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class TourneyModel
public List<int> Team1Ids { get; set; } = new List<int>();
public List<int> Team2Ids { get; set; } = new List<int>();
public string Title { get; set; }
public string ModoptString { get; set; }
}

// GET: Tourney
Expand All @@ -25,7 +26,7 @@ public ActionResult Index()
if (!Global.IsTourneyController) return DenyAccess();
var tourneyBattles = Global.Server.Battles.Values.Where(x => x != null).OfType<TourneyBattle>().ToList();

return View("TourneyIndex", new TourneyModel() {Battles = tourneyBattles});
return View("TourneyIndex", new TourneyModel() { Battles = tourneyBattles });
}

public ActionResult JoinBattle(string battleHost)
Expand Down Expand Up @@ -119,16 +120,43 @@ public ActionResult AddBattle(TourneyModel model)
model.Team2Ids.Select(x=> db.Accounts.Find(x)?.Name).Where(x=>x!=null).ToList()
}
});

string[] optionSplitters = { "," };
string[] modoptsStrings = model.ModoptString.Split(optionSplitters, System.StringSplitOptions.RemoveEmptyEntries);
foreach (var modStr in modoptsStrings)
{
bool validSetting = true;
string[] modComponent = modStr.Split('=');
if (modComponent.Length == 2)
{
tb.ModOptions.Add(modComponent[0], modComponent[1]);
}
}
Global.Server.AddBattle(tb);
}
return RedirectToAction("Index");
}

public ActionResult AddMultipleBattles(string battleList)
public ActionResult AddMultipleBattles(string battleList, string modoptStringMult)
{
if (!Global.IsTourneyController) return DenyAccess();
var db = new ZkDataContext();

// parse modoptions
Dictionary<string, string> modopts = new Dictionary<string, string>();
string[] optionSplitters = { "," };
string[] modoptsStrings = modoptStringMult.Split(optionSplitters, System.StringSplitOptions.RemoveEmptyEntries);
foreach (var modStr in modoptsStrings)
{
bool validSetting = true;
string[] modComponent = modStr.Split('=');
if (modComponent.Length == 2)
{
modopts.Add(modComponent[0], modComponent[1]);
}
}

// parse and creatge battles
string[] splitters = { "//" };
string[] battleSpecs = battleList.Split(splitters, System.StringSplitOptions.RemoveEmptyEntries);

Expand Down Expand Up @@ -182,6 +210,12 @@ public ActionResult AddMultipleBattles(string battleList)
team2Ids.Select(x=> db.Accounts.Find(x)?.Name).Where(x=>x!=null).ToList()
}
});

foreach (KeyValuePair<string, string> kvp in modopts)
{
tb.ModOptions.Add(kvp.Key, kvp.Value);
}

Global.Server.AddBattle(tb);
}
}
Expand All @@ -200,7 +234,7 @@ public ActionResult GetReplayList()
string line = string.Format("");
foreach (var team in tBat.Prototype.TeamPlayers)
{
foreach(var p in team)
foreach (var p in team)
{
line += "@U" + Account.AccountByName(db, p).AccountID + ", ";
}
Expand All @@ -214,11 +248,12 @@ public ActionResult GetReplayList()
foreach (var deb in tBat.Debriefings)
{
var bat = db.SpringBattles.FirstOrDefault(x => x.SpringBattleID == deb.ServerBattleID);
if (bat != null) {
if (bat != null)
{
batCount++;
line += "@B" + deb.ServerBattleID + ", ";
}

}
line = line.Remove(line.Length - 2);
if (batCount > 0)
Expand Down
15 changes: 14 additions & 1 deletion Zero-K.info/Views/Tourney/TourneyIndex.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@
<br />
<span>Mass create rooms:</span>
<form action="@Url.Action("AddMultipleBattles")" method="post">
@Html.TextBox("battleList", "TitleA,Player1,Player2//TitleB,Player1A,Player1B,Player2A,Player2B//...", new { style = "width:750px" })<br />
<table>
<tr>
<td>Room definition</td>
<td>@Html.TextBox("battleList", "TitleA,Player1,Player2//TitleB,Player1A,Player1B,Player2A,Player2B//...", new { style = "width:650px" }) </td>
</tr>
<tr>
<td>Modoptions</td>
<td>@Html.TextBox("modoptStringMult", "", new { style = "width:650px" }) </td>
</tr>
</table>
<input type="submit" value="Create Battles" class="js_confirm" />
</form>
<br />
Expand Down Expand Up @@ -103,6 +112,10 @@
@Html.MultiSelectFor(x => x.Team2Ids, Url.Action("UsersNoLink", "Autocomplete"), x => Html.PrintAccount(db.Accounts.Find(x)))
</td>
</tr>
<tr>
<td>Modoptions</td>
<td>@Html.TextBoxFor(x => x.ModoptString)</td>
</tr>
<tr><td colspan="2"><input type="submit" /></td></tr>
</table>

Expand Down
4 changes: 2 additions & 2 deletions ZkLobbyServer/ZkLobbyServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -604,14 +604,14 @@ public async Task ReportUser(ZkDataContext db, Account reporter, Account reporte

string str;
if (reporter.AccountID != reported.AccountID)
str = string.Format("{0} https://zero-k.info/Users/Detail/{1} reports abuse by {2} https://zero-k.info/Users/Detail/{3} : {4}",
str = string.Format("`{0}` https://zero-k.info/Users/Detail/{1} reports abuse by `{2}` https://zero-k.info/Users/Detail/{3} : {4}",
reporter.Name,
reporter.AccountID,
reported.Name,
reported.AccountID,
report);
else
str = string.Format("{0} https://zero-k.info/Users/Detail/{1} contacts admins : {2}",
str = string.Format("`{0}` https://zero-k.info/Users/Detail/{1} contacts admins : {2}",
reporter.Name,
reporter.AccountID,
report);
Expand Down
4 changes: 2 additions & 2 deletions ZkLobbyServer/autohost/Commands/CmdKick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ private bool NotifyAdminChannel(ServerBattle battle, Say e, bool isActualKick)
}
if (isActualKick)
{
battle.server.GhostChanSay(ZkData.GlobalConst.ModeratorChannel, string.Format("{0} (and possibly others) kicked {1} ({2}, {3}) from {4}", e?.User, target, ptype, gtype, battle.Title));
battle.server.GhostChanSay(ZkData.GlobalConst.ModeratorChannel, string.Format("`{0}` (and possibly others) kicked `{1}` ({2}, {3}) from {4}", e?.User, target, ptype, gtype, battle.Title));
}
else
{
battle.server.GhostChanSay(ZkData.GlobalConst.ModeratorChannel, string.Format("{0} started a kick vote against {1} ({2}, {3}) in {4}", e?.User, target, ptype, gtype, battle.Title));
battle.server.GhostChanSay(ZkData.GlobalConst.ModeratorChannel, string.Format("`{0}` started a kick vote against `{1}` ({2}, {3}) in {4}", e?.User, target, ptype, gtype, battle.Title));
}
}
return true;
Expand Down

0 comments on commit 91c6c69

Please sign in to comment.