Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit 58fb76a

Browse files
committed
feat: Add option to prevent draws in rounds and update version to 2.0.7
1 parent e1da3df commit 58fb76a

File tree

7 files changed

+36
-11
lines changed

7 files changed

+36
-11
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
-- 2025.05.31 - 2.0.7
2+
3+
- feat: Added an option to prevent draws on equal alive counts
4+
- fix: Database was required to start to plugin.
5+
16
-- 2025.05.21 - 2.0.6
27

38
- fix: Sometimes on mapchange arenas not found (thanks for the feedback nyshun.)

src-plugin/Plugin/Models/ArenaPlayerModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ private void ShowCenterWeaponSubPreferenceMenu(WeaponType weaponType)
333333
CsItem item = possibleItems[i];
334334
if (WeaponModel.GetWeaponType(item) != weaponType)
335335
continue;
336+
336337
items.Add(new MenuItem(MenuItemType.Bool, new MenuValue($"{Localizer.ForPlayer(Controller, item.ToString())}: ")));
337338
defaultValues[i + 1] = WeaponPreferences[weaponType] == item;
338339
}

src-plugin/Plugin/PluginConfig.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,8 @@ public sealed class PluginConfig : BasePluginConfig
130130
[JsonPropertyName("allowed-weapon-prefs")]
131131
public AllowedWeaponPreferences AllowedWeaponPreferences { get; set; } = new AllowedWeaponPreferences();
132132

133-
[JsonPropertyName("arena-math-overrides")]
134-
public int ArenaMathOverrides { get; set; } = 0;
135-
136133
[JsonPropertyName("ConfigVersion")]
137-
public override int Version { get; set; } = 9;
134+
public override int Version { get; set; } = 10;
138135
}
139136

140137
public sealed class CompatibilitySettings
@@ -153,6 +150,9 @@ public sealed class CompatibilitySettings
153150

154151
[JsonPropertyName("disable-clantags")]
155152
public bool DisableClantags { get; set; } = false;
153+
154+
[JsonPropertyName("prevent-draw-rounds")]
155+
public bool PreventDrawRounds { get; set; } = true;
156156
}
157157

158158
public sealed class AllowedWeaponPreferences

src-plugin/Plugin/PluginDatabase.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ public static bool IsDatabaseConfigDefault(PluginConfig config)
162162
return _settings.Host == "localhost" &&
163163
_settings.Username == "root" &&
164164
_settings.Database == "database" &&
165-
_settings.Password == "password" &&
166-
_settings.Port == 3306 &&
167-
_settings.Sslmode == "none" &&
168-
_settings.TablePrefix == "" &&
169-
_settings.TablePurgeDays == 30;
165+
_settings.Password == "password";
170166
}
171167
}

src-plugin/Plugin/PluginManifest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public sealed partial class Plugin : BasePlugin
1010

1111
public override string ModuleAuthor => "K4ryuu";
1212

13-
public override string ModuleVersion => "2.0.6 " +
13+
public override string ModuleVersion => "2.0.7 " +
1414
#if RELEASE
1515
"(release)";
1616
#else

src-plugin/Plugin/PluginStock.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,30 @@ public void TerminateRoundIfPossible()
5151
{
5252
var mpRoundRestartDelay = ConVar.Find("mp_round_restart_delay");
5353
float delay = mpRoundRestartDelay != null ? mpRoundRestartDelay.GetPrimitiveValue<float>() : 3f;
54-
gameRules.TerminateRound(delay, tCount > ctCount ? RoundEndReason.TerroristsWin : ctCount > tCount ? RoundEndReason.CTsWin : RoundEndReason.RoundDraw);
54+
RoundEndReason reason;
55+
56+
if (tCount > ctCount)
57+
{
58+
reason = RoundEndReason.TerroristsWin;
59+
}
60+
else if (ctCount > tCount)
61+
{
62+
reason = RoundEndReason.CTsWin;
63+
}
64+
else // Equal alive counts
65+
{
66+
if (Config.CompatibilitySettings.PreventDrawRounds)
67+
{
68+
// Randomly choose a winner when draws should be prevented
69+
reason = Random.Shared.Next(2) == 0 ? RoundEndReason.CTsWin : RoundEndReason.TerroristsWin;
70+
}
71+
else
72+
{
73+
reason = RoundEndReason.RoundDraw;
74+
}
75+
}
76+
77+
gameRules.TerminateRound(delay, reason);
5578
}
5679
catch (Exception ex)
5780
{

src-shared/K4-ArenaSharedApi.dll

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)