Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Add penalties for team-kill assists and team-flash-assists (BUG #211) #213

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions K4-System/src/Module/Rank/RankEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void Initialize_Events()
}
else
{

RankData k4attackerRankData = k4attacker.rankData;
if (Config.RankSettings.PointsForBots || k4attacker.IsPlayer)
{
Expand All @@ -270,9 +270,12 @@ public void Initialize_Events()
else
{
string? extraInfo;
if (k4attacker.IsPlayer && k4victimRankData != null) {
if (k4attacker.IsPlayer && k4victimRankData != null)
{
extraInfo = Config.RankSettings.PlayerNameKillMessages ? plugin.Localizer["k4.phrases.kill.extra", k4victim.PlayerName, k4victimRankData.Points] : null!;
} else {
}
else
{
extraInfo = Config.RankSettings.PlayerNameKillMessages ? plugin.Localizer["k4.phrases.kill.extra", k4victim.PlayerName, 0] : null!;
}
ModifyPlayerPoints(k4attacker, CalculateDynamicPoints(k4attacker, k4victim, Config.PointSettings.Kill), "k4.phrases.kill", extraInfo);
Expand Down Expand Up @@ -383,12 +386,25 @@ public void Initialize_Events()
K4Player? k4assister = plugin.GetK4Player(@event.Assister);
if (k4assister?.IsValid == true && k4assister.IsPlayer && (Config.RankSettings.PointsForBots || k4victim.IsPlayer))
{
ModifyPlayerPoints(k4assister, Config.PointSettings.Assist, "k4.phrases.assist");
bool isFFAMode = Config.GeneralSettings.FFAMode;
bool victimIsEnemy = isFFAMode || (k4assister.Controller.Team != k4victim.Controller.Team);

if (@event.Assistedflash)
if (victimIsEnemy && [email protected])
{
ModifyPlayerPoints(k4assister, Config.PointSettings.Assist, "k4.phrases.assist");
}
else if (!victimIsEnemy && [email protected])
{
ModifyPlayerPoints(k4assister, Config.PointSettings.TeamAssist, "k4.phrases.teamassist");
}
else if (victimIsEnemy && @event.Assistedflash)
{
ModifyPlayerPoints(k4assister, Config.PointSettings.AssistFlash, "k4.phrases.assistflash");
}
else if (!victimIsEnemy && @event.Assistedflash)
{
ModifyPlayerPoints(k4assister, Config.PointSettings.TeamAssistFlash, "k4.phrases.teamassistflash");
}
}

return HookResult.Continue;
Expand Down
6 changes: 6 additions & 0 deletions K4-System/src/Plugin/PluginConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,15 @@ public sealed class PointSettings
[JsonPropertyName("assist")]
public int Assist { get; set; } = 5;

[JsonPropertyName("team-assist")]
public int TeamAssist { get; set; } = -5;

[JsonPropertyName("assist-flash")]
public int AssistFlash { get; set; } = 7;

[JsonPropertyName("team-assist-flash")]
public int TeamAssistFlash { get; set; } = -7;

[JsonPropertyName("round-win")]
public int RoundWin { get; set; } = 5;

Expand Down
2 changes: 2 additions & 0 deletions K4-System/src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
"k4.phrases.godlike": "Godlike",
"k4.phrases.assist": "Assist",
"k4.phrases.assistflash": "Assist Flash",
"k4.phrases.teamassist": "Team Assist",
"k4.phrases.teamassistflash": "Team Assist Flash",
"k4.phrases.shortyear": "y",
"k4.phrases.shortmonth": "mo",
"k4.phrases.shortday": "d",
Expand Down