Skip to content

Commit 03c7ab5

Browse files
committed
dynamic PW attack and defend phases
1 parent a79e2cf commit 03c7ab5

7 files changed

Lines changed: 75 additions & 6 deletions

File tree

Shared/PlasmaShared/GlobalConst.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,6 @@ static void SetMode(ModeType newMode)
211211
public const int PostVoteHideThreshold = -6;
212212
public const bool OnlyAdminsSeePostVoters = false;
213213
public const int PlanetWarsMinutesToAttackIfNoOption = 2;
214-
public const int PlanetWarsMinutesToAttack = 2;
215-
public const int PlanetWarsMinutesToAccept = 2;
216214
public const int PlanetWarsDropshipsStayForMinutes = 2*60;
217215
public const int PlanetWarsMaxTeamsize = 4;
218216
public const double PlanetWarsDefenderWinKillCcMultiplier = 0.2;

ZkData/Ef/DynamicConfig.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ public class DynamicConfig
5858
[Description("PlanetWars: minimum IP (0-100) below which bombers cannot push any faction. 0 disables the floor.")]
5959
public double PwBomberMinimumIpFloor { get; set; } = 5.0;
6060

61+
[Description("PlanetWars: length in minutes of the attack-collect phase (attackers pick a target).")]
62+
public int PwAttackPhaseMinutes { get; set; } = 2;
63+
64+
[Description("PlanetWars: length in minutes of the defend-collect phase (defenders accept).")]
65+
public int PwDefendPhaseMinutes { get; set; } = 2;
66+
6167

6268
public static DynamicConfig Instance;
6369

ZkData/Migrations/202604290948595_AddPwPhaseMinutes.Designer.cs

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace ZkData.Migrations
2+
{
3+
using System;
4+
using System.Data.Entity.Migrations;
5+
6+
public partial class AddPwPhaseMinutes : DbMigration
7+
{
8+
public override void Up()
9+
{
10+
AddColumn("dbo.DynamicConfigs", "PwAttackPhaseMinutes", c => c.Int(nullable: false, defaultValue: 2));
11+
AddColumn("dbo.DynamicConfigs", "PwDefendPhaseMinutes", c => c.Int(nullable: false, defaultValue: 2));
12+
}
13+
14+
public override void Down()
15+
{
16+
DropColumn("dbo.DynamicConfigs", "PwDefendPhaseMinutes");
17+
DropColumn("dbo.DynamicConfigs", "PwAttackPhaseMinutes");
18+
}
19+
}
20+
}

ZkData/Migrations/202604290948595_AddPwPhaseMinutes.resx

Lines changed: 9 additions & 0 deletions
Large diffs are not rendered by default.

ZkData/ZkData.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@
519519
<Compile Include="Migrations\202604271235020_AddPwAttackChargesPassiveLimit.Designer.cs">
520520
<DependentUpon>202604271235020_AddPwAttackChargesPassiveLimit.cs</DependentUpon>
521521
</Compile>
522+
<Compile Include="Migrations\202604290948595_AddPwPhaseMinutes.cs" />
523+
<Compile Include="Migrations\202604290948595_AddPwPhaseMinutes.Designer.cs">
524+
<DependentUpon>202604290948595_AddPwPhaseMinutes.cs</DependentUpon>
525+
</Compile>
522526
<Compile Include="SpringFilesUnitsyncAttempt.cs" />
523527
<Compile Include="SteamWebApi.cs" />
524528
<Compile Include="UserLanguageNoteAttribute.cs" />
@@ -988,6 +992,9 @@
988992
<EmbeddedResource Include="Migrations\202604271235020_AddPwAttackChargesPassiveLimit.resx">
989993
<DependentUpon>202604271235020_AddPwAttackChargesPassiveLimit.cs</DependentUpon>
990994
</EmbeddedResource>
995+
<EmbeddedResource Include="Migrations\202604290948595_AddPwPhaseMinutes.resx">
996+
<DependentUpon>202604290948595_AddPwPhaseMinutes.cs</DependentUpon>
997+
</EmbeddedResource>
991998
<EmbeddedResource Include="ZkDataResources.resx">
992999
<Generator>ResXFileCodeGenerator</Generator>
9931000
<LastGenOutput>ZkDataResources.Designer.cs</LastGenOutput>

ZkLobbyServer/SpringieInterface/PlanetWarsMatchMaker.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,12 +1139,12 @@ private DateTime GetAttackDeadline()
11391139
if (AttackOptions.Count == 0)
11401140
return PhaseStartTime.AddMinutes(GlobalConst.PlanetWarsMinutesToAttackIfNoOption);
11411141

1142-
return PhaseStartTime.AddMinutes(GlobalConst.PlanetWarsMinutesToAttack);
1142+
return PhaseStartTime.AddMinutes(DynamicConfig.Instance.PwAttackPhaseMinutes);
11431143
}
11441144

11451145
private DateTime GetDefendDeadline()
11461146
{
1147-
return PhaseStartTime.AddMinutes(GlobalConst.PlanetWarsMinutesToAccept);
1147+
return PhaseStartTime.AddMinutes(DynamicConfig.Instance.PwDefendPhaseMinutes);
11481148
}
11491149

11501150
/// <summary>
@@ -1302,8 +1302,8 @@ private static PwStatus GeneratePwStatus()
13021302
MinLevel = GlobalConst.MinPlanetWarsLevel,
13031303
PlanetWarsNextMode = MiscVar.PlanetWarsNextMode,
13041304
PlanetWarsNextModeTime = MiscVar.PlanetWarsNextModeTime,
1305-
AttackerPhaseMinutes = GlobalConst.PlanetWarsMinutesToAttack,
1306-
DefenderPhaseMinutes = GlobalConst.PlanetWarsMinutesToAccept,
1305+
AttackerPhaseMinutes = DynamicConfig.Instance.PwAttackPhaseMinutes,
1306+
DefenderPhaseMinutes = DynamicConfig.Instance.PwDefendPhaseMinutes,
13071307
MaxAttackCharges = DynamicConfig.Instance.PwAttackChargesMax,
13081308
};
13091309
}

0 commit comments

Comments
 (0)