diff --git a/.idea/.idea.Zero-K/.idea/projectSettingsUpdater.xml b/.idea/.idea.Zero-K/.idea/projectSettingsUpdater.xml index 64af657f5c..ef20cb08cd 100644 --- a/.idea/.idea.Zero-K/.idea/projectSettingsUpdater.xml +++ b/.idea/.idea.Zero-K/.idea/projectSettingsUpdater.xml @@ -2,6 +2,7 @@ \ No newline at end of file diff --git a/Fixer/Program.cs b/Fixer/Program.cs index 70ab686d4a..a76099d181 100644 --- a/Fixer/Program.cs +++ b/Fixer/Program.cs @@ -431,17 +431,22 @@ private static void TestPwMatchMaker() { var server = new global::ZkLobbyServer.ZkLobbyServer("", new PlanetwarsEventCreator()); var mm = server.PlanetWarsMatchMaker; - mm.ChallengeTime = DateTime.Now; mm.AttackerSideCounter = 1; - //mm.ResetAttackOptions(); - mm.GenerateLobbyCommand(); - mm.Challenge = mm.AttackOptions[3]; - mm.Challenge.OwnerFactionID = 2; - mm.Challenge.PlanetID = 4375; - mm.GetDefendingFactions(mm.Challenge); mm.GenerateLobbyCommand(); - //mm.Challenge = + // simulate defend phase with a formed squad + if (mm.AttackOptions.Count > 3) + { + var opt = mm.AttackOptions[3]; + opt.OwnerFactionID = 2; + opt.PlanetID = 4375; + mm.FormedSquads.Add(opt); + mm.Phase = PwPhase.DefendCollect; + mm.PhaseStartTime = DateTime.UtcNow; + mm.GetDefendingFactions(opt); + mm.GenerateLobbyCommand(); + } + Global.Server.PlanetWarsMatchMaker.GenerateLobbyCommand(); } diff --git a/Shared/PlasmaShared/GlobalConst.cs b/Shared/PlasmaShared/GlobalConst.cs index ae1e4dbf56..aec6c31ff6 100644 --- a/Shared/PlasmaShared/GlobalConst.cs +++ b/Shared/PlasmaShared/GlobalConst.cs @@ -210,8 +210,8 @@ static void SetMode(ModeType newMode) public const int PostVoteHideThreshold = -6; public const bool OnlyAdminsSeePostVoters = false; public const int PlanetWarsMinutesToAttackIfNoOption = 2; - public const int PlanetWarsMinutesToAttack = 20; - public const int PlanetWarsMinutesToAccept = 5; + public const int PlanetWarsMinutesToAttack = 5; + public const int PlanetWarsMinutesToAccept = 10; public const int PlanetWarsDropshipsStayForMinutes = 2*60; public const int PlanetWarsMaxTeamsize = 4; public const double PlanetWarsDefenderWinKillCcMultiplier = 0.2; diff --git a/Shared/PlasmaShared/Utils.cs b/Shared/PlasmaShared/Utils.cs index 249f1dc81f..24baf9a709 100644 --- a/Shared/PlasmaShared/Utils.cs +++ b/Shared/PlasmaShared/Utils.cs @@ -537,12 +537,18 @@ public static Thread SafeThread(Action action) public static U Get(this IDictionary dict, T key) - where U : class { U val = default(U); if (key != null) dict.TryGetValue(key, out val); return val; } + + public static U GetOrDefault(this IDictionary dict, T key, U defaultValue) + { + U val = defaultValue; + if (key != null) dict.TryGetValue(key, out val); + return val; + } public static List Shuffle(this IEnumerable source) diff --git a/Zero-K.info/Views/Planetwars/PwMatchMaker.cshtml b/Zero-K.info/Views/Planetwars/PwMatchMaker.cshtml index 4815f8dfa5..85ce5ba16c 100644 --- a/Zero-K.info/Views/Planetwars/PwMatchMaker.cshtml +++ b/Zero-K.info/Views/Planetwars/PwMatchMaker.cshtml @@ -13,8 +13,8 @@ } else { - PwMatchCommand.VoteOption opt = pw.Options.First(); - text = string.Format("{0} attacks planet {2}, {1} defends", pw.AttackerFaction, string.Join(",", pw.DefenderFactions), opt.PlanetName); + var planetNames = string.Join(", ", pw.Options.Select(o => o.PlanetName)); + text = string.Format("{0} attacks {2}, {1} defends", pw.AttackerFaction, string.Join(",", pw.DefenderFactions), planetNames); } bool canClick = (pw.Mode == PwMatchCommand.ModeType.Attack && pw.AttackerFaction == Global.Account.Faction.Shortcut) || (pw.Mode == PwMatchCommand.ModeType.Defend && pw.DefenderFactions.Contains(Global.Account.Faction.Shortcut)); diff --git a/ZeroKLobby/Notifications/PwBar.cs b/ZeroKLobby/Notifications/PwBar.cs index 7c1abd5296..c346b9df17 100644 --- a/ZeroKLobby/Notifications/PwBar.cs +++ b/ZeroKLobby/Notifications/PwBar.cs @@ -82,23 +82,26 @@ void UpdateGui() } else if (pw.Mode == PwMatchCommand.ModeType.Defend) { - PwMatchCommand.VoteOption opt = pw.Options.First(); - headerLabel.Text = string.Format("{0} attacks planet {2}, {1} defends", + headerLabel.Text = string.Format("{0} attacks, {1} defends", pw.AttackerFaction, - string.Join(",", pw.DefenderFactions), - opt.PlanetName); + string.Join(",", pw.DefenderFactions)); foreach (Button c in pnl.Controls.OfType