1
0

Compare commits

..

No commits in common. "master" and "v1.0.0" have entirely different histories.

31 changed files with 2271 additions and 2676 deletions

View File

@ -1,33 +0,0 @@
root = true
# Global
[*]
indent_style = unset
indent_size = 4
tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = unset
# Unreal Engine 3 / Source
[*.uc]
indent_style = tab
[*.{uci,upkg}]
# Unreal Engine 3 / i18n
[*.{chn,cht,cze,dan,deu,dut,esl,esn,fra,frc,hun,int,ita,jpn,kor,pol,por,ptb,rus,tur,ukr}]
charset = utf-16le
# Other
[*.md]
indent_style = space
trim_trailing_whitespace = false
[*.yml]
indent_style = space
indent_size = 2
[*.{txt,cfg,conf}]
indent_style = tab

View File

@ -1,115 +0,0 @@
---
name: MegaLinter
permissions: read-all
on:
push:
pull_request:
branches:
- master
env:
APPLY_FIXES: none
APPLY_FIXES_EVENT: pull_request
APPLY_FIXES_MODE: commit
FILTER_REGEX_EXCLUDE: (mega-linter.yml)
DISABLE: SPELL
DISABLE_ERRORS_LINTERS: COPYPASTE_JSCPD
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
megalinter:
name: MegaLinter
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: MegaLinter
uses: oxsecurity/megalinter@7e042c726c68415475b05a65a686c612120a1232
id: ml
env:
VALIDATE_ALL_CODEBASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive production artifacts
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392
if: success() || failure()
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log
- name: Set APPLY_FIXES_IF var
run: |
printf 'APPLY_FIXES_IF=%s\n' "${{
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
)
}}" >> "${GITHUB_ENV}"
- name: Set APPLY_FIXES_IF_* vars
run: |
printf 'APPLY_FIXES_IF_PR=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'pull_request'
}}" >> "${GITHUB_ENV}"
printf 'APPLY_FIXES_IF_COMMIT=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'commit' &&
(!contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref))
}}" >> "${GITHUB_ENV}"
- name: Create Pull Request with applied fixes
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
id: cpr
if: env.APPLY_FIXES_IF_PR == 'true'
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
commit-message: "[MegaLinter] Apply linters automatic fixes"
title: "[MegaLinter] Apply linters automatic fixes"
labels: bot
- name: Create PR output
if: env.APPLY_FIXES_IF_PR == 'true'
run: |
echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Prepare commit
if: env.APPLY_FIXES_IF_COMMIT == 'true'
run: sudo chown -Rc $UID .git/
- name: Commit and push applied linter fixes
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d
if: env.APPLY_FIXES_IF_COMMIT == 'true'
with:
branch: >-
${{
github.event.pull_request.head.ref ||
github.head_ref ||
github.ref
}}
commit_message: "[MegaLinter] Apply linters fixes"
commit_user_name: "github-actions"
commit_user_email: "github-actions[bot]@users.noreply.github.com"

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
*.psd
/ignore

View File

@ -1,114 +1,103 @@
class BaseVote extends Object class BaseVote extends Object
config(CVC) config(CVC)
abstract; abstract;
var public config String PositiveColorHex; var public config String PositiveColorHex;
var public config String NegativeColorHex; var public config String NegativeColorHex;
var public config bool bChatNotifications; var public config bool bChatNotifications;
var public config bool bHudNotifications; var public config bool bHudNotifications;
var public config float DefferedClearHUD; var public config float DefferedClearHUD;
var public config int VoteTime;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) {
{ `Log_TraceStatic();
`Log_TraceStatic();
switch (Version)
switch (Version) {
{ case `NO_CONFIG:
case `NO_CONFIG: ApplyDefault(LogLevel);
ApplyDefault(LogLevel);
default: break;
case 1: }
default.VoteTime = class'KFVoteCollector'.default.VoteTime;
if (LatestVersion != Version)
default: break; {
} StaticSaveConfig();
}
if (LatestVersion != Version) }
{
StaticSaveConfig(); public static function Load(E_LogLevel LogLevel)
} {
} `Log_TraceStatic();
public static function Load(E_LogLevel LogLevel) if (!IsValidHexColor(default.PositiveColorHex, LogLevel))
{ {
`Log_TraceStatic(); `Log_Error("PositiveColorHex" @ "(" $ default.PositiveColorHex $ ")" @ "is not valid hex color");
default.PositiveColorHex = class'KFLocalMessage'.default.EventColor;
if (!IsValidHexColor(default.PositiveColorHex, LogLevel)) }
{
`Log_Error("PositiveColorHex" @ "(" $ default.PositiveColorHex $ ")" @ "is not valid hex color"); if (!IsValidHexColor(default.NegativeColorHex, LogLevel))
default.PositiveColorHex = class'KFLocalMessage'.default.EventColor; {
} `Log_Error("NegativeColorHex" @ "(" $ default.NegativeColorHex $ ")" @ "is not valid hex color");
default.NegativeColorHex = class'KFLocalMessage'.default.InteractionColor;
if (!IsValidHexColor(default.NegativeColorHex, LogLevel)) }
{
`Log_Error("NegativeColorHex" @ "(" $ default.NegativeColorHex $ ")" @ "is not valid hex color"); if (default.DefferedClearHUD < 0)
default.NegativeColorHex = class'KFLocalMessage'.default.InteractionColor; {
} `Log_Error("DefferedClearHUD" @ "(" $ default.DefferedClearHUD $ ")" @ "must be greater than 0");
default.DefferedClearHUD = 0.0f;
if (default.DefferedClearHUD < 0) }
{ }
`Log_Error("DefferedClearHUD" @ "(" $ default.DefferedClearHUD $ ")" @ "must be greater than 0");
default.DefferedClearHUD = 0.0f; protected static function ApplyDefault(E_LogLevel LogLevel)
} {
`Log_TraceStatic();
if (default.VoteTime <= 0 || default.VoteTime > 255)
{ default.bChatNotifications = true;
`Log_Error("VoteTime" @ "(" $ default.VoteTime $ ")" @ "must be in range 1-255"); default.bHudNotifications = true;
default.VoteTime = class'KFVoteCollector'.default.VoteTime; default.PositiveColorHex = class'KFLocalMessage'.default.EventColor;
} default.NegativeColorHex = class'KFLocalMessage'.default.InteractionColor;
} default.DefferedClearHUD = 1.0f;
}
protected static function ApplyDefault(E_LogLevel LogLevel)
{ protected static function bool IsValidHexColor(String HexColor, E_LogLevel LogLevel)
`Log_TraceStatic(); {
local byte Index;
default.bChatNotifications = true;
default.bHudNotifications = true; `Log_TraceStatic();
default.PositiveColorHex = class'KFLocalMessage'.default.EventColor;
default.NegativeColorHex = class'KFLocalMessage'.default.InteractionColor; if (len(HexColor) != 6) return false;
default.DefferedClearHUD = 1.0f;
default.VoteTime = class'KFVoteCollector'.default.VoteTime; HexColor = Locs(HexColor);
}
for (Index = 0; Index < 6; ++Index)
protected static function bool IsValidHexColor(String HexColor, E_LogLevel LogLevel) {
{ switch (Mid(HexColor, Index, 1))
local byte Index; {
case "0": break;
`Log_TraceStatic(); case "1": break;
case "2": break;
if (len(HexColor) != 6) return false; case "3": break;
case "4": break;
HexColor = Locs(HexColor); case "5": break;
case "6": break;
for (Index = 0; Index < 6; ++Index) case "7": break;
{ case "8": break;
switch (Mid(HexColor, Index, 1)) case "9": break;
{ case "a": break;
case "0": break; case "b": break;
case "1": break; case "c": break;
case "2": break; case "d": break;
case "3": break; case "e": break;
case "4": break; case "f": break;
case "5": break; default: return false;
case "6": break; }
case "7": break; }
case "8": break;
case "9": break; return true;
case "a": break; }
case "b": break;
case "c": break; defaultproperties
case "d": break; {
case "e": break;
case "f": break; }
default: return false;
}
}
return true;
}
defaultproperties
{
}

View File

@ -1,397 +1,387 @@
class CVC extends Info class CVC extends Info
dependson(CVC_LocalMessage) dependson(CVC_LocalMessage)
config(CVC); config(CVC);
const LatestVersion = 2; const LatestVersion = 1;
const CfgKickProtected = class'KickProtected'; const CfgKickProtected = class'KickProtected';
const CfgKickVote = class'KickVote'; const CfgKickVote = class'KickVote';
const CfgStartWaveKickProtection = class'StartWaveKickProtection'; const CfgStartWaveKickProtection = class'StartWaveKickProtection';
const CfgSkipTraderVote = class'SkipTraderVote'; const CfgSkipTraderVote = class'SkipTraderVote';
const CfgPauseVote = class'PauseVote'; const CfgPauseVote = class'PauseVote';
const CfgMapStat = class'MapStat'; const CfgMapStat = class'MapStat';
const CfgMapVote = class'MapVote'; const CfgMapVote = class'MapVote';
var private config int Version; var private config int Version;
var private config E_LogLevel LogLevel; var private config E_LogLevel LogLevel;
var private KFGameInfo KFGI; var private KFGameInfo KFGI;
var private KFGameInfo_Survival KFGIS; var private KFGameInfo_Survival KFGIS;
var private KFGameReplicationInfo KFGRI; var private KFGameReplicationInfo KFGRI;
var private Array<UniqueNetId> KickProtectedPlayers; var private Array<UniqueNetId> KickProtectedPlayers;
var private Array<CVC_RepInfo> RepInfos; var private Array<CVC_RepInfo> RepInfos;
public simulated function bool SafeDestroy() public simulated function bool SafeDestroy()
{ {
`Log_Trace(); `Log_Trace();
return (bPendingDelete || bDeleteMe || Destroy()); return (bPendingDelete || bDeleteMe || Destroy());
} }
public event PreBeginPlay() public event PreBeginPlay()
{ {
`Log_Trace(); `Log_Trace();
if (WorldInfo.NetMode == NM_Client) if (WorldInfo.NetMode == NM_Client)
{ {
`Log_Fatal("NetMode == NM_Client, Destroy..."); `Log_Fatal("NetMode == NM_Client, Destroy...");
SafeDestroy(); SafeDestroy();
return; return;
} }
Super.PreBeginPlay(); Super.PreBeginPlay();
PreInit(); PreInit();
} }
public event PostBeginPlay() public event PostBeginPlay()
{ {
`Log_Trace(); `Log_Trace();
if (bPendingDelete || bDeleteMe) return; if (bPendingDelete || bDeleteMe) return;
Super.PostBeginPlay(); Super.PostBeginPlay();
PostInit(); PostInit();
} }
private function PreInit() private function PreInit()
{ {
`Log_Trace(); `Log_Trace();
if (Version == `NO_CONFIG) if (Version == `NO_CONFIG)
{ {
LogLevel = LL_Info; LogLevel = LL_Info;
SaveConfig(); SaveConfig();
} }
CfgMapStat.static.InitConfig(Version, LatestVersion, LogLevel); CfgMapStat.static.InitConfig(Version, LatestVersion, LogLevel);
CfgMapVote.static.InitConfig(Version, LatestVersion, LogLevel); CfgMapVote.static.InitConfig(Version, LatestVersion, LogLevel);
CfgSkipTraderVote.static.InitConfig(Version, LatestVersion, LogLevel); CfgSkipTraderVote.static.InitConfig(Version, LatestVersion, LogLevel);
CfgPauseVote.static.InitConfig(Version, LatestVersion, LogLevel); CfgPauseVote.static.InitConfig(Version, LatestVersion, LogLevel);
CfgKickVote.static.InitConfig(Version, LatestVersion, LogLevel); CfgKickVote.static.InitConfig(Version, LatestVersion, LogLevel);
CfgKickProtected.static.InitConfig(Version, LatestVersion, LogLevel); CfgKickProtected.static.InitConfig(Version, LatestVersion, LogLevel);
CfgStartWaveKickProtection.static.InitConfig(Version, LatestVersion, LogLevel); CfgStartWaveKickProtection.static.InitConfig(Version, LatestVersion, LogLevel);
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
`Log_Info("Config created"); `Log_Info("Config created");
case 1: case MaxInt:
`Log_Info("Config updated to version"@LatestVersion);
case MaxInt: break;
`Log_Info("Config updated to version"@LatestVersion);
break; case LatestVersion:
`Log_Info("Config is up-to-date");
case LatestVersion: break;
`Log_Info("Config is up-to-date");
break; default:
`Log_Warn("The config version is higher than the current version (are you using an old mutator?)");
default: `Log_Warn("Config version is" @ Version @ "but current version is" @ LatestVersion);
`Log_Warn("The config version is higher than the current version (are you using an old mutator?)"); `Log_Warn("The config version will be changed to" @ LatestVersion);
`Log_Warn("Config version is" @ Version @ "but current version is" @ LatestVersion); break;
`Log_Warn("The config version will be changed to" @ LatestVersion); }
break;
} if (LatestVersion != Version)
{
if (LatestVersion != Version) Version = LatestVersion;
{ SaveConfig();
Version = LatestVersion; }
SaveConfig();
} if (LogLevel == LL_WrongLevel)
{
if (LogLevel == LL_WrongLevel) LogLevel = LL_Info;
{ `Log_Warn("Wrong 'LogLevel', return to default value");
LogLevel = LL_Info; SaveConfig();
`Log_Warn("Wrong 'LogLevel', return to default value"); }
SaveConfig(); `Log_Base("LogLevel:" @ LogLevel);
}
`Log_Base("LogLevel:" @ LogLevel); CfgKickVote.static.Load(LogLevel);
CfgSkipTraderVote.static.Load(LogLevel);
CfgKickVote.static.Load(LogLevel); CfgPauseVote.static.Load(LogLevel);
CfgSkipTraderVote.static.Load(LogLevel); CfgMapStat.static.Load(LogLevel);
CfgPauseVote.static.Load(LogLevel); CfgMapVote.static.Load(LogLevel);
CfgMapStat.static.Load(LogLevel); CfgStartWaveKickProtection.static.Load(LogLevel);
CfgMapVote.static.Load(LogLevel);
CfgStartWaveKickProtection.static.Load(LogLevel); KickProtectedPlayers = CfgKickProtected.static.Load(LogLevel);
}
KickProtectedPlayers = CfgKickProtected.static.Load(LogLevel);
} private function PostInit()
{
private function PostInit() `Log_Trace();
{
`Log_Trace(); if (WorldInfo == None || WorldInfo.Game == None)
{
if (WorldInfo == None || WorldInfo.Game == None) SetTimer(1.0f, false, nameof(PostInit));
{ return;
SetTimer(1.0f, false, nameof(PostInit)); }
return;
} KFGI = KFGameInfo(WorldInfo.Game);
if (KFGI == None)
KFGI = KFGameInfo(WorldInfo.Game); {
if (KFGI == None) `Log_Fatal("Incompatible gamemode:" @ WorldInfo.Game);
{ SafeDestroy();
`Log_Fatal("Incompatible gamemode:" @ WorldInfo.Game); return;
SafeDestroy(); }
return;
} KFGIS = KFGameInfo_Survival(KFGI);
if (KFGIS == None)
KFGIS = KFGameInfo_Survival(KFGI); {
if (KFGIS == None) `Log_Warn("Unknown gamemode (" $ KFGI $ "), KickProtectionStartWaves disabled");
{ CfgStartWaveKickProtection.default.Waves = 0;
`Log_Warn("Unknown gamemode (" $ KFGI $ "), KickProtectionStartWaves disabled"); }
CfgStartWaveKickProtection.default.Waves = 0;
} if (KFGI.GameReplicationInfo == None)
{
if (KFGI.GameReplicationInfo == None) SetTimer(1.0f, false, nameof(PostInit));
{ return;
SetTimer(1.0f, false, nameof(PostInit)); }
return;
} KFGRI = KFGameReplicationInfo(KFGI.GameReplicationInfo);
if (KFGRI == None)
KFGRI = KFGameReplicationInfo(KFGI.GameReplicationInfo); {
if (KFGRI == None) `Log_Fatal("Incompatible Replication info:" @ KFGI.GameReplicationInfo);
{ SafeDestroy();
`Log_Fatal("Incompatible Replication info:" @ KFGI.GameReplicationInfo); return;
SafeDestroy(); }
return;
} KFGRI.VoteCollectorClass = class'CVC_VoteCollector';
KFGRI.VoteCollector = new(KFGRI) KFGRI.VoteCollectorClass;
KFGRI.VoteCollectorClass = class'CVC_VoteCollector';
KFGRI.VoteCollector = new(KFGRI) KFGRI.VoteCollectorClass; if (KFGRI.VoteCollector == None)
{
if (KFGRI.VoteCollector == None) `Log_Fatal("Can't replace VoteCollector!");
{ SafeDestroy();
`Log_Fatal("Can't replace VoteCollector!"); return;
SafeDestroy(); }
return; else
} {
else CVC_VoteCollector(KFGRI.VoteCollector).CVC = Self;
{ CVC_VoteCollector(KFGRI.VoteCollector).LogLevel = LogLevel;
CVC_VoteCollector(KFGRI.VoteCollector).CVC = Self; `Log_Info("VoteCollector replaced");
CVC_VoteCollector(KFGRI.VoteCollector).LogLevel = LogLevel; }
`Log_Info("VoteCollector replaced"); }
}
} public function bool PlayerIsKickProtected(PlayerReplicationInfo PRI)
{
public function bool PlayerIsKickProtected(PlayerReplicationInfo PRI) `Log_Trace();
{
`Log_Trace(); return (KickProtectedPlayers.Find('Uid', PRI.UniqueId.Uid) != INDEX_NONE);
}
return (KickProtectedPlayers.Find('Uid', PRI.UniqueId.Uid) != INDEX_NONE);
} public function bool PlayerIsStartWaveKickProtected(KFPlayerController KFPC)
{
public function bool PlayerPerkLoaded(PlayerReplicationInfo PRI) `Log_Trace();
{
`Log_Trace(); return (PlayerOnStartWave(KFPC) && PlayerHasRequiredLevel(KFPC));
}
return (KFPlayerReplicationInfo(PRI) != None && KFPlayerReplicationInfo(PRI).CurrentPerkClass != None);
} private function bool PlayerOnStartWave(KFPlayerController KFPC)
{
public function bool PlayerIsStartWaveKickProtected(KFPlayerController KFPC) local CVC_RepInfo RepInfo;
{
`Log_Trace(); `Log_Trace();
return (PlayerOnStartWave(KFPC) && PlayerHasRequiredLevel(KFPC)); if (KFGIS != None && CfgStartWaveKickProtection.default.Waves != 0)
} {
foreach RepInfos(RepInfo)
private function bool PlayerOnStartWave(KFPlayerController KFPC) {
{ if (RepInfo.GetKFPC() == KFPC)
local CVC_RepInfo RepInfo; {
return (RepInfo.StartWave + CfgStartWaveKickProtection.default.Waves >= KFGIS.WaveNum);
`Log_Trace(); }
}
if (KFGIS != None && CfgStartWaveKickProtection.default.Waves != 0) }
{
foreach RepInfos(RepInfo) return false;
{ }
if (RepInfo.GetKFPC() == KFPC)
{ private function bool PlayerHasRequiredLevel(KFPlayerController KFPC)
return (RepInfo.StartWave + CfgStartWaveKickProtection.default.Waves >= KFGIS.WaveNum); {
} local KFPlayerReplicationInfo KFPRI;
}
} `Log_Trace();
return false; KFPRI = KFPlayerReplicationInfo(KFPC.PlayerReplicationInfo);
}
if (KFPRI == None)
private function bool PlayerHasRequiredLevel(KFPlayerController KFPC) {
{ return true;
local KFPlayerReplicationInfo KFPRI; }
`Log_Trace(); return (KFPRI.GetActivePerkLevel() >= CfgStartWaveKickProtection.default.MinLevel);
}
KFPRI = KFPlayerReplicationInfo(KFPC.PlayerReplicationInfo);
public function bool PlayerCanKickVote(KFPlayerController KFPC, optional KFPlayerController KFPC_Kickee)
if (KFPRI == None) {
{ `Log_Trace();
return true;
} if (KFPC_Kickee == None)
{
return (KFPRI.GetActivePerkLevel() >= CfgStartWaveKickProtection.default.MinLevel); KFPC_Kickee = KFPlayerController(KFGRI.VoteCollector.CurrentKickVote.PlayerPRI.Owner);
} }
public function bool PlayerCanStartKickVote(KFPlayerController KFPC, KFPlayerController KFPC_Kickee) if (KFPC_Kickee != None)
{ {
`Log_Trace(); if (KFPC == KFPC_Kickee)
{
if (KFPC_Kickee != None) return false; // kickee cant vote
{ }
if (KFPC == KFPC_Kickee) if (!PlayerHasRequiredLevel(KFPC_Kickee))
{ {
return false; // kickee cant vote return true; // always can vote for players without req level
} }
if (!PlayerHasRequiredLevel(KFPC_Kickee)) }
{
return true; // always can vote for players without req level return !PlayerOnStartWave(KFPC);
} }
}
public function BroadcastChatLocalized(E_CVC_LocalMessageType LMT, optional String HexColor, optional KFPlayerController ExceptKFPC = None, optional String String1, optional String String2)
return !PlayerOnStartWave(KFPC); {
} local CVC_RepInfo RepInfo;
public function BroadcastChatLocalized(E_CVC_LocalMessageType LMT, optional String HexColor, optional KFPlayerController ExceptKFPC = None, optional String String1, optional String String2) `Log_Trace();
{
local CVC_RepInfo RepInfo; foreach RepInfos(RepInfo)
{
`Log_Trace(); if (RepInfo.GetKFPC() != ExceptKFPC)
{
foreach RepInfos(RepInfo) RepInfo.WriteToChatLocalized(LMT, HexColor, String1, String2);
{ }
if (RepInfo.GetKFPC() != ExceptKFPC) }
{ }
RepInfo.WriteToChatLocalized(LMT, HexColor, String1, String2);
} public function BroadcastHUDLocalized(E_CVC_LocalMessageType LMT, optional float DisplayTime = 0.0f, optional String String1, optional String String2, optional String String3)
} {
} local CVC_RepInfo RepInfo;
public function BroadcastHUDLocalized(E_CVC_LocalMessageType LMT, optional float DisplayTime = 0.0f, optional String String1, optional String String2, optional String String3) `Log_Trace();
{
local CVC_RepInfo RepInfo; foreach RepInfos(RepInfo)
{
`Log_Trace(); if (RepInfo.GetKFPC() != None)
{
foreach RepInfos(RepInfo) RepInfo.WriteToHUDLocalized(LMT, String1, String2, String3, DisplayTime);
{ }
if (RepInfo.GetKFPC() != None) }
{ }
RepInfo.WriteToHUDLocalized(LMT, String1, String2, String3, DisplayTime);
} public function BroadcastClearMessageHUD(optional float DefferedTime = 0.0f)
} {
} local CVC_RepInfo RepInfo;
public function BroadcastClearMessageHUD(optional float DefferedTime = 0.0f) `Log_Trace();
{
local CVC_RepInfo RepInfo; foreach RepInfos(RepInfo)
{
`Log_Trace(); if (RepInfo.GetKFPC() != None)
{
foreach RepInfos(RepInfo) RepInfo.DefferedClearMessageHUD(DefferedTime);
{ }
if (RepInfo.GetKFPC() != None) }
{ }
RepInfo.DefferedClearMessageHUD(DefferedTime);
} public function WriteToChatLocalized(KFPlayerController KFPC, E_CVC_LocalMessageType LMT, optional String HexColor, optional String String1, optional String String2)
} {
} local CVC_RepInfo RepInfo;
public function WriteToChatLocalized(KFPlayerController KFPC, E_CVC_LocalMessageType LMT, optional String HexColor, optional String String1, optional String String2) `Log_Trace();
{
local CVC_RepInfo RepInfo; foreach RepInfos(RepInfo)
{
`Log_Trace(); if (RepInfo.GetKFPC() == KFPC)
{
foreach RepInfos(RepInfo) RepInfo.WriteToChatLocalized(LMT, HexColor, String1, String2);
{ return;
if (RepInfo.GetKFPC() == KFPC) }
{ }
RepInfo.WriteToChatLocalized(LMT, HexColor, String1, String2); }
return;
} public function WriteToHUDLocalized(KFPlayerController KFPC, E_CVC_LocalMessageType LMT, optional float DisplayTime = 0.0f, optional String String1, optional String String2, optional String String3)
} {
} local CVC_RepInfo RepInfo;
public function WriteToHUDLocalized(KFPlayerController KFPC, E_CVC_LocalMessageType LMT, optional float DisplayTime = 0.0f, optional String String1, optional String String2, optional String String3) `Log_Trace();
{
local CVC_RepInfo RepInfo; foreach RepInfos(RepInfo)
{
`Log_Trace(); if (RepInfo.GetKFPC() == KFPC)
{
foreach RepInfos(RepInfo) RepInfo.WriteToHUDLocalized(LMT, String1, String2, String3, DisplayTime);
{ return;
if (RepInfo.GetKFPC() == KFPC) }
{ }
RepInfo.WriteToHUDLocalized(LMT, String1, String2, String3, DisplayTime); }
return;
} public function NotifyLogin(Controller C)
} {
} `Log_Trace();
public function NotifyLogin(Controller C) CreateRepInfo(C);
{ }
`Log_Trace();
public function NotifyLogout(Controller C)
if (!CreateRepInfo(C)) {
{ `Log_Trace();
`Log_Error("Can't create RepInfo for:" @ C);
} DestroyRepInfo(C);
} }
public function NotifyLogout(Controller C) public function bool CreateRepInfo(Controller C)
{ {
`Log_Trace(); local CVC_RepInfo RepInfo;
if (!DestroyRepInfo(C)) `Log_Trace();
{
`Log_Error("Can't destroy RepInfo of:" @ C); if (C == None) return false;
}
} RepInfo = Spawn(class'CVC_RepInfo', C);
public function bool CreateRepInfo(Controller C) if (RepInfo == None) return false;
{
local CVC_RepInfo RepInfo; RepInfo.CVC = Self;
RepInfo.LogLevel = LogLevel;
`Log_Trace(); RepInfo.StartWave = ((KFGIS != None) ? KFGIS.WaveNum : 0);
if (C == None) return false; RepInfos.AddItem(RepInfo);
RepInfo = Spawn(class'CVC_RepInfo', C); return true;
}
if (RepInfo == None) return false;
public function bool DestroyRepInfo(Controller C)
RepInfo.CVC = Self; {
RepInfo.LogLevel = LogLevel; local CVC_RepInfo RepInfo;
RepInfo.StartWave = ((KFGIS != None) ? KFGIS.WaveNum : 0);
`Log_Trace();
RepInfos.AddItem(RepInfo);
if (C == None) return false;
return true;
} foreach RepInfos(RepInfo)
{
public function bool DestroyRepInfo(Controller C) if (RepInfo.Owner == C)
{ {
local CVC_RepInfo RepInfo; RepInfo.SafeDestroy();
RepInfos.RemoveItem(RepInfo);
`Log_Trace(); return true;
}
if (C == None) return false; }
foreach RepInfos(RepInfo) return false;
{ }
if (RepInfo.Owner == C)
{ DefaultProperties
RepInfos.RemoveItem(RepInfo); {
RepInfo.SafeDestroy();
return true;
}
}
return false;
}
defaultproperties
{
} }

View File

@ -1,4 +1,4 @@
[Flags] [Flags]
AllowDownload=True AllowDownload=True
ClientOptional=False ClientOptional=False
ServerSideOnly=False ServerSideOnly=False

View File

@ -1 +1,62 @@
class CVCMut extends Mut; // backward compatibility class CVCMut extends KFMutator;
var private CVC CVC;
public simulated function bool SafeDestroy()
{
return (bPendingDelete || bDeleteMe || Destroy());
}
public event PreBeginPlay()
{
Super.PreBeginPlay();
if (WorldInfo.NetMode == NM_Client) return;
foreach WorldInfo.DynamicActors(class'CVC', CVC)
{
`Log_Base("Found 'CVC'");
break;
}
if (CVC == None)
{
`Log_Base("Spawn 'CVC'");
CVC = WorldInfo.Spawn(class'CVC');
}
if (CVC == None)
{
`Log_Base("Can't Spawn 'CVC', Destroy...");
SafeDestroy();
}
}
public function AddMutator(Mutator Mut)
{
if (Mut == Self) return;
if (Mut.Class == Class)
Mut.Destroy();
else
Super.AddMutator(Mut);
}
public function NotifyLogin(Controller C)
{
Super.NotifyLogin(C);
CVC.NotifyLogin(C);
}
public function NotifyLogout(Controller C)
{
Super.NotifyLogout(C);
CVC.NotifyLogout(C);
}
DefaultProperties
{
}

View File

@ -1,153 +1,157 @@
class CVC_LocalMessage extends Object class CVC_LocalMessage extends Object
abstract; abstract;
var const String PlayerIsKickProtectedDefault; var const String PlayerIsKickProtectedDefault;
var private localized String PlayerIsKickProtected; var private localized String PlayerIsKickProtected;
var const String PlayerIsStartWaveKickProtectedDefault; var const String PlayerIsStartWaveKickProtectedDefault;
var private localized String PlayerIsStartWaveKickProtected; var private localized String PlayerIsStartWaveKickProtected;
var const String PlayerCantStartKickVoteDefault; var const String PlayerCantVoteDefault;
var private localized String PlayerCantStartKickVote; var private localized String PlayerCantVote;
var const String PlayerPerkIsNotLoadedDefault; var const String KickVoteNotEnoughPlayersDefault;
var private localized String PlayerPerkIsNotLoaded; var private localized String KickVoteNotEnoughPlayers;
var const String KickVoteNotEnoughPlayersDefault; var const String KickVoteStartedDefault;
var private localized String KickVoteNotEnoughPlayers; var private localized String KickVoteStarted;
var const String KickVoteStartedDefault; var const String KickVoteStartedForPlayerDefault;
var private localized String KickVoteStarted; var private localized String KickVoteStartedForPlayer;
var const String KickVoteStartedForPlayerDefault; var const String KickVoteNotStartedForPlayerDefault;
var private localized String KickVoteStartedForPlayer; var private localized String KickVoteNotStartedForPlayer;
var const String KickVoteNotStartedForPlayerDefault; var const String VotedPlayersDefault;
var private localized String KickVoteNotStartedForPlayer; var private localized String VotedPlayers;
var const String VotedPlayersDefault; var const String DidntVotePlayersDefault;
var private localized String VotedPlayers; var private localized String DidntVotePlayers;
var const String DidntVotePlayersDefault; // TODO:
var private localized String DidntVotePlayers; /*
Kick vote hud:
enum E_CVC_LocalMessageType start vote + only yes votes:
{ header: <player vote for player>
CVC_PlayerIsKickProtected, second line: yes votes
CVC_PlayerIsStartWaveKickProtected,
CVC_PlayerCantStartKickVote, pause and skip:
CVC_PlayerPerkIsNotLoaded, first line: voted players
second line: dont voted players
CVC_KickVoteNotEnoughPlayers, */
CVC_KickVoteStarted,
CVC_KickVoteStartedForPlayer, enum E_CVC_LocalMessageType
CVC_KickVoteNotStartedForPlayer, {
CVC_PlayerIsKickProtected,
CVC_KickVoteYesReceived, CVC_PlayerIsStartWaveKickProtected,
CVC_KickVoteNoReceived, CVC_PlayerCantVote,
CVC_KickVoteStartedHUD,
CVC_KickVoteReceivedHUD, CVC_KickVoteNotEnoughPlayers,
CVC_KickVoteStarted,
CVC_SkipVoteYesReceived, CVC_KickVoteStartedForPlayer,
CVC_SkipVoteNoReceived, CVC_KickVoteNotStartedForPlayer,
CVC_PauseVoteYesReceived, CVC_KickVoteYesReceived,
CVC_PauseVoteNoReceived, CVC_KickVoteNoReceived,
CVC_KickVoteStartedHUD,
CVC_VoteProgressHUD, CVC_KickVoteReceivedHUD,
};
CVC_SkipVoteYesReceived,
private static function String ReplKicker(String Str, String Kicker) CVC_SkipVoteNoReceived,
{
return Repl(Str, "<kicker>", Kicker, false); CVC_PauseVoteYesReceived,
} CVC_PauseVoteNoReceived,
private static function String ReplKickee(String Str, String Kickee) CVC_VoteProgressHUD,
{ };
return Repl(Str, "<kickee>", Kickee, false);
} private static function String ReplKicker(String Str, String Kicker)
{
private static function String ReplWaves(String Str, String Waves) return Repl(Str, "<kicker>", Kicker, false);
{ }
return Repl(Str, "<waves>", Waves, false);
} private static function String ReplKickee(String Str, String Kickee)
{
public static function String GetLocalizedString( return Repl(Str, "<kickee>", Kickee, false);
E_LogLevel LogLevel, }
E_CVC_LocalMessageType LMT,
optional String String1, private static function String ReplWaves(String Str, String Waves)
optional String String2, {
optional String String3) return Repl(Str, "<waves>", Waves, false);
{ }
`Log_TraceStatic();
public static function String GetLocalizedString(
switch (LMT) E_LogLevel LogLevel,
{ E_CVC_LocalMessageType LMT,
case CVC_PlayerIsKickProtected: optional String String1,
return ReplKickee(default.PlayerIsKickProtected != "" ? default.PlayerIsKickProtected : default.PlayerIsKickProtectedDefault, String1); optional String String2,
optional String String3)
case CVC_PlayerIsStartWaveKickProtected: {
return ReplWaves(ReplKickee(default.PlayerIsStartWaveKickProtected != "" ? default.PlayerIsStartWaveKickProtected : default.PlayerIsStartWaveKickProtectedDefault, String1), String2); `Log_TraceStatic();
case CVC_PlayerCantStartKickVote: switch (LMT)
return ReplWaves(default.PlayerCantStartKickVote != "" ? default.PlayerCantStartKickVote : default.PlayerCantStartKickVoteDefault, String1); {
case CVC_PlayerIsKickProtected:
case CVC_PlayerPerkIsNotLoaded: return ReplKickee(default.PlayerIsKickProtected != "" ? default.PlayerIsKickProtected : default.PlayerIsKickProtectedDefault, String1);
return ReplKickee(default.PlayerPerkIsNotLoaded != "" ? default.PlayerPerkIsNotLoaded : default.PlayerPerkIsNotLoadedDefault, String1);
case CVC_PlayerIsStartWaveKickProtected:
case CVC_KickVoteNotEnoughPlayers: return ReplWaves(ReplKickee(default.PlayerIsStartWaveKickProtected != "" ? default.PlayerIsStartWaveKickProtected : default.PlayerIsStartWaveKickProtectedDefault, String1), String2);
return ReplWaves(default.KickVoteNotEnoughPlayers != "" ? default.KickVoteNotEnoughPlayers : default.KickVoteNotEnoughPlayersDefault, String1);
case CVC_PlayerCantVote:
case CVC_KickVoteYesReceived: return ReplWaves(default.PlayerCantVote != "" ? default.PlayerCantVote : default.PlayerCantVoteDefault, String1);
return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.YesString);
case CVC_KickVoteNotEnoughPlayers:
case CVC_KickVoteNoReceived: return ReplWaves(default.KickVoteNotEnoughPlayers != "" ? default.KickVoteNotEnoughPlayers : default.KickVoteNotEnoughPlayersDefault, String1);
return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.NoString);
case CVC_KickVoteYesReceived:
case CVC_KickVoteStartedHUD: return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.YesString);
return ReplKickee(ReplKicker((default.KickVoteStarted != "" ? default.KickVoteStarted : default.KickVoteStartedDefault), String1), String2) $ "\n" $ class'KFCommon_LocalizedStrings'.default.YesString $ ":" @ String3;
case CVC_KickVoteNoReceived:
case CVC_KickVoteReceivedHUD: return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.NoString);
return class'KFCommon_LocalizedStrings'.default.YesString $ ":" @ String1 $ "\n" $ class'KFCommon_LocalizedStrings'.default.NoString $ ":" @ String2;
case CVC_KickVoteStartedHUD:
case CVC_KickVoteStarted: return ReplKickee(ReplKicker((default.KickVoteStarted != "" ? default.KickVoteStarted : default.KickVoteStartedDefault), String1), String2) $ "\n" $ class'KFCommon_LocalizedStrings'.default.YesString $ ":" @ String3;
return ReplKickee(ReplKicker((default.KickVoteStarted != "" ? default.KickVoteStarted : default.KickVoteStartedDefault), String1), String2);
case CVC_KickVoteReceivedHUD:
case CVC_KickVoteStartedForPlayer: return class'KFCommon_LocalizedStrings'.default.YesString $ ":" @ String1 $ "\n" $ class'KFCommon_LocalizedStrings'.default.NoString $ ":" @ String2;
return ReplKicker((default.KickVoteStartedForPlayer != "" ? default.KickVoteStartedForPlayer : default.KickVoteStartedForPlayerDefault), String1);
case CVC_KickVoteStarted:
case CVC_KickVoteNotStartedForPlayer: return ReplKickee(ReplKicker((default.KickVoteStarted != "" ? default.KickVoteStarted : default.KickVoteStartedDefault), String1), String2);
return ReplKicker((default.KickVoteNotStartedForPlayer != "" ? default.KickVoteNotStartedForPlayer : default.KickVoteNotStartedForPlayerDefault), String1);
case CVC_KickVoteStartedForPlayer:
case CVC_SkipVoteYesReceived: return ReplKicker((default.KickVoteStartedForPlayer != "" ? default.KickVoteStartedForPlayer : default.KickVoteStartedForPlayerDefault), String1);
return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.YesString);
case CVC_KickVoteNotStartedForPlayer:
case CVC_SkipVoteNoReceived: return ReplKicker((default.KickVoteNotStartedForPlayer != "" ? default.KickVoteNotStartedForPlayer : default.KickVoteNotStartedForPlayerDefault), String1);
return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.NoString);
case CVC_SkipVoteYesReceived:
case CVC_PauseVoteYesReceived: return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.YesString);
return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.YesString);
case CVC_SkipVoteNoReceived:
case CVC_PauseVoteNoReceived: return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.NoString);
return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.NoString);
case CVC_PauseVoteYesReceived:
case CVC_VoteProgressHUD: return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.YesString);
return (default.DidntVotePlayers != "" ? default.DidntVotePlayers : default.DidntVotePlayersDefault) @ String2 $ (String1 != "" ? ("\n" $ (default.VotedPlayers != "" ? default.VotedPlayers : default.VotedPlayersDefault) @ String1) : "");
} case CVC_PauseVoteNoReceived:
return (String1 $ ":" @ class'KFCommon_LocalizedStrings'.default.NoString);
return "";
} case CVC_VoteProgressHUD:
return (default.VotedPlayers != "" ? default.VotedPlayers : default.VotedPlayersDefault) @ String1 $ (String2 != "" ? ("\n" $ (default.DidntVotePlayers != "" ? default.DidntVotePlayers : default.DidntVotePlayersDefault) @ String2) : "");
defaultproperties }
{
PlayerIsKickProtectedDefault = "<kickee> is protected from kick" return "";
PlayerIsStartWaveKickProtectedDefault = "You can't kick <kickee> right now. He can be kicked when he plays at least <waves> wave(s)" }
PlayerCantStartKickVoteDefault = "You can't start kick vote now. You can start kick vote when you play at least <waves> wave(s)"
PlayerPerkIsNotLoadedDefault = "You can't kick a player who hasn't loaded yet (<kickee>)" defaultproperties
KickVoteNotEnoughPlayersDefault = "Not enough players to start vote (only players who have played at least <waves> wave(s) can vote)" {
KickVoteStartedDefault = "<kicker> has started a vote to kick <kickee>" PlayerIsKickProtectedDefault = "<kickee> is protected from kick"
KickVoteStartedForPlayerDefault = "<kicker> started voting to kick you" PlayerIsStartWaveKickProtectedDefault = "You can't kick <kickee> right now. He can be kicked when he plays at least <waves> wave(s)"
KickVoteNotStartedForPlayerDefault = "<kicker> tried to kick you" PlayerCantVoteDefault = "You can't vote for kick now. You can vote when you play at least <waves> wave(s)"
VotedPlayersDefault = "Voted:" KickVoteNotEnoughPlayersDefault = "Not enough players to start vote (only players who have played at least <waves> wave(s) can vote)"
DidntVotePlayersDefault = "Didn't vote:" KickVoteStartedDefault = "<kicker> has started a vote to kick <kickee>"
KickVoteStartedForPlayerDefault = "<kicker> started voting to kick you"
KickVoteNotStartedForPlayerDefault = "<kicker> tried to kick you"
VotedPlayersDefault = "Voted:"
DidntVotePlayersDefault = "Didn't vote:"
} }

View File

@ -1,124 +1,123 @@
class CVC_RepInfo extends ReplicationInfo; class CVC_RepInfo extends ReplicationInfo;
const CVCLMT = class'CVC_LocalMessage'; const CVCLMT = class'CVC_LocalMessage';
var public E_LogLevel LogLevel; var public E_LogLevel LogLevel;
var public CVC CVC; var public CVC CVC;
var public int StartWave; var public int StartWave;
var private KFPlayerController KFPC; var private KFPlayerController KFPC;
replication replication
{ {
if (bNetInitial && Role == ROLE_Authority) if (bNetInitial && Role == ROLE_Authority)
LogLevel; LogLevel;
} }
public simulated function bool SafeDestroy() public simulated function bool SafeDestroy()
{ {
`Log_Trace(); `Log_Trace();
return (bPendingDelete || bDeleteMe || Destroy()); return (bPendingDelete || bDeleteMe || Destroy());
} }
public reliable client function WriteToChatLocalized(E_CVC_LocalMessageType LMT, optional String HexColor, optional String String1, optional String String2, optional String String3) public reliable client function WriteToChatLocalized(E_CVC_LocalMessageType LMT, optional String HexColor, optional String String1, optional String String2, optional String String3)
{ {
`Log_Trace(); `Log_Trace();
WriteToChat(CVCLMT.static.GetLocalizedString(LogLevel, LMT, String1, String2, String3), HexColor); WriteToChat(CVCLMT.static.GetLocalizedString(LogLevel, LMT, String1, String2, String3), HexColor);
} }
public reliable client function WriteToChat(String Message, optional String HexColor) public reliable client function WriteToChat(String Message, optional String HexColor)
{ {
local KFGFxHudWrapper HUD; local KFGFxHudWrapper HUD;
`Log_Trace(); `Log_Trace();
if (GetKFPC() == None) return; if (GetKFPC() == None) return;
if (KFPC.MyGFxManager.PartyWidget != None && KFPC.MyGFxManager.PartyWidget.PartyChatWidget != None) if (KFPC.MyGFxManager.PartyWidget != None && KFPC.MyGFxManager.PartyWidget.PartyChatWidget != None)
{ {
KFPC.MyGFxManager.PartyWidget.PartyChatWidget.SetVisible(true); KFPC.MyGFxManager.PartyWidget.PartyChatWidget.AddChatMessage(Message, HexColor);
KFPC.MyGFxManager.PartyWidget.PartyChatWidget.AddChatMessage(Message, HexColor); }
}
HUD = KFGFxHudWrapper(KFPC.myHUD);
HUD = KFGFxHudWrapper(KFPC.myHUD); if (HUD != None && HUD.HUDMovie != None && HUD.HUDMovie.HudChatBox != None)
if (HUD != None && HUD.HUDMovie != None && HUD.HUDMovie.HudChatBox != None) {
{ HUD.HUDMovie.HudChatBox.AddChatMessage(Message, HexColor);
HUD.HUDMovie.HudChatBox.AddChatMessage(Message, HexColor); }
} }
}
public reliable client function WriteToHUDLocalized(E_CVC_LocalMessageType LMT, optional String String1, optional String String2, optional String String3, optional float DisplayTime = 0.0f)
public reliable client function WriteToHUDLocalized(E_CVC_LocalMessageType LMT, optional String String1, optional String String2, optional String String3, optional float DisplayTime = 0.0f) {
{ `Log_Trace();
`Log_Trace();
WriteToHUD(CVCLMT.static.GetLocalizedString(LogLevel, LMT, String1, String2, String3), DisplayTime);
WriteToHUD(CVCLMT.static.GetLocalizedString(LogLevel, LMT, String1, String2, String3), DisplayTime); }
}
public reliable client function WriteToHUD(String Message, optional float DisplayTime = 0.0f)
public reliable client function WriteToHUD(String Message, optional float DisplayTime = 0.0f) {
{ `Log_Trace();
`Log_Trace();
if (GetKFPC() == None) return;
if (GetKFPC() == None) return;
if (DisplayTime == 0.0f)
if (DisplayTime == 0.0f) {
{ DisplayTime = CalcDisplayTime(Message);
DisplayTime = CalcDisplayTime(Message); }
}
if (KFPC.MyGFxHUD != None)
if (KFPC.MyGFxHUD != None) {
{ KFPC.MyGFxHUD.DisplayMapText(Message, DisplayTime, false);
KFPC.MyGFxHUD.DisplayMapText(Message, DisplayTime, false); }
} }
}
public reliable client function DefferedClearMessageHUD(optional float Time = 0.0f)
public reliable client function DefferedClearMessageHUD(optional float Time = 0.0f) {
{ `Log_Trace();
`Log_Trace();
SetTimer(Time, false, nameof(ClearMessageHUD));
SetTimer(Time, false, nameof(ClearMessageHUD)); }
}
public reliable client function ClearMessageHUD()
public reliable client function ClearMessageHUD() {
{ `Log_Trace();
`Log_Trace();
if (GetKFPC() == None) return;
if (GetKFPC() == None) return;
if (KFPC.MyGFxHUD != None && KFPC.MyGFxHUD.MapTextWidget != None)
if (KFPC.MyGFxHUD != None && KFPC.MyGFxHUD.MapTextWidget != None) {
{ KFPC.MyGFxHUD.MapTextWidget.StoredMessageList.Length = 0;
KFPC.MyGFxHUD.MapTextWidget.StoredMessageList.Length = 0; KFPC.MyGFxHUD.MapTextWidget.HideMessage();
KFPC.MyGFxHUD.MapTextWidget.HideMessage(); }
} }
}
private function float CalcDisplayTime(String Message)
private function float CalcDisplayTime(String Message) {
{ `Log_Trace();
`Log_Trace();
return FClamp(Len(Message) / 20.0f, 3, 30);
return FClamp(Len(Message) / 20.0f, 3, 30); }
}
public simulated function KFPlayerController GetKFPC()
public simulated function KFPlayerController GetKFPC() {
{ `Log_Trace();
`Log_Trace();
if (KFPC != None) return KFPC;
if (KFPC != None) return KFPC;
KFPC = KFPlayerController(Owner);
KFPC = KFPlayerController(Owner);
if (KFPC == None && ROLE < ROLE_Authority)
if (KFPC == None && ROLE < ROLE_Authority) {
{ KFPC = KFPlayerController(GetALocalPlayerController());
KFPC = KFPlayerController(GetALocalPlayerController()); }
}
return KFPC;
return KFPC; }
}
defaultproperties
defaultproperties {
{ bAlwaysRelevant = false
bAlwaysRelevant = false bOnlyRelevantToOwner = true
bOnlyRelevantToOwner = true bSkipActorPropertyReplication = false
bSkipActorPropertyReplication = false }
}

File diff suppressed because it is too large Load Diff

View File

@ -1,82 +1,82 @@
class KickProtected extends Object class KickProtected extends Object
config(CVC) config(CVC)
abstract; abstract;
var public config bool NotifyPlayerAboutKickAttempt; var public config bool NotifyPlayerAboutKickAttempt;
var private config Array<String> PlayerID; var private config Array<String> PlayerID;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
ApplyDefault(LogLevel); ApplyDefault(LogLevel);
default: break; default: break;
} }
if (LatestVersion != Version) if (LatestVersion != Version)
{ {
StaticSaveConfig(); StaticSaveConfig();
} }
} }
public static function Array<UniqueNetId> Load(E_LogLevel LogLevel) public static function Array<UniqueNetId> Load(E_LogLevel LogLevel)
{ {
local Array<UniqueNetId> UIDs; local Array<UniqueNetId> UIDs;
local UniqueNetId UID; local UniqueNetId UID;
local String ID; local String ID;
`Log_TraceStatic(); `Log_TraceStatic();
foreach default.PlayerID(ID) foreach default.PlayerID(ID)
{ {
if (AnyToUID(ID, UID, LogLevel)) if (AnyToUID(ID, UID, LogLevel))
{ {
UIDs.AddItem(UID); UIDs.AddItem(UID);
} }
else else
{ {
`Log_Warn("Can't load PlayerID:" @ ID); `Log_Warn("Can't load PlayerID:" @ ID);
} }
} }
return UIDs; return UIDs;
} }
private static function ApplyDefault(E_LogLevel LogLevel) private static function ApplyDefault(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
default.NotifyPlayerAboutKickAttempt = true; default.NotifyPlayerAboutKickAttempt = true;
default.PlayerID.Length = 0; default.PlayerID.Length = 0;
default.PlayerID.AddItem("76561190000000000"); default.PlayerID.AddItem("76561190000000000");
default.PlayerID.AddItem("0x0000000000000000"); default.PlayerID.AddItem("0x0000000000000000");
} }
private static function bool IsUID(String ID, E_LogLevel LogLevel) private static function bool IsUID(String ID, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
return (Left(ID, 2) ~= "0x"); return (Locs(Left(ID, 2)) ~= "0x");
} }
private static function bool AnyToUID(String ID, out UniqueNetId UID, E_LogLevel LogLevel) private static function bool AnyToUID(String ID, out UniqueNetId UID, E_LogLevel LogLevel)
{ {
local OnlineSubsystem OS; local OnlineSubsystem OS;
`Log_TraceStatic(); `Log_TraceStatic();
OS = class'GameEngine'.static.GetOnlineSubsystem(); OS = class'GameEngine'.static.GetOnlineSubsystem();
if (OS == None) return false; if (OS == None) return false;
return IsUID(ID, LogLevel) ? OS.StringToUniqueNetId(ID, UID) : OS.Int64ToUniqueNetId(ID, UID); return IsUID(ID, LogLevel) ? OS.StringToUniqueNetId(ID, UID) : OS.Int64ToUniqueNetId(ID, UID);
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,52 +1,52 @@
class KickVote extends BaseVote class KickVote extends BaseVote
config(CVC) config(CVC)
abstract; abstract;
var public config bool bHudNotificationsOnlyOnTraderTime; var public config bool bHudNotificationsOnlyOnTraderTime;
var public config int MinVotingPlayersToStartKickVote; var public config int MinVotingPlayersToStartKickVote;
var public config int MaxKicks; var public config int MaxKicks;
var public config bool bLogKickVote; var public config bool bLogKickVote;
var public config String WarningColorHex; var public config String WarningColorHex;
public static function Load(E_LogLevel LogLevel) public static function Load(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
if (default.MinVotingPlayersToStartKickVote < 2) if (default.MinVotingPlayersToStartKickVote < 2)
{ {
`Log_Error("MinVotingPlayersToStartKickVote" @ "(" $ default.MinVotingPlayersToStartKickVote $ ")" @ "must be greater than 1"); `Log_Error("MinVotingPlayersToStartKickVote" @ "(" $ default.MinVotingPlayersToStartKickVote $ ")" @ "must be greater than 1");
default.MinVotingPlayersToStartKickVote = 2; default.MinVotingPlayersToStartKickVote = 2;
} }
if (default.MaxKicks < 1) if (default.MaxKicks < 1)
{ {
`Log_Error("MaxKicks" @ "(" $ default.MaxKicks $ ")" @ "must be greater than 0"); `Log_Error("MaxKicks" @ "(" $ default.MaxKicks $ ")" @ "must be greater than 0");
default.MaxKicks = 2; default.MaxKicks = 2;
} }
if (!IsValidHexColor(default.WarningColorHex, LogLevel)) if (!IsValidHexColor(default.WarningColorHex, LogLevel))
{ {
`Log_Error("WarningColorHex" @ "(" $ default.WarningColorHex $ ")" @ "is not valid hex color"); `Log_Error("WarningColorHex" @ "(" $ default.WarningColorHex $ ")" @ "is not valid hex color");
default.WarningColorHex = class'KFLocalMessage'.default.PriorityColor; default.WarningColorHex = class'KFLocalMessage'.default.PriorityColor;
} }
Super.Load(LogLevel); Super.Load(LogLevel);
} }
protected static function ApplyDefault(E_LogLevel LogLevel) protected static function ApplyDefault(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
Super.ApplyDefault(LogLevel); Super.ApplyDefault(LogLevel);
default.bHudNotificationsOnlyOnTraderTime = true; default.bHudNotificationsOnlyOnTraderTime = true;
default.MinVotingPlayersToStartKickVote = 2; default.MinVotingPlayersToStartKickVote = 2;
default.MaxKicks = 2; default.MaxKicks = 2;
default.DefferedClearHUD = 2.0f; default.DefferedClearHUD = 2.0f;
default.WarningColorHex = class'KFLocalMessage'.default.PriorityColor; default.WarningColorHex = class'KFLocalMessage'.default.PriorityColor;
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,57 +1,57 @@
class MapStat extends Object class MapStat extends Object
config(CVC) config(CVC)
abstract; abstract;
var public config bool bEnable; var public config bool bEnable;
var public config String SortPolicy; var public config String SortPolicy;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
ApplyDefault(LogLevel); ApplyDefault(LogLevel);
default: break; default: break;
} }
if (LatestVersion != Version) if (LatestVersion != Version)
{ {
StaticSaveConfig(); StaticSaveConfig();
} }
} }
public static function Load(E_LogLevel LogLevel) public static function Load(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Locs(default.SortPolicy)) switch (Locs(default.SortPolicy))
{ {
case "counterasc": return; case "counterasc": return;
case "counterdesc": return; case "counterdesc": return;
case "nameasc": return; case "nameasc": return;
case "namedesc": return; case "namedesc": return;
case "playtimetotalasc": return; case "playtimetotalasc": return;
case "playtimetotaldesc": return; case "playtimetotaldesc": return;
case "playtimeavgasc": return; case "playtimeavgasc": return;
case "playtimeavgdesc": return; case "playtimeavgdesc": return;
} }
`Log_Error("Can't load SortPolicy (" $ default.SortPolicy $ "), must be one of: CounterAsc CounterDesc NameAsc NameDesc PlaytimeTotalAsc PlaytimeTotalDesc PlaytimeAvgAsc PlaytimeAvgDesc"); `Log_Error("Can't load SortPolicy (" $ default.SortPolicy $ "), must be one of: CounterAsc CounterDesc NameAsc NameDesc PlaytimeTotalAsc PlaytimeTotalDesc PlaytimeAvgAsc PlaytimeAvgDesc");
default.SortPolicy = "CounterDesc"; default.SortPolicy = "CounterDesc";
} }
protected static function ApplyDefault(E_LogLevel LogLevel) protected static function ApplyDefault(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
default.bEnable = false; default.bEnable = false;
default.SortPolicy = "CounterDesc"; default.SortPolicy = "CounterDesc";
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,70 +1,70 @@
class MapStats extends Object class MapStats extends Object
config(MapStats); config(MapStats);
struct MapStatEntry struct MapStatEntry
{ {
var String Name; // map var String Name; // map
var int Counter; // play count var int Counter; // play count
var int PlayTimeTotal; // minutes total var int PlayTimeTotal; // minutes total
var int PlayTimeAvg; // minutes per map var int PlayTimeAvg; // minutes per map
}; };
var config array<MapStatEntry> MapStat; var config array<MapStatEntry> MapStat;
static delegate int CounterAsc (MapStatEntry A, MapStatEntry B) { return B.Counter < A.Counter ? -1 : 0; } static delegate int CounterAsc (MapStatEntry A, MapStatEntry B) { return B.Counter < A.Counter ? -1 : 0; }
static delegate int CounterDesc (MapStatEntry A, MapStatEntry B) { return A.Counter < B.Counter ? -1 : 0; } static delegate int CounterDesc (MapStatEntry A, MapStatEntry B) { return A.Counter < B.Counter ? -1 : 0; }
static delegate int NameAsc (MapStatEntry A, MapStatEntry B) { return B.Name < A.Name ? -1 : 0; } static delegate int NameAsc (MapStatEntry A, MapStatEntry B) { return B.Name < A.Name ? -1 : 0; }
static delegate int NameDesc (MapStatEntry A, MapStatEntry B) { return A.Name < B.Name ? -1 : 0; } static delegate int NameDesc (MapStatEntry A, MapStatEntry B) { return A.Name < B.Name ? -1 : 0; }
static delegate int PlayTimeTotalAsc (MapStatEntry A, MapStatEntry B) { return B.PlayTimeTotal < A.PlayTimeTotal ? -1 : 0; } static delegate int PlayTimeTotalAsc (MapStatEntry A, MapStatEntry B) { return B.PlayTimeTotal < A.PlayTimeTotal ? -1 : 0; }
static delegate int PlayTimeTotalDesc (MapStatEntry A, MapStatEntry B) { return A.PlayTimeTotal < B.PlayTimeTotal ? -1 : 0; } static delegate int PlayTimeTotalDesc (MapStatEntry A, MapStatEntry B) { return A.PlayTimeTotal < B.PlayTimeTotal ? -1 : 0; }
static delegate int PlayTimeAvgAsc (MapStatEntry A, MapStatEntry B) { return B.PlayTimeAvg < A.PlayTimeAvg ? -1 : 0; } static delegate int PlayTimeAvgAsc (MapStatEntry A, MapStatEntry B) { return B.PlayTimeAvg < A.PlayTimeAvg ? -1 : 0; }
static delegate int PlayTimeAvgDesc (MapStatEntry A, MapStatEntry B) { return A.PlayTimeAvg < B.PlayTimeAvg ? -1 : 0; } static delegate int PlayTimeAvgDesc (MapStatEntry A, MapStatEntry B) { return A.PlayTimeAvg < B.PlayTimeAvg ? -1 : 0; }
static function SortMapStat(String SortPolicy, E_LogLevel LogLevel) static function SortMapStat(String SortPolicy, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Locs(SortPolicy)) switch (Locs(SortPolicy))
{ {
case "counterasc": default.MapStat.Sort(CounterAsc); break; case "counterasc": default.MapStat.Sort(CounterAsc); break;
case "counterdesc": default.MapStat.Sort(CounterDesc); break; case "counterdesc": default.MapStat.Sort(CounterDesc); break;
case "nameasc": default.MapStat.Sort(NameAsc); break; case "nameasc": default.MapStat.Sort(NameAsc); break;
case "namedesc": default.MapStat.Sort(NameDesc); break; case "namedesc": default.MapStat.Sort(NameDesc); break;
case "playtimetotalasc": default.MapStat.Sort(PlayTimeTotalAsc); break; case "playtimetotalasc": default.MapStat.Sort(PlayTimeTotalAsc); break;
case "playtimetotaldesc": default.MapStat.Sort(PlayTimeTotalDesc); break; case "playtimetotaldesc": default.MapStat.Sort(PlayTimeTotalDesc); break;
case "playtimeavgasc": default.MapStat.Sort(PlayTimeAvgAsc); break; case "playtimeavgasc": default.MapStat.Sort(PlayTimeAvgAsc); break;
case "playtimeavgdesc": default.MapStat.Sort(PlayTimeAvgDesc); break; case "playtimeavgdesc": default.MapStat.Sort(PlayTimeAvgDesc); break;
} }
} }
static function IncMapStat(String Map, int PlayTime, String SortPolicy, E_LogLevel LogLevel) static function IncMapStat(String Map, int PlayTime, String SortPolicy, E_LogLevel LogLevel)
{ {
local int MapStatEntryIndex; local int MapStatEntryIndex;
local MapStatEntry NewEntry; local MapStatEntry NewEntry;
`Log_TraceStatic(); `Log_TraceStatic();
MapStatEntryIndex = default.MapStat.Find('Name', Map); MapStatEntryIndex = default.MapStat.Find('Name', Map);
if (MapStatEntryIndex == INDEX_NONE) if (MapStatEntryIndex == INDEX_NONE)
{ {
NewEntry.Name = Map; NewEntry.Name = Map;
NewEntry.Counter = 1; NewEntry.Counter = 1;
NewEntry.PlayTimeTotal = PlayTime; NewEntry.PlayTimeTotal = PlayTime;
NewEntry.PlayTimeAvg = PlayTime; NewEntry.PlayTimeAvg = PlayTime;
default.MapStat.AddItem(NewEntry); default.MapStat.AddItem(NewEntry);
} }
else else
{ {
default.MapStat[MapStatEntryIndex].Counter++; default.MapStat[MapStatEntryIndex].Counter++;
default.MapStat[MapStatEntryIndex].PlayTimeTotal += PlayTime; default.MapStat[MapStatEntryIndex].PlayTimeTotal += PlayTime;
default.MapStat[MapStatEntryIndex].PlayTimeAvg = default.MapStat[MapStatEntryIndex].PlayTimeTotal / default.MapStat[MapStatEntryIndex].Counter; default.MapStat[MapStatEntryIndex].PlayTimeAvg = default.MapStat[MapStatEntryIndex].PlayTimeTotal / default.MapStat[MapStatEntryIndex].Counter;
} }
SortMapStat(SortPolicy, LogLevel); SortMapStat(SortPolicy, LogLevel);
StaticSaveConfig(); StaticSaveConfig();
} }
defaultproperties DefaultProperties
{ {
} }

View File

@ -1,57 +1,57 @@
class MapVote extends Object class MapVote extends Object
config(CVC) config(CVC)
abstract; abstract;
var public config String DefaultNextMap; // Any, Official, Custom, KF-<MapName> var public config String DefaultNextMap; // Any, Official, Custom, KF-<MapName>
var public config bool bRandomizeNextMap; var public config bool bRandomizeNextMap;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
ApplyDefault(LogLevel); ApplyDefault(LogLevel);
default: break; default: break;
} }
if (LatestVersion != Version) if (LatestVersion != Version)
{ {
StaticSaveConfig(); StaticSaveConfig();
} }
} }
public static function Load(E_LogLevel LogLevel) public static function Load(E_LogLevel LogLevel)
{ {
local String LowerDefaultNextMap; local String LowerDefaultNextMap;
`Log_TraceStatic(); `Log_TraceStatic();
LowerDefaultNextMap = Locs(default.DefaultNextMap); LowerDefaultNextMap = Locs(default.DefaultNextMap);
switch (LowerDefaultNextMap) switch (LowerDefaultNextMap)
{ {
case "any": return; case "any": return;
case "official": return; case "official": return;
case "custom": return; case "custom": return;
default: if (Left(LowerDefaultNextMap, 3) == "kf-") return; default: if (Left(LowerDefaultNextMap, 3) == "kf-") return;
} }
`Log_Error("Can't load DefaultNextMap (" $ default.DefaultNextMap $ "), must be one of: Any Official Custom KF-<MapName>"); `Log_Error("Can't load DefaultNextMap (" $ default.DefaultNextMap $ "), must be one of: Any Official Custom KF-<MapName>");
default.DefaultNextMap = "Any"; default.DefaultNextMap = "Any";
} }
protected static function ApplyDefault(E_LogLevel LogLevel) protected static function ApplyDefault(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
default.bRandomizeNextMap = true; default.bRandomizeNextMap = true;
default.DefaultNextMap = "Any"; default.DefaultNextMap = "Any";
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,60 +0,0 @@
class Mut extends KFMutator;
var private CVC CVC;
public simulated function bool SafeDestroy()
{
return (bPendingDelete || bDeleteMe || Destroy());
}
public event PreBeginPlay()
{
Super.PreBeginPlay();
if (WorldInfo.NetMode == NM_Client) return;
foreach WorldInfo.DynamicActors(class'CVC', CVC)
{
break;
}
if (CVC == None)
{
CVC = WorldInfo.Spawn(class'CVC');
}
if (CVC == None)
{
`Log_Base("FATAL: Can't Spawn 'CVC'");
SafeDestroy();
}
}
public function AddMutator(Mutator M)
{
if (M == Self) return;
if (M.Class == Class)
Mut(M).SafeDestroy();
else
Super.AddMutator(M);
}
public function NotifyLogin(Controller C)
{
Super.NotifyLogin(C);
CVC.NotifyLogin(C);
}
public function NotifyLogout(Controller C)
{
Super.NotifyLogout(C);
CVC.NotifyLogout(C);
}
defaultproperties
{
GroupNames.Add("VoteCollector")
}

View File

@ -1,19 +1,19 @@
class PauseVote extends BaseVote class PauseVote extends BaseVote
config(CVC) config(CVC)
abstract; abstract;
protected static function ApplyDefault(E_LogLevel LogLevel) protected static function ApplyDefault(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
Super.ApplyDefault(LogLevel); Super.ApplyDefault(LogLevel);
default.PositiveColorHex = class'KFLocalMessage'.default.GameColor; default.PositiveColorHex = class'KFLocalMessage'.default.GameColor;
default.bChatNotifications = false; default.bChatNotifications = false;
default.bHudNotifications = false; default.bHudNotifications = false;
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,19 +1,19 @@
class SkipTraderVote extends BaseVote class SkipTraderVote extends BaseVote
config(CVC) config(CVC)
abstract; abstract;
protected static function ApplyDefault(E_LogLevel LogLevel) protected static function ApplyDefault(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
Super.ApplyDefault(LogLevel); Super.ApplyDefault(LogLevel);
default.PositiveColorHex = class'KFLocalMessage'.default.GameColor; default.PositiveColorHex = class'KFLocalMessage'.default.GameColor;
default.bChatNotifications = false; default.bChatNotifications = false;
default.bHudNotifications = false; default.bHudNotifications = false;
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,54 +1,54 @@
class StartWaveKickProtection extends Object class StartWaveKickProtection extends Object
config(CVC) config(CVC)
abstract; abstract;
var public config int Waves; var public config int Waves;
var public config int MinLevel; var public config int MinLevel;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
ApplyDefault(LogLevel); ApplyDefault(LogLevel);
default: break; default: break;
} }
if (LatestVersion != Version) if (LatestVersion != Version)
{ {
StaticSaveConfig(); StaticSaveConfig();
} }
} }
public static function Load(E_LogLevel LogLevel) public static function Load(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
if (default.Waves < 0) if (default.Waves < 0)
{ {
`Log_Error("Waves" @ "(" $ default.Waves $ ")" @ "must be greater than or equal 0"); `Log_Error("Waves" @ "(" $ default.Waves $ ")" @ "must be greater than or equal 0");
default.Waves = 0; default.Waves = 0;
} }
if (default.MinLevel < 0 || default.MinLevel > 25) if (default.MinLevel < 0 || default.MinLevel > 25)
{ {
`Log_Error("MinLevel" @ "(" $ default.MinLevel $ ")" @ "must be in range 0-25"); `Log_Error("MinLevel" @ "(" $ default.MinLevel $ ")" @ "must be in range 0-25");
default.MinLevel = 0; default.MinLevel = 0;
} }
} }
protected static function ApplyDefault(E_LogLevel LogLevel) protected static function ApplyDefault(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
default.Waves = 0; default.Waves = 0;
default.MinLevel = 0; default.MinLevel = 0;
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,21 +1,21 @@
class _Logger extends Object class _Logger extends Object
abstract; abstract;
enum E_LogLevel enum E_LogLevel
{ {
LL_WrongLevel, LL_WrongLevel,
LL_None, LL_None,
LL_Fatal, LL_Fatal,
LL_Error, LL_Error,
LL_Warning, LL_Warning,
LL_Kick, LL_Kick,
LL_Info, LL_Info,
LL_Debug, LL_Debug,
LL_Trace, LL_Trace,
LL_All LL_All
}; };
defaultproperties defaultproperties
{ {
} }

View File

@ -1,2 +1,2 @@
// Constants // Constants
`define NO_CONFIG 0 `define NO_CONFIG 0

View File

@ -1,3 +1,3 @@
// Imports // Imports
`include(Logger.uci) `include(Logger.uci)
`include(Constants.uci) `include(Constants.uci)

View File

@ -1,16 +1,16 @@
// Logger // Logger
`define Log_Tag 'CVC' `define Log_Tag 'CVC'
`define LocationStatic "`{ClassName}::" $ GetFuncName() `define LocationStatic "`{ClassName}::" $ GetFuncName()
`define Log_Base(msg, cond) `log(`msg `if(`cond), `cond`{endif}, `Log_Tag) `define Log_Base(msg, cond) `log(`msg `if(`cond), `cond`{endif}, `Log_Tag)
`define Log_Fatal(msg) `log("FATAL:" @ `msg, (LogLevel >= LL_Fatal), `Log_Tag) `define Log_Fatal(msg) `log("FATAL:" @ `msg, (LogLevel >= LL_Fatal), `Log_Tag)
`define Log_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `Log_Tag) `define Log_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `Log_Tag)
`define Log_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `Log_Tag) `define Log_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `Log_Tag)
`define Log_Kick(msg) `log("KICK:" @ `msg, (LogLevel >= LL_Kick), `Log_Tag) `define Log_Kick(msg) `log("KICK:" @ `msg, (LogLevel >= LL_Kick), `Log_Tag)
`define Log_Info(msg) `log("INFO:" @ `msg, (LogLevel >= LL_Info), `Log_Tag) `define Log_Info(msg) `log("INFO:" @ `msg, (LogLevel >= LL_Info), `Log_Tag)
`define Log_Debug(msg) `log("DEBUG:" @ `msg, (LogLevel >= LL_Debug), `Log_Tag) `define Log_Debug(msg) `log("DEBUG:" @ `msg, (LogLevel >= LL_Debug), `Log_Tag)
`define Log_Trace(msg) `log("TRACE:" @ `Location `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag) `define Log_Trace(msg) `log("TRACE:" @ `Location `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)
`define Log_TraceStatic(msg) `log("TRACE:" @ `LocationStatic `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag) `define Log_TraceStatic(msg) `log("TRACE:" @ `LocationStatic `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,48 +1,42 @@
[img]https://img.shields.io/static/v1?logo=GitHub&labelColor=gray&color=blue&logoColor=white&label=&message=Open Source[/img] [img]https://img.shields.io/github/license/GenZmeY/KF2-ControlledVoteCollector[/img] [img]https://img.shields.io/steam/downloads/2847465899[/img] [img]https://img.shields.io/steam/favorites/2847465899[/img] [img]https://img.shields.io/steam/update-date/2847465899[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2847465899][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-ControlledVoteCollector[/img][/url] [img]https://img.shields.io/static/v1?logo=GitHub&labelColor=gray&color=blue&logoColor=white&label=&message=Open Source[/img] [img]https://img.shields.io/github/license/GenZmeY/KF2-ControlledVoteCollector[/img] [img]https://img.shields.io/steam/subscriptions/2847465899[/img] [img]https://img.shields.io/steam/favorites/2847465899[/img] [img]https://img.shields.io/steam/update-date/2847465899[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2847465899][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-ControlledVoteCollector[/img][/url]
[h1]📋 Description[/h1] [h1]Description[/h1]
New vote collector with improvements and features. New vote collector with improvements and features.
[h1]Features[/h1] [h1]Features[/h1]
[list] [list]
[*]Map statistics [*]map statistics;
[*]Next map setting [*]default/next map setting;
[*]Public voting [*]anonymous or public voting;
[*]Kick logging [*]kick logging;
[*]Kick voting setup [*]kick voting setup;
[*]Early kick protection [*]early kick protection.
[/list] [/list]
[h1]❌ Whitelisted?[/h1] [i](it would be logical to separate these features into several mutators, but this is a bad idea for technical reasons)[/i]
No. This mod is not whitelisted and will de-rank your server. Any XP earned will not be saved.
But I hope that it will be whitelisted - I submitted whitelist request here: [h1]Whitelisted?[/h1]
https://forums.tripwireinteractive.com/index.php?threads/whitelisting-mods-and-mutators.120340/post-2353667 No. This mod is not whitelisted and will de-rank your server. Any XP gained will not be saved.
[h1]🖥️ Usage (server)[/h1] [h1]Usage (server)[/h1]
[b]Note:[/b] [i]If this is unclear, first read: [url=https://wiki.killingfloor2.com/index.php?title=Dedicated_Server_(Killing_Floor_2)][u]Dedicated Server Guide (KF2 wiki)[/u][/url][/i] [b]Note:[/b] [i]If you don't understand what is written here, read the article [url=https://wiki.killingfloor2.com/index.php?title=Dedicated_Server_(Killing_Floor_2)][u]Dedicated Server (KF2 wiki)[/u][/url] before following these instructions.[/i]
[olist] [olist]
[*]Open [b]PCServer-KFEngine.ini[/b] / [b]LinuxServer-KFEngine.ini[/b]. [*]Open your [b]PCServer-KFEngine.ini[/b] / [b]LinuxServer-KFEngine.ini[/b];
[*]Find [b][IpDrv.TcpNetDriver][/b] section and ensure line exists (add if missing): [*]Find the [b][IpDrv.TcpNetDriver][/b] section and make sure that there is a line (add if not):
[code]DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload[/code] [b]DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload[/b]
(If there are several [b]DownloadManagers[/b] then the line above should be the first) ❗️ If there are several [b]DownloadManagers=[/b] then the line above should be the first ❗️
[*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist): [*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
[code]ServerSubscribedWorkshopItems=2847465899[/code] [b]ServerSubscribedWorkshopItems=2847465899[/b]
[*]Start server and wait for mutator download. [*]Start the server and wait until the mutator is downloading;
[*]When the download is complete, stop the server. [*]Add mutator to server start parameters: [b]?Mutator=CVC.CVCMut[/b] and restart the server.
[*]Create a file: [code]<kf2-server>\KFGame\Config\KFCVC.ini[/code]
with content:
[code][CVC.CVC]
Version=0[/code]
[*]Add mutator to server start parameters: [code]?Mutator=CVC.Mut[/code] and start the server.
[*]Stop the server and configure the mutator (see [b]⚙️ Setup (KFCVC.ini)[/b] below).
[*]Start the server.
[/olist] [/olist]
[h1]⚙️ Setup (KFCVC.ini)[/h1] [h1]Setup (KFCVC.ini)[/h1]
Config will be created at the first start.
[b][CVC.MapStat][/b] [b][CVC.MapStat][/b]
[list] [list]
[*]Set [b]bEnable=True[/b] to start collecting maps stats. Statistics are stored in the [b]KFMapStats.ini[/b]. [*]Set [b]bEnable=True[/b] to start collecting maps stats. The following information is collected: number of full rounds on the map, total time (minutes), average time (minutes). Statistics are stored in the [b]KFMapStats.ini[/b]. To reset the statistics, delete [b]KFMapStats.ini[/b] and restart the server.
[*]Set [b]SortPolicy[/b] to sort the list of statistics. Possible values: [*]Set [b]SortPolicy[/b] to sort the list of statistics. Possible values:
[list] [list]
[*][b]CounterAsc[/b] [*][b]CounterAsc[/b]
@ -57,85 +51,71 @@ Version=0[/code]
[/list] [/list]
[b][CVC.MapVote][/b] [b][CVC.MapVote][/b]
This section sets the next map when no one voted for the map.
[list] [list]
[*]Set [b]DefaultNextMap[/b] to choose which map will be next if no players voted for the next map. Possible values: [*]Set [b]DefaultNextMap[/b] to choose which map will be next if no players voted for the next map. Possible values:
[list] [list]
[*][b]Any[/b] - Any map from the current map cycle. [*][b]Any[/b] - any map from the current map cycle;
[*][b]Official[/b] - Official map from the current map cycle. [*][b]Official[/b] - official map from the current map cycle;
[*][b]Custom[/b] - Custom map from the current map cycle. [*][b]Custom[/b] - custom map from the current map cycle;
[*][b]<MapName>[/b] - Specified map. If the specified map is not in the current map cycle, the next map from the cycle will be selected. [*][b]<MapName>[/b] - specified map (for example: [b]KF-Nuked[/b]). If the specified map is not in the current map cycle, the next map from the cycle will be selected.
[/list] [/list]
[*]Set [b]bRandomizeNextMap[/b] to [b]True[/b] to randomize the next map (will be selected a random map that matches the [b]DefaultNextMap[/b] parameter). [*]Set [b]bRandomizeNextMap[/b] to [b]True[/b] to randomize the next map (will be selected a random map that matches the [b]DefaultNextMap[/b] parameter).
[/list] [/list]
[b][CVC.SkipTraderVote][/b] [b][CVC.SkipTraderVote][/b]
[list] [list]
[*][b]bChatNotifications[/b] - Set to [b]True[/b] to see player votes in chat. [*][b]bChatNotifications[/b] - set to [b]True[/b] to see player votes in chat;
[*][b]PositiveColorHex[/b] - Hex color for yes vote in chat. [*][b]PositiveColorHex[/b] - hex color for yes vote in chat;
[*][b]NegativeColorHex[/b] - Hex color for no vote in chat. [*][b]NegativeColorHex[/b] - hex color for no vote in chat;
[*][b]bHudNotifications[/b] - Set to [b]True[/b] to see player votes in HUD. [*][b]bHudNotifications[/b] - set to [b]True[/b] to see player votes in HUD;
[*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends. [*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends.
[*][b]VoteTime[/b] - Time in seconds for voting (will be reduced if it exceeds the trader's remaining time).
[/list] [/list]
[b][CVC.PauseVote][/b] [b][CVC.PauseVote][/b]
[list] [list]
[*][b]bChatNotifications[/b] - Set to [b]True[/b] to see player votes in chat. [*][b]bChatNotifications[/b] - set to [b]True[/b] to see player votes in chat;
[*][b]PositiveColorHex[/b] - Hex color for yes vote in chat. [*][b]PositiveColorHex[/b] - hex color for yes vote in chat;
[*][b]NegativeColorHex[/b] - Hex color for no vote in chat. [*][b]NegativeColorHex[/b] - hex color for no vote in chat;
[*][b]bHudNotifications[/b] - Set to [b]True[/b] to see player votes in HUD. [*][b]bHudNotifications[/b] - set to [b]True[/b] to see player votes in HUD;
[*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends. [*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends.
[*][b]VoteTime[/b] - Time in seconds for voting (will be reduced if it exceeds the trader's remaining time).
[/list] [/list]
[b][CVC.KickVote][/b] [b][CVC.KickVote][/b]
[list] [list]
[*][b]bChatNotifications[/b] - Set to [b]True[/b] to see player votes in chat. [*][b]bChatNotifications[/b] - set to [b]True[/b] to see player votes in chat;
[*][b]WarningColorHex[/b] - Hex color for chat warnings. [*][b]WarningColorHex[/b] - hex color for chat warnings;
[*][b]PositiveColorHex[/b] - Hex color for yes vote in chat. [*][b]PositiveColorHex[/b] - hex color for yes vote in chat;
[*][b]NegativeColorHex[/b] - Hex color for no vote in chat. [*][b]NegativeColorHex[/b] - hex color for no vote in chat;
[*][b]bHudNotifications[/b] - Set to [b]True[/b] to see player votes in HUD. [*][b]bHudNotifications[/b] - set to [b]True[/b] to see player votes in HUD;
[*][b]bHudNotificationsOnlyOnTraderTime[/b] - Set to [b]True[/b] to show HUD notification only during the trader time. [*][b]bHudNotificationsOnlyOnTraderTime[/b] - set to [b]True[/b] to show HUD notification only during the trader time;
[*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends. [*][b]DefferedClearHUD[/b] - HUD notification will remain on the screen for the specified number of seconds after voting ends.
[*][b]bLogKickVote[/b] - Set to [b]True[/b] to log information about every kick vote. [*][b]bLogKickVote[/b] - set to [b]True[/b] to log information about every kick vote;
[*][b]MinVotingPlayersToStartKickVote[/b] - Minimum number of voting players to start kick voting. [*][b]MinVotingPlayersToStartKickVote[/b] - minimum number of voting players to start kick voting;
[*][b]MaxKicks[/b] - Maximum number of kicks per game. [*][b]MaxKicks[/b] - maximum number of kicks per game.
[*][b]VoteTime[/b] - Time in seconds for voting.
[/list] [/list]
[b][CVC.KickProtected][/b] [b][CVC.KickProtected][/b]
[list] [list]
[*]Use [b]PlayerID[/b] to set the list of players immune to kick (use UniqueID or SteamID). [*]Use [b]PlayerID[/b] to set the list of players immune to kick. You can use UniqueID or SteamID;
[*]Set [b]NotifyPlayerAboutKickAttempt[/b] to [b]True[/b] to let players on this list receive notifications of attempts to kick them. [*]Set [b]NotifyPlayerAboutKickAttempt[/b] to [b]True[/b] to let players on this list receive notifications of attempts to kick them.
[/list] [/list]
[b][CVC.StartWaveKickProtection][/b] [b][CVC.StartWaveKickProtection][/b]
In this section, the system for preventing early kicks is configured (especially for lazy ass admins like me who don't want to consider player complaints about this).
[list] [list]
[*][b]Waves[/b] - The number of waves during which a new player has kick protection and cannot start kick vote. [*][b]Waves[/b] - the number of waves during which a new player has kick protection and cannot vote for a kick;
[*][b]MinLevel[/b] - The minimum level that a player needs to have in order to receive protection from a kick after joining the server. [*][b]MinLevel[/b] - the minimum level that a player needs to have in order to receive protection from a kick after joining the server.
[/list] [/list]
[b]How start wave kick protection works:[/b] [b]How start wave kick protection works:[/b]
When a player joins a server, he is protected from a kick for the specified number of [b]Waves[/b]. This keeps the server from being taken over by players, and it also forces current players to play with the new player for at least a little bit before they can kick him. This solves most of the unfair kicks in the game. When a player joins a server, he is protected from a kick for the specified number of [b]Waves[/b]. This keeps the server from being taken over by players, and it also forces current players to play with the new player for at least a little bit before they can kick him. This solves most of the unfair kicks in the game.
Along with receiving the kick protection, the new player loses the ability to start kick vote. This eliminates the ability for new players to remove existing players using kick protection for impunity. Along with receiving the kick protection, the new player loses the ability to vote for the kick. This eliminates the ability for new players to remove existing players using kick protection for impunity.
When the player has played the specified number of [b]Waves[/b], he loses the kick protection and gets the opportunity to start kick vote. When the player has played the specified number of [b]Waves[/b], he loses the kick protection and gets the opportunity to vote for the kick.
The [b]MinLevel[/b] parameter specifies an exception to these rules, giving kick protection only to players above or equal the specified level. All players can vote to exclude players with an unsuitable level, regardless of whether they have played enough [b]Waves[/b] or not. This allows to remove low-level players without waiting for them to screw up in the game. The [b]MinLevel[/b] parameter specifies an exception to these rules, giving kick protection only to players above or equal the specified level. All players can vote to exclude players with an unsuitable level, regardless of whether they have played enough [b]Waves[/b] or not. This allows to remove low-level players without waiting for them to screw up in the game.
[h1]🌍 Credits[/h1] [h1]Sources[/h1]
[list] [url=https://github.com/GenZmeY/KF2-ControlledVoteCollector]https://github.com/GenZmeY/KF2-ControlledVoteCollector[/url] [b](GNU GPLv3)[/b]
[*]The cat on the cover is Meawbin (original character by [url=https://x.com/horrormove]Cotton Valent[/url]).
[/list]
[b]Translators:[/b]
[list]
[*][url=https://steamcommunity.com/profiles/76561199126205919]cheungfatzong[/url] - Traditional [CHT] and Simplified [CHN] Chinese.
[/list]
[h1]☑️ Status: Completed[/h1]
✔️ The mutator works with the current version of the game (v1150) and I have implemented everything I planned.
⛔️ Development has stopped: I no longer have the time or motivation to maintain this mod. No further updates or bug fixes are planned.
[h1]📜 Sources[/h1]
https://github.com/GenZmeY/KF2-ControlledVoteCollector [b](GNU GPLv3)[/b]

View File

@ -1,16 +1,16 @@
# Controlled Vote Collector # Controlled Vote Collector
[![Steam Workshop](https://img.shields.io/static/v1?message=workshop&logo=steam&labelColor=gray&color=blue&logoColor=white&label=steam%20)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899) [![Steam Workshop](https://img.shields.io/static/v1?message=workshop&logo=steam&labelColor=gray&color=blue&logoColor=white&label=steam%20)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
[![Steam Downloads](https://img.shields.io/steam/downloads/2847465899)](https://steamcommunity.com/sharedfiles/filedetails/?id=2848836389) [![Steam Subscriptions](https://img.shields.io/steam/subscriptions/2847465899)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
[![Steam Favorites](https://img.shields.io/steam/favorites/2847465899)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899) [![Steam Favorites](https://img.shields.io/steam/favorites/2847465899)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
[![MegaLinter](https://github.com/GenZmeY/KF2-ControlledVoteCollector/actions/workflows/mega-linter.yml/badge.svg?branch=master)](https://github.com/GenZmeY/KF2-ControlledVoteCollector/actions/workflows/mega-linter.yml) [![Steam Update Date](https://img.shields.io/steam/update-date/2847465899)](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-ControlledVoteCollector)](https://github.com/GenZmeY/KF2-ControlledVoteCollector/tags) [![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-ControlledVoteCollector)](https://github.com/GenZmeY/KF2-ControlledVoteCollector/tags)
[![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-ControlledVoteCollector)](LICENSE) [![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-ControlledVoteCollector)](LICENSE)
## Description # Description
New vote collector with improvements and features. New vote collector with improvements and features.
## Features # Features
- map statistics; - map statistics;
- default/next map setting; - default/next map setting;
- anonymous or public voting; - anonymous or public voting;
@ -18,10 +18,10 @@ New vote collector with improvements and features.
- kick voting setup; - kick voting setup;
- early kick protection. - early kick protection.
## Usage & Setup # Usage & Setup
[See steam workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899) [See steam workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
## Build # Build
**Note:** If you want to build/test/brew/publish a mutator without git-bash and/or scripts, follow [these instructions](https://tripwireinteractive.atlassian.net/wiki/spaces/KF2SW/pages/26247172/KF2+Code+Modding+How-to) instead of what is described here. **Note:** If you want to build/test/brew/publish a mutator without git-bash and/or scripts, follow [these instructions](https://tripwireinteractive.atlassian.net/wiki/spaces/KF2SW/pages/26247172/KF2+Code+Modding+How-to) instead of what is described here.
1. Install [Killing Floor 2](https://store.steampowered.com/app/232090/Killing_Floor_2/), Killing Floor 2 - SDK and [git for windows](https://git-scm.com/download/win); 1. Install [Killing Floor 2](https://store.steampowered.com/app/232090/Killing_Floor_2/), Killing Floor 2 - SDK and [git for windows](https://git-scm.com/download/win);
2. open git-bash and go to any folder where you want to store sources: 2. open git-bash and go to any folder where you want to store sources:
@ -35,9 +35,9 @@ New vote collector with improvements and features.
5. The compiled files will be here: 5. The compiled files will be here:
`C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame\Unpublished\BrewedPC\Script\` `C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame\Unpublished\BrewedPC\Script\`
## Bug reports # Bug reports
If you find a bug, go to the [issue page](https://github.com/GenZmeY/KF2-ControlledVoteCollector/issues) and check if there is a description of your bug. If not, create a new issue. If you find a bug, go to the [issue page](https://github.com/GenZmeY/KF2-ControlledVoteCollector/issues) and check if there is a description of your bug. If not, create a new issue.
Describe what the bug looks like and how reproduce it. Describe what the bug looks like and how reproduce it.
## License # License
[![license](https://www.gnu.org/graphics/gplv3-with-text-136x68.png)](LICENSE) [GNU GPLv3](LICENSE)

View File

@ -7,24 +7,15 @@ StripSource="True"
# Mutators to be compiled # Mutators to be compiled
# Specify them with a space as a separator, # Specify them with a space as a separator,
# Mutators will be compiled in the specified order # Mutators will be compiled in the specified order
PackageBuildOrder="CVC" PackageBuildOrder="CVC"
### Brew parameters ###
# Packages you want to brew using @peelz's patched KFEditor.
# Useful for cases where regular brew doesn't put *.upk inside the package.
# Specify them with a space as a separator,
# The order doesn't matter
PackagePeelzBrew=""
### Steam Workshop upload parameters ### ### Steam Workshop upload parameters ###
# Mutators that will be uploaded to the workshop # Mutators that will be uploaded to the workshop
# Specify them with a space as a separator, # Specify them with a space as a separator,
# The order doesn't matter # The order doesn't matter
PackageUpload="CVC" PackageUpload="CVC"

2
tools

@ -1 +1 @@
Subproject commit fb458ac61f7e6c6426b8dff366dd5e7499e0d95f Subproject commit 2f173aad7a6f4578574764801136a0d86e830653