Worst-case scenario: the UEd Goblin wipes the map and burns down your house.

UE1:NBSPSettings (Class)

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Purpose

Variables

Functions

Discussion

Complete source code

//=============================================================================
// NBSPSettings ==> NoBullShitPlus v1.09
//=============================================================================
 
class NBSPSettings extends Info config(NBSP109);
 
//Config vars
var config bool Enabled;
var config int SecurityLevel;
var config float SecurityFrequency;
var config float InitialCheckFrequency;
var config int DisplayLevel;
var config int BroadcastLevel;
var config int LogLevel;
var config float MaxTimeout;
var config bool Advertise;
var config string AdvertiseText;
var config string AdminEmail;
var config string ServerURL;
var config bool CheckSpectators;
var config string AllowedConsole;
var config bool CheckPackages;
var config bool RestrictPackages;
var config bool CheckMods;
var config bool CheckSkins;
var config bool ValidateActors;
var config bool ValidateResponseClass< SEMI >
var config bool KillClientActors;
var config bool CheckPaths;
var config bool DisableMods;
var string EncryptionKey;
 
event Spawned ()
{
	if ((!CheckPackages) && (ValidateActors))
		ValidateActors = False;
 
	//Display Level
	if (DisplayLevel > 2)
		DisplayLevel = 2;
	else if (DisplayLevel < 0)
		DisplayLevel = 0;	
 
	//Broadcast Level
	if (BroadcastLevel > 1)
		BroadcastLevel = 1;
	else if (BroadcastLevel < 0)
		BroadcastLevel = 0;		
 
	//Log Level
	if (LogLevel > 3)
		LogLevel = 3;
	else if (LogLevel < 0)
		LogLevel = 0;
 
	//Security Level
	if (SecurityLevel > 2)
		SecurityLevel = 2;
	else if (SecurityLevel < 0)
		SecurityLevel = 0;
 
	//Security Frequency
	if (SecurityFrequency < 1)
		SecurityFrequency = 1.000000;
	else if (SecurityFrequency > 5)
		SecurityFrequency = 5.000000;
 
	//Initial Frequencry
	if (InitialCheckFrequency < 0.250000)
		InitialCheckFrequency = 0.250000;
	else if (InitialCheckFrequency > 1.000000)
		InitialCheckFrequency = 1.000000;
}
 
function init(NBSP n)
{
	local string a;
 
	//Setup UTPURE MODE!!!!!
	if (n.UTPureMode)
	{
		a = n.PureVersion$".PureSuperDuperUberConsole";
		if (instr(AllowedConsole,a)==-1)
		{
			n.nlog("AddedConsole:"@a);
			AllowedConsole = AllowedConsole $ "," $ a;
		}
 
		if (!CheckPackages)
			CheckPackages=True;
 
		if (ValidateActors)
			ValidateActors=False;
	}
}
 
function ReportSettings(NBSP n)
{
	if (Enabled)
	{
		n.nlog("Version: v" $ n.version);
		if (n.LogSettings)
		{
			n.nlog("SecurityLevel: "$SecurityLevel);
			n.nlog("SecurityFrequency: "$SecurityFrequency);
			n.nlog("InitialCheckFrequency: "$InitialCheckFrequency);
			n.nlog("DisplayLevel: "$DisplayLevel);
			n.nlog("BroadcastLevel: "$BroadcastLevel);
			n.nlog("Advertise: "$Advertise$"/"$AdvertiseText);
			n.nlog("AdminEmail: "$AdminEmail);
			n.nlog("CheckSpectators: "$CheckSpectators);
			n.nlog("AllowedConsole: "$AllowedConsole);
			n.nlog("CheckMods/CheckPaths: "$CheckMods$"/"$CheckPaths);
			n.nlog("Packages(Check/Restrict): "$CheckPackages$"/"$RestrictPackages);
			n.nlog("Validate(Actors/Class): "$ValidateActors$"/"$ValidateResponseClass);
			n.nlog("CheckSkins/DisableMods: "$CheckSkins$"/"$DisableMods);
			n.nlog("KillClientActors: "$KillClientActors);
			n.nlog("MaxTimeout: "$MaxTimeout);
		}
		n.nlog("");
	}
	else
		n.nlog("      **NBSP IS CURRENTLY DISABLED**      ");
}
 
function set ( PlayerPawn b, private string a, private string e )
{
	local float c;
	local int d;
 
	switch(a)
	{
		case "securitylevel":
		d = int(e);
		if (d < 0)
			d = 0;
		else if (d > 2)
			d = 2;
 
		SecurityLevel = d;
		b.ClientMessage("NBSP security level changed to:"@d);
		b.ClientMessage("Changes will take effect on map change/restart.");
		break;
		case "securityfrequency":
		c = float(e);
		if (c < 1)
			c = 1.000000;
		else if (c > 5)
			c = 5.000000;
 
		SecurityFrequency = c;
		b.ClientMessage("NBSP security frequency changed to:"@c);
		b.ClientMessage("Changes will take effect on map change/restart.");
		break;
		case "initialcheckfrequency":
		c = float(e);
		if (c < 0.250000)
			c = 0.250000;
		else if (c > 1.000000)
			c = 1.000000;
 
		InitialCheckFrequency = c;
		b.ClientMessage("NBSP initial check frequency changed to:"@c);
		b.ClientMessage("Changes will take effect on map change/restart.");
		break;
		case "displaylevel":
		d = int(e);
		if (d < 0)
			d = 0;
		else if (d > 2)
			d = 2;
 
		DisplayLevel = d;
		b.ClientMessage("NBSP display level changed to:"@d);
		b.ClientMessage("Changes will take effect on map change/restart.");
		break;
		case "broadcastlevel":
		d = int(e);
		if (d < 0)
			d = 0;
		else if (d > 1)
			d = 1;
 
		BroadcastLevel = d;
		b.ClientMessage("NBSP broadcast level changed to:"@d);
		b.ClientMessage("Changes will take effect on map change/restart.");
		break;
		case "loglevel":
		d = int(e);
		if (d < 0)
			d = 0;
		else if (d > 3)
			d = 3;
 
		LogLevel = d;
		b.ClientMessage("NBSP log level changed to:"@d);
		b.ClientMessage("Changes will take effect on map change/restart.");
		break;
		case "maxtimeout":
		c = float(e);
		if (c < 10)
			c = 10;
		else if (c > 60)
			c = 60;
 
		MaxTimeout = c;
		b.ClientMessage("NBSP max timeout changed to:"@c);
		b.ClientMessage("Changes will take effect on map change/restart.");
		break;
		case "advertise":
		if (Advertise)
		{
			Advertise = False;
			b.ClientMessage("NBSP server advertising is now off");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		else
		{
			Advertise = True;
			b.ClientMessage("NBSP server advertising is now on");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "advertisetext":
		if (len(e) != 0)
		{
			AdvertiseText = e;
			b.ClientMessage("NBSP advertise text changed to:"@e);
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "adminemail":
		if (len(e) != 0)
		{
			AdminEmail = e;
			b.ClientMessage("NBSP admin email changed to:"@e);
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "serverurl":
		if (len(e) != 0)
		{
			serverurl = e;
			b.ClientMessage("NBSP server url changed to:"@e);
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "checkspectators":
		if (CheckSpectators)
		{
			CheckSpectators = False;
			b.ClientMessage("NBSP check spectators is now off");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		else
		{
			CheckSpectators = True;
			b.ClientMessage("NBSP check spectators is now on");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "allowedconsole":
		if (len(e) != 0)
		{
			AllowedConsole = e;
			b.ClientMessage("NBSP allowed console/s changed to:"@e);
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "checkpackages":
		if (CheckPackages)
		{
			CheckPackages = False;
			b.ClientMessage("NBSP package checking is now off");
			b.ClientMessage("Changes will take effect on map change/restart.");
			if (ValidateActors)
				ValidateActors = False;
		}
		else
		{
			CheckPackages = True;
			b.ClientMessage("NBSP package checking is now on");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "restrictpackages":
		if (RestrictPackages)
		{
			RestrictPackages = False;
			b.ClientMessage("NBSP package restriction is now off");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		else
		{
			RestrictPackages = True;
			b.ClientMessage("NBSP package restriction is now on");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "checkmods":
		if (CheckMods)
		{
			CheckMods = False;
			b.ClientMessage("NBSP mod checking is now off");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		else
		{
			CheckMods = True;
			b.ClientMessage("NBSP mod checking is now on");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "checkskins":
		if (CheckSkins)
		{
			CheckSkins = False;
			b.ClientMessage("NBSP skin checking is now off");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		else
		{
			CheckSkins = True;
			b.ClientMessage("NBSP skin checking is now on");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "validateactors":
		if (ValidateActors)
		{
			ValidateActors = False;
			b.ClientMessage("NBSP actor validation is now off.");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		else
		{
			ValidateActors = True;
			b.ClientMessage("NBSP actor validation is now on.");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "validateresponseclass":
		if (ValidateResponseClass)
		{
			ValidateResponseClass = False;
			b.ClientMessage("NBSP class response validation is now off.");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		else
		{
			ValidateResponseClass = True;
			b.ClientMessage("NBSP class response validation is now on.");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "checkpaths":
		if (CheckPaths)
		{
			CheckPaths = False;
			b.ClientMessage("NBSP paths check is now off.");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		else
		{
			CheckPaths = True;
			b.ClientMessage("NBSP paths check is now on.");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "killclientactors":
		if (KillClientActors)
		{
			KillClientActors = False;
			b.ClientMessage("NBSP, KillClientActors is now off.");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		else
		{
			KillClientActors = True;
			b.ClientMessage("NBSP, KillClientActors is now on.");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
		case "disablemods":
		if (DisableMods)
		{
			DisableMods = False;
			b.ClientMessage("NBSP, Disabling of Mods is now inactive.");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		else
		{
			DisableMods = True;
			b.ClientMessage("NBSP, Disabling of Mods is now active.");
			b.ClientMessage("Changes will take effect on map change/restart.");
		}
		break;
	}
	SaveConfig();
}
 
defaultproperties
{
	Enabled=True
	SecurityLevel=2
	SecurityFrequency=2.000000
	InitialCheckFrequency=0.500000
	DisplayLevel=2
	BroadcastLevel=0
	LogLevel=3
	MaxTimeout=15
	Advertise=True
	AdvertiseText="[NBSP]"
	AdminEmail="user@user.com"
	ServerURL=""
	CheckSpectators=False
	AllowedConsole="UTMenu.UTConsole,XConsole.XConsole"
	CheckPackages=True
	RestrictPackages=False
	CheckMods=True
	CheckSkins=True
	ValidateActors=False
	ValidateResponseClass=False
	KillClientActors=True
	CheckPaths=False
	DisableMods=False
	EncryptionKey="����������������������������������������������"
}

Footer