commit
0ff11a392b
35
.editorconfig
Normal file
35
.editorconfig
Normal file
@ -0,0 +1,35 @@
|
||||
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 = true
|
||||
|
||||
# Unreal Engine 3 / Source
|
||||
[*.{uc,uci}]
|
||||
indent_style = tab
|
||||
|
||||
[*.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]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{txt,cfg}]
|
||||
insert_final_newline = unset
|
||||
|
||||
[*.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[.gitignore]
|
||||
insert_final_newline = unset
|
72
.github/workflows/mega-linter.yml
vendored
Normal file
72
.github/workflows/mega-linter.yml
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
---
|
||||
name: MegaLinter
|
||||
|
||||
permissions: read-all
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
env:
|
||||
APPLY_FIXES: none
|
||||
APPLY_FIXES_EVENT: pull_request
|
||||
APPLY_FIXES_MODE: commit
|
||||
DISABLE: SPELL
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.ref }}-${{ github.workflow }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: MegaLinter
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: MegaLinter
|
||||
id: ml
|
||||
uses: oxsecurity/megalinter@v6
|
||||
env:
|
||||
VALIDATE_ALL_CODEBASE: true
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Archive production artifacts
|
||||
if: ${{ success() }} || ${{ failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: MegaLinter reports
|
||||
path: |
|
||||
megalinter-reports
|
||||
mega-linter.log
|
||||
|
||||
- name: Create Pull Request with applied fixes
|
||||
id: cpr
|
||||
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
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: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
|
||||
run: |
|
||||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
||||
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
||||
|
||||
- name: Prepare commit
|
||||
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
|
||||
run: sudo chown -Rc $UID .git/
|
||||
- name: Commit and push applied linter fixes
|
||||
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
|
||||
commit_message: "[MegaLinter] Apply linters fixes"
|
||||
commit_user_name: megalinter-bot
|
||||
commit_user_email: nicolas.vuillamy@ox.security
|
@ -1,187 +1,187 @@
|
||||
class AAL extends Info
|
||||
config(AAL);
|
||||
|
||||
const LatestVersion = 2;
|
||||
|
||||
const ProfileURL = "https://steamcommunity.com/profiles/";
|
||||
|
||||
const CfgAdminList = class'AdminList';
|
||||
|
||||
var private config int Version;
|
||||
var private config E_LogLevel LogLevel;
|
||||
var private config bool bAutoEnableCheats;
|
||||
|
||||
var private OnlineSubsystem OS;
|
||||
var private Array<UniqueNetId> AdminUIDList;
|
||||
var private Array<UniqueNetId> AdminUIDListActive;
|
||||
|
||||
public simulated function bool SafeDestroy()
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
return (bPendingDelete || bDeleteMe || Destroy());
|
||||
}
|
||||
|
||||
public event PreBeginPlay()
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
if (WorldInfo.NetMode == NM_Client)
|
||||
{
|
||||
`Log_Fatal("Wrong NetMode:" @ WorldInfo.NetMode);
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
Super.PreBeginPlay();
|
||||
|
||||
PreInit();
|
||||
}
|
||||
|
||||
public event PostBeginPlay()
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
if (bPendingDelete || bDeleteMe) return;
|
||||
|
||||
Super.PostBeginPlay();
|
||||
|
||||
PostInit();
|
||||
}
|
||||
|
||||
private function PreInit()
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
if (Version == `NO_CONFIG)
|
||||
{
|
||||
LogLevel = LL_Info;
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
CfgAdminList.static.InitConfig(Version, LatestVersion, LogLevel);
|
||||
|
||||
switch (Version)
|
||||
{
|
||||
case `NO_CONFIG:
|
||||
`Log_Info("Config created");
|
||||
|
||||
case 1:
|
||||
bAutoEnableCheats = false;
|
||||
|
||||
case MaxInt:
|
||||
`Log_Info("Config updated to version" @ LatestVersion);
|
||||
break;
|
||||
|
||||
case LatestVersion:
|
||||
`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?)");
|
||||
`Log_Warn("Config version is" @ Version @ "but current version is" @ LatestVersion);
|
||||
`Log_Warn("The config version will be changed to" @ LatestVersion);
|
||||
break;
|
||||
}
|
||||
|
||||
if (LatestVersion != Version)
|
||||
{
|
||||
Version = LatestVersion;
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
if (LogLevel == LL_WrongLevel)
|
||||
{
|
||||
LogLevel = LL_Info;
|
||||
|
||||
`Log_Warn("Wrong 'LogLevel', return to default value");
|
||||
|
||||
SaveConfig();
|
||||
}
|
||||
`Log_Base("LogLevel:" @ LogLevel);
|
||||
|
||||
OS = class'GameEngine'.static.GetOnlineSubsystem();
|
||||
if (OS != None)
|
||||
{
|
||||
AdminUIDList = CfgAdminList.static.Load(OS, LogLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Fatal("Can't get online subsystem!");
|
||||
SafeDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function PostInit()
|
||||
{
|
||||
`Log_Trace();
|
||||
}
|
||||
|
||||
public function NotifyLogin(Controller C)
|
||||
{
|
||||
local PlayerController PC;
|
||||
local PlayerReplicationInfo PRI;
|
||||
local String UniqueID;
|
||||
local String SteamID;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
if (C == None || C.PlayerReplicationInfo == None) return;
|
||||
|
||||
PRI = C.PlayerReplicationInfo;
|
||||
|
||||
if (AdminUIDList.Find('Uid', PRI.UniqueId.Uid) != INDEX_NONE)
|
||||
{
|
||||
PRI.bAdmin = true;
|
||||
}
|
||||
|
||||
if (PRI.bAdmin)
|
||||
{
|
||||
AdminUIDListActive.AddItem(PRI.UniqueId);
|
||||
|
||||
UniqueID = OS.UniqueNetIdToString(PRI.UniqueId);
|
||||
|
||||
PC = PlayerController(C);
|
||||
|
||||
if (PC != None && bAutoEnableCheats)
|
||||
{
|
||||
PC.AddCheats(true);
|
||||
}
|
||||
|
||||
if (PC != None && !PC.bIsEosPlayer)
|
||||
{
|
||||
SteamID = OS.UniqueNetIdToInt64(PRI.UniqueId);
|
||||
`Log_Info("Admin login:" @ PRI.PlayerName @ "(" $ UniqueID $ "," @ SteamID $ "," @ ProfileURL $ SteamID $ ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Info("Admin login:" @ PRI.PlayerName @ "(" $ UniqueID $ ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function NotifyLogout(Controller C)
|
||||
{
|
||||
local PlayerReplicationInfo PRI;
|
||||
local String UniqueID;
|
||||
local String SteamID;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
if (C == None || C.PlayerReplicationInfo == None) return;
|
||||
|
||||
PRI = C.PlayerReplicationInfo;
|
||||
|
||||
if (PRI.bAdmin || AdminUIDListActive.Find('Uid', PRI.UniqueId.Uid) != INDEX_NONE)
|
||||
{
|
||||
AdminUIDListActive.RemoveItem(PRI.UniqueId);
|
||||
UniqueID = OS.UniqueNetIdToString(PRI.UniqueId);
|
||||
SteamID = OS.UniqueNetIdToInt64(PRI.UniqueId);
|
||||
`Log_Info("Admin logout:" @ PRI.PlayerName @ "(" $ UniqueID $ "," @ SteamID $ "," @ ProfileURL $ SteamID $ ")");
|
||||
}
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
||||
class AAL extends Info
|
||||
config(AAL);
|
||||
|
||||
const LatestVersion = 2;
|
||||
|
||||
const ProfileURL = "https://steamcommunity.com/profiles/";
|
||||
|
||||
const CfgAdminList = class'AdminList';
|
||||
|
||||
var private config int Version;
|
||||
var private config E_LogLevel LogLevel;
|
||||
var private config bool bAutoEnableCheats;
|
||||
|
||||
var private OnlineSubsystem OS;
|
||||
var private Array<UniqueNetId> AdminUIDList;
|
||||
var private Array<UniqueNetId> AdminUIDListActive;
|
||||
|
||||
public simulated function bool SafeDestroy()
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
return (bPendingDelete || bDeleteMe || Destroy());
|
||||
}
|
||||
|
||||
public event PreBeginPlay()
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
if (WorldInfo.NetMode == NM_Client)
|
||||
{
|
||||
`Log_Fatal("Wrong NetMode:" @ WorldInfo.NetMode);
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
Super.PreBeginPlay();
|
||||
|
||||
PreInit();
|
||||
}
|
||||
|
||||
public event PostBeginPlay()
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
if (bPendingDelete || bDeleteMe) return;
|
||||
|
||||
Super.PostBeginPlay();
|
||||
|
||||
PostInit();
|
||||
}
|
||||
|
||||
private function PreInit()
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
if (Version == `NO_CONFIG)
|
||||
{
|
||||
LogLevel = LL_Info;
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
CfgAdminList.static.InitConfig(Version, LatestVersion, LogLevel);
|
||||
|
||||
switch (Version)
|
||||
{
|
||||
case `NO_CONFIG:
|
||||
`Log_Info("Config created");
|
||||
|
||||
case 1:
|
||||
bAutoEnableCheats = false;
|
||||
|
||||
case MaxInt:
|
||||
`Log_Info("Config updated to version" @ LatestVersion);
|
||||
break;
|
||||
|
||||
case LatestVersion:
|
||||
`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?)");
|
||||
`Log_Warn("Config version is" @ Version @ "but current version is" @ LatestVersion);
|
||||
`Log_Warn("The config version will be changed to" @ LatestVersion);
|
||||
break;
|
||||
}
|
||||
|
||||
if (LatestVersion != Version)
|
||||
{
|
||||
Version = LatestVersion;
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
if (LogLevel == LL_WrongLevel)
|
||||
{
|
||||
LogLevel = LL_Info;
|
||||
|
||||
`Log_Warn("Wrong 'LogLevel', return to default value");
|
||||
|
||||
SaveConfig();
|
||||
}
|
||||
`Log_Base("LogLevel:" @ LogLevel);
|
||||
|
||||
OS = class'GameEngine'.static.GetOnlineSubsystem();
|
||||
if (OS != None)
|
||||
{
|
||||
AdminUIDList = CfgAdminList.static.Load(OS, LogLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Fatal("Can't get online subsystem!");
|
||||
SafeDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function PostInit()
|
||||
{
|
||||
`Log_Trace();
|
||||
}
|
||||
|
||||
public function NotifyLogin(Controller C)
|
||||
{
|
||||
local PlayerController PC;
|
||||
local PlayerReplicationInfo PRI;
|
||||
local String UniqueID;
|
||||
local String SteamID;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
if (C == None || C.PlayerReplicationInfo == None) return;
|
||||
|
||||
PRI = C.PlayerReplicationInfo;
|
||||
|
||||
if (AdminUIDList.Find('Uid', PRI.UniqueId.Uid) != INDEX_NONE)
|
||||
{
|
||||
PRI.bAdmin = true;
|
||||
}
|
||||
|
||||
if (PRI.bAdmin)
|
||||
{
|
||||
AdminUIDListActive.AddItem(PRI.UniqueId);
|
||||
|
||||
UniqueID = OS.UniqueNetIdToString(PRI.UniqueId);
|
||||
|
||||
PC = PlayerController(C);
|
||||
|
||||
if (PC != None && bAutoEnableCheats)
|
||||
{
|
||||
PC.AddCheats(true);
|
||||
}
|
||||
|
||||
if (PC != None && !PC.bIsEosPlayer)
|
||||
{
|
||||
SteamID = OS.UniqueNetIdToInt64(PRI.UniqueId);
|
||||
`Log_Info("Admin login:" @ PRI.PlayerName @ "(" $ UniqueID $ "," @ SteamID $ "," @ ProfileURL $ SteamID $ ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Info("Admin login:" @ PRI.PlayerName @ "(" $ UniqueID $ ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function NotifyLogout(Controller C)
|
||||
{
|
||||
local PlayerReplicationInfo PRI;
|
||||
local String UniqueID;
|
||||
local String SteamID;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
if (C == None || C.PlayerReplicationInfo == None) return;
|
||||
|
||||
PRI = C.PlayerReplicationInfo;
|
||||
|
||||
if (PRI.bAdmin || AdminUIDListActive.Find('Uid', PRI.UniqueId.Uid) != INDEX_NONE)
|
||||
{
|
||||
AdminUIDListActive.RemoveItem(PRI.UniqueId);
|
||||
UniqueID = OS.UniqueNetIdToString(PRI.UniqueId);
|
||||
SteamID = OS.UniqueNetIdToInt64(PRI.UniqueId);
|
||||
`Log_Info("Admin logout:" @ PRI.PlayerName @ "(" $ UniqueID $ "," @ SteamID $ "," @ ProfileURL $ SteamID $ ")");
|
||||
}
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
[Flags]
|
||||
AllowDownload=False
|
||||
ClientOptional=False
|
||||
ServerSideOnly=True
|
||||
[Flags]
|
||||
AllowDownload=False
|
||||
ClientOptional=False
|
||||
ServerSideOnly=True
|
||||
|
@ -1,60 +1,60 @@
|
||||
class AALMut extends KFMutator;
|
||||
|
||||
var private AAL AAL;
|
||||
|
||||
public simulated function bool SafeDestroy()
|
||||
{
|
||||
return (bPendingDelete || bDeleteMe || Destroy());
|
||||
}
|
||||
|
||||
public event PreBeginPlay()
|
||||
{
|
||||
Super.PreBeginPlay();
|
||||
|
||||
if (WorldInfo.NetMode == NM_Client) return;
|
||||
|
||||
foreach WorldInfo.DynamicActors(class'AAL', AAL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (AAL == None)
|
||||
{
|
||||
AAL = WorldInfo.Spawn(class'AAL');
|
||||
}
|
||||
|
||||
if (AAL == None)
|
||||
{
|
||||
`Log_Base("FATAL: Can't Spawn 'AAL'");
|
||||
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)
|
||||
{
|
||||
AAL.NotifyLogin(C);
|
||||
|
||||
Super.NotifyLogin(C);
|
||||
}
|
||||
|
||||
public function NotifyLogout(Controller C)
|
||||
{
|
||||
AAL.NotifyLogout(C);
|
||||
|
||||
Super.NotifyLogout(C);
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
||||
class AALMut extends KFMutator;
|
||||
|
||||
var private AAL AAL;
|
||||
|
||||
public simulated function bool SafeDestroy()
|
||||
{
|
||||
return (bPendingDelete || bDeleteMe || Destroy());
|
||||
}
|
||||
|
||||
public event PreBeginPlay()
|
||||
{
|
||||
Super.PreBeginPlay();
|
||||
|
||||
if (WorldInfo.NetMode == NM_Client) return;
|
||||
|
||||
foreach WorldInfo.DynamicActors(class'AAL', AAL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (AAL == None)
|
||||
{
|
||||
AAL = WorldInfo.Spawn(class'AAL');
|
||||
}
|
||||
|
||||
if (AAL == None)
|
||||
{
|
||||
`Log_Base("FATAL: Can't Spawn 'AAL'");
|
||||
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)
|
||||
{
|
||||
AAL.NotifyLogin(C);
|
||||
|
||||
Super.NotifyLogin(C);
|
||||
}
|
||||
|
||||
public function NotifyLogout(Controller C)
|
||||
{
|
||||
AAL.NotifyLogout(C);
|
||||
|
||||
Super.NotifyLogout(C);
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,84 +1,84 @@
|
||||
class AdminList extends Object
|
||||
config(AAL)
|
||||
abstract;
|
||||
|
||||
var private config Array<String> AdminId;
|
||||
|
||||
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
switch (Version)
|
||||
{
|
||||
case `NO_CONFIG:
|
||||
ApplyDefault(LogLevel);
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (LatestVersion != Version)
|
||||
{
|
||||
StaticSaveConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public static function Array<UniqueNetId> Load(OnlineSubsystem OS, E_LogLevel LogLevel)
|
||||
{
|
||||
local Array<UniqueNetId> UIDs;
|
||||
local UniqueNetId UID;
|
||||
local String ID;
|
||||
|
||||
`Log_TraceStatic();
|
||||
|
||||
foreach default.AdminId(ID)
|
||||
{
|
||||
if (AnyToUID(OS, ID, UID, LogLevel))
|
||||
{
|
||||
UIDs.AddItem(UID);
|
||||
`Log_Debug("Loaded:" @ ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Warn("Can't load AdminId:" @ ID);
|
||||
}
|
||||
}
|
||||
|
||||
if (default.AdminId.Length == UIDs.Length)
|
||||
{
|
||||
`Log_Info("Loaded" @ UIDs.Length @ "entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Info("Loaded" @ UIDs.Length @ "of" @ default.AdminId.Length @ "entries");
|
||||
}
|
||||
|
||||
return UIDs;
|
||||
}
|
||||
|
||||
private static function ApplyDefault(E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
default.AdminId.Length = 0;
|
||||
default.AdminId.AddItem("76561190000000000");
|
||||
default.AdminId.AddItem("0x0000000000000000");
|
||||
}
|
||||
|
||||
private static function bool IsUID(String ID, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
return (Left(ID, 2) ~= "0x");
|
||||
}
|
||||
|
||||
private static function bool AnyToUID(OnlineSubsystem OS, String ID, out UniqueNetId UID, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
return IsUID(ID, LogLevel) ? OS.StringToUniqueNetId(ID, UID) : OS.Int64ToUniqueNetId(ID, UID);
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
||||
class AdminList extends Object
|
||||
config(AAL)
|
||||
abstract;
|
||||
|
||||
var private config Array<String> AdminId;
|
||||
|
||||
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
switch (Version)
|
||||
{
|
||||
case `NO_CONFIG:
|
||||
ApplyDefault(LogLevel);
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (LatestVersion != Version)
|
||||
{
|
||||
StaticSaveConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public static function Array<UniqueNetId> Load(OnlineSubsystem OS, E_LogLevel LogLevel)
|
||||
{
|
||||
local Array<UniqueNetId> UIDs;
|
||||
local UniqueNetId UID;
|
||||
local String ID;
|
||||
|
||||
`Log_TraceStatic();
|
||||
|
||||
foreach default.AdminId(ID)
|
||||
{
|
||||
if (AnyToUID(OS, ID, UID, LogLevel))
|
||||
{
|
||||
UIDs.AddItem(UID);
|
||||
`Log_Debug("Loaded:" @ ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Warn("Can't load AdminId:" @ ID);
|
||||
}
|
||||
}
|
||||
|
||||
if (default.AdminId.Length == UIDs.Length)
|
||||
{
|
||||
`Log_Info("Loaded" @ UIDs.Length @ "entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Info("Loaded" @ UIDs.Length @ "of" @ default.AdminId.Length @ "entries");
|
||||
}
|
||||
|
||||
return UIDs;
|
||||
}
|
||||
|
||||
private static function ApplyDefault(E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
default.AdminId.Length = 0;
|
||||
default.AdminId.AddItem("76561190000000000");
|
||||
default.AdminId.AddItem("0x0000000000000000");
|
||||
}
|
||||
|
||||
private static function bool IsUID(String ID, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
return (Left(ID, 2) ~= "0x");
|
||||
}
|
||||
|
||||
private static function bool AnyToUID(OnlineSubsystem OS, String ID, out UniqueNetId UID, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
return IsUID(ID, LogLevel) ? OS.StringToUniqueNetId(ID, UID) : OS.Int64ToUniqueNetId(ID, UID);
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
class _Logger extends Object
|
||||
abstract;
|
||||
|
||||
enum E_LogLevel
|
||||
{
|
||||
LL_WrongLevel,
|
||||
LL_None,
|
||||
LL_Fatal,
|
||||
LL_Error,
|
||||
LL_Warning,
|
||||
LL_Info,
|
||||
LL_Debug,
|
||||
LL_Trace,
|
||||
LL_All
|
||||
};
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
||||
class _Logger extends Object
|
||||
abstract;
|
||||
|
||||
enum E_LogLevel
|
||||
{
|
||||
LL_WrongLevel,
|
||||
LL_None,
|
||||
LL_Fatal,
|
||||
LL_Error,
|
||||
LL_Warning,
|
||||
LL_Info,
|
||||
LL_Debug,
|
||||
LL_Trace,
|
||||
LL_All
|
||||
};
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
// Constants
|
||||
`define NO_CONFIG 0
|
||||
// Constants
|
||||
`define NO_CONFIG 0
|
||||
|
@ -1,3 +1,3 @@
|
||||
// Imports
|
||||
`include(Logger.uci)
|
||||
`include(Constants.uci)
|
||||
// Imports
|
||||
`include(Logger.uci)
|
||||
`include(Constants.uci)
|
||||
|
@ -1,15 +1,15 @@
|
||||
// Logger
|
||||
`define Log_Tag 'AAL'
|
||||
|
||||
`define LocationStatic "`{ClassName}::" $ GetFuncName()
|
||||
|
||||
`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_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `Log_Tag)
|
||||
`define Log_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `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_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)
|
||||
// Logger
|
||||
`define Log_Tag 'AAL'
|
||||
|
||||
`define LocationStatic "`{ClassName}::" $ GetFuncName()
|
||||
|
||||
`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_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `Log_Tag)
|
||||
`define Log_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `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_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)
|
||||
|
@ -1,4 +1,4 @@
|
||||
[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-AdminAutoLogin[/img] [img]https://img.shields.io/steam/favorites/2848836389[/img] [img]https://img.shields.io/steam/update-date/2848836389[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2848836389][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-AdminAutoLogin[/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-AdminAutoLogin[/img] [img]https://img.shields.io/steam/downloads/2848836389[/img] [img]https://img.shields.io/steam/favorites/2848836389[/img] [img]https://img.shields.io/steam/update-date/2848836389[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2848836389][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-AdminAutoLogin[/img][/url]
|
||||
|
||||
[h1]Description[/h1]
|
||||
Small server-side mutator that allows specified players to automatically login as an admin.
|
||||
|
13
README.md
13
README.md
@ -1,18 +1,19 @@
|
||||
# Admin Auto Login
|
||||
|
||||
[![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=2848836389)
|
||||
[![Steam Downloads](https://img.shields.io/steam/downloads/2848836389)](https://steamcommunity.com/sharedfiles/filedetails/?id=2848836389)
|
||||
[![Steam Favorites](https://img.shields.io/steam/favorites/2848836389)](https://steamcommunity.com/sharedfiles/filedetails/?id=2848836389)
|
||||
[![Steam Update Date](https://img.shields.io/steam/update-date/2848836389)](https://steamcommunity.com/sharedfiles/filedetails/?id=2848836389)
|
||||
[![MegaLinter](https://github.com/GenZmeY/KF2-AdminAutoLogin/actions/workflows/mega-linter.yml/badge.svg?branch=master)](https://github.com/GenZmeY/KF2-AdminAutoLogin/actions/workflows/mega-linter.yml)
|
||||
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-AdminAutoLogin)](https://github.com/GenZmeY/KF2-AdminAutoLogin/tags)
|
||||
[![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-AdminAutoLogin)](LICENSE)
|
||||
|
||||
# Description
|
||||
## Description
|
||||
Small server-side mutator that allows specified players to automatically login as an admin.
|
||||
|
||||
# Usage & Setup
|
||||
## Usage & Setup
|
||||
[See steam workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=2848836389)
|
||||
|
||||
# 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.
|
||||
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:
|
||||
@ -26,9 +27,9 @@ Small server-side mutator that allows specified players to automatically login a
|
||||
5. The compiled files will be here:
|
||||
`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-AdminAutoLogin/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.
|
||||
|
||||
# License
|
||||
## License
|
||||
[GNU GPLv3](LICENSE)
|
||||
|
@ -7,7 +7,7 @@ StripSource="True"
|
||||
|
||||
# Mutators to be compiled
|
||||
# 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="AAL"
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ PackageBuildOrder="AAL"
|
||||
# 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
|
||||
# The order doesn't matter
|
||||
PackagePeelzBrew=""
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ PackagePeelzBrew=""
|
||||
|
||||
# Mutators that will be uploaded to the workshop
|
||||
# Specify them with a space as a separator,
|
||||
# The order doesn't matter
|
||||
# The order doesn't matter
|
||||
PackageUpload="AAL"
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user