style: controls

This commit is contained in:
2020-11-28 23:12:58 +03:00
parent ee260f7a10
commit 8fa925e1e5
165 changed files with 2625 additions and 2625 deletions

View File

@ -20,7 +20,7 @@ static final function string GetClientCountryStr(string IP)
// Convert dotted IP-address into integer.
ParseStringIntoArray(IP,SA,".",false);
if(SA.Length<=1)
if (SA.Length<=1)
return "???";
i = int(SA[0])<<16 | int(SA[1])<<8 | int(SA[2]);
@ -33,22 +33,22 @@ static final function string GetClientCountryTag(int IP)
V = IP>>16; // Grab last IP value for lookup table.
if(V<=50)
if (V<=50)
V = 0;
else if(V<=100)
else if (V<=100)
V = 1;
else if(V<=150)
else if (V<=150)
V = 2;
else if(V<=200)
else if (V<=200)
V = 3;
else V = 4;
// Speed up using lookup table.
End = Default.EndIndex[V];
for(i=Default.StartIndex[V]; i<End; ++i)
for (i=Default.StartIndex[V]; i<End; ++i)
{
if(IP>=Default.CT[i].S && IP<=Default.CT[i].E) // See if entered range.
if (IP>=Default.CT[i].S && IP<=Default.CT[i].E) // See if entered range.
return Default.CN[Default.CT[i].C];
}
return "???";

View File

@ -14,7 +14,7 @@ final function bool LoadStatFile(PlayerController Other)
FlushData();
S = class'ServerExtMut'.Static.GetStatFile(Other.PlayerReplicationInfo.UniqueId);
if(Class'Engine'.Static.BasicLoadObject(Self,S,false,CurrentSaveVer))
if (Class'Engine'.Static.BasicLoadObject(Self,S,false,CurrentSaveVer))
{
BufferSize = Buffer.Length;
return true;
@ -34,19 +34,19 @@ final function SaveStatFile(PlayerController Other)
function SaveInt(int Value, optional byte MaxVal)
{
++MaxVal;
if((BufferOffset+MaxVal)>Buffer.Length)
if ((BufferOffset+MaxVal)>Buffer.Length)
{
Buffer.Length = (BufferOffset+MaxVal);
BufferSize = Buffer.Length;
}
Buffer[BufferOffset++] = Value & 255;
if(MaxVal>1)
if (MaxVal>1)
{
Buffer[BufferOffset++] = (Value >> 8) & 255;
if(MaxVal>2)
if (MaxVal>2)
{
Buffer[BufferOffset++] = (Value >> 16) & 255;
if(MaxVal>3)
if (MaxVal>3)
Buffer[BufferOffset++] = (Value >> 24) & 255;
}
}
@ -56,17 +56,17 @@ function int ReadInt(optional byte MaxVal)
local int Res;
++MaxVal;
if((BufferOffset+MaxVal)>BufferSize)
if ((BufferOffset+MaxVal)>BufferSize)
return 0;
Res = Buffer[BufferOffset++];
if(MaxVal>1)
if (MaxVal>1)
{
Res = Res | (Buffer[BufferOffset++] << 8);
if(MaxVal>2)
if (MaxVal>2)
{
Res = Res | (Buffer[BufferOffset++] << 16);
if(MaxVal>3)
if (MaxVal>3)
Res = Res | (Buffer[BufferOffset++] << 24);
}
}
@ -76,14 +76,14 @@ function SaveStr(string S)
{
local int i;
if(S=="")
if (S=="")
{
SaveInt(0,1);
return;
}
S = Left(S,255);
i = StrMap.Find(S);
if(i==-1)
if (i==-1)
{
i = StrMap.Length;
StrMap[StrMap.Length] = S;
@ -95,7 +95,7 @@ function string ReadStr()
local int i;
i = ReadInt(1);
if(i==0 || i>StrMap.Length)
if (i==0 || i>StrMap.Length)
return "";
return StrMap[i-1];
}
@ -148,7 +148,7 @@ final function DebugData()
GetData(B);
`Log("DEBUG DATA: Data size: "$B.Length);
for(i=0; i<B.Length; ++i)
for (i=0; i<B.Length; ++i)
{
S $= Chr(Max(B[i],1));
SS $= "."$B[i];
@ -174,12 +174,12 @@ function GetData(out array<byte> Res)
o = 3;
// write each entry.
for(i=0; i<StrMap.Length; ++i)
for (i=0; i<StrMap.Length; ++i)
{
l = Len(StrMap[i]);
Res.Insert(o,l+1);
Res[o++] = l;
for(j=0; j<l; ++j)
for (j=0; j<l; ++j)
Res[o++] = Asc(Mid(StrMap[i],j,1));
}
}
@ -195,11 +195,11 @@ function SetData(out array<byte> S)
o = 3;
// read each string map entry.
for(i=0; i<StrMap.Length; ++i)
for (i=0; i<StrMap.Length; ++i)
{
l = Buffer[o++];
StrMap[i] = "";
for(j=0; j<l; ++j)
for (j=0; j<l; ++j)
StrMap[i] $= Chr(Buffer[o++]);
}
Buffer.Remove(0,o);
@ -223,7 +223,7 @@ function PushEOFLimit(int EndOffset)
}
function PopEOFLimit()
{
if(EOFStack.Length==0)
if (EOFStack.Length==0)
{
`Log(Self@"WARNING: Tried to pop one EoF stack down too far!!!");
return; // Whoops, error.

View File

@ -19,7 +19,7 @@ static final function SetTopPlayers(ExtPlayerController Other)
bDirty = CheckBestTrack(Other.PlayerReplicationInfo,PM.TotalPlayTime,Default.TopPlaytimes);
bDirty = CheckBestTrack(Other.PlayerReplicationInfo,PM.TotalKills,Default.TopKills) || bDirty;
bDirty = CheckBestTrack(Other.PlayerReplicationInfo,PM.TotalEXP,Default.TopExp) || bDirty;
if(bDirty)
if (bDirty)
StaticSaveConfig();
}
static final function bool CheckBestTrack(PlayerReplicationInfo PRI, int Value, out array<FTopPlayers> V)
@ -30,15 +30,15 @@ static final function bool CheckBestTrack(PlayerReplicationInfo PRI, int Value,
S = class'OnlineSubsystem'.Static.UniqueNetIdToString(PRI.UniqueId);
l = class'ServerExtMut'.Default.MaxTopPlayers;
if(V.Length>l) // See if list has overflown incase an admin has changed the max stats value.
if (V.Length>l) // See if list has overflown incase an admin has changed the max stats value.
V.Length = l;
i = V.Find('ID',S); // First see if we have an entry from before.
if(i>=0)
if (i>=0)
{
if(V[i].V==Value) // Stat unchanged.
if (V[i].V==Value) // Stat unchanged.
{
if(V[i].N!=PRI.PlayerName) // Name has changed, update that.
if (V[i].N!=PRI.PlayerName) // Name has changed, update that.
{
V[i].N = PRI.PlayerName;
return true;
@ -47,11 +47,11 @@ static final function bool CheckBestTrack(PlayerReplicationInfo PRI, int Value,
}
// Remove entry and insert it back in list only if rank changed.
if((i>0 && V[i-1].V<Value) || (i<(V.Length-1) && V[i+1].V>Value))
if ((i>0 && V[i-1].V<Value) || (i<(V.Length-1) && V[i+1].V>Value))
V.Remove(i,1);
else // No change in rank.
{
if(V[i].N!=PRI.PlayerName) // Name has changed, update that.
if (V[i].N!=PRI.PlayerName) // Name has changed, update that.
{
V[i].N = PRI.PlayerName;
return true;
@ -60,15 +60,15 @@ static final function bool CheckBestTrack(PlayerReplicationInfo PRI, int Value,
}
}
for(i=0; i<l; ++i)
for (i=0; i<l; ++i)
{
if(i==V.Length || V[i].V<Value) // At final entry, or has higher value then this ranked player.
if (i==V.Length || V[i].V<Value) // At final entry, or has higher value then this ranked player.
{
V.Insert(i,1);
V[i].N = PRI.PlayerName;
V[i].V = Value;
V[i].ID = S;
if(V.Length>l) // See if list has overflown.
if (V.Length>l) // See if list has overflown.
V.Length = l;
return true;
}
@ -80,22 +80,22 @@ static final function bool GetStat(ExtPlayerController PC, byte ListNum, int Sta
{
local UniqueNetId ID;
switch(ListNum)
switch (ListNum)
{
case 0:
if(StatIndex>=Default.TopPlaytimes.Length)
if (StatIndex>=Default.TopPlaytimes.Length)
return false;
class'OnlineSubsystem'.Static.StringToUniqueNetId(Default.TopPlaytimes[StatIndex].ID,ID);
PC.ClientGetStat(ListNum,false,Default.TopPlaytimes[StatIndex].N,ID,Default.TopPlaytimes[StatIndex].V);
return true;
case 1:
if(StatIndex>=Default.TopKills.Length)
if (StatIndex>=Default.TopKills.Length)
return false;
class'OnlineSubsystem'.Static.StringToUniqueNetId(Default.TopKills[StatIndex].ID,ID);
PC.ClientGetStat(ListNum,false,Default.TopKills[StatIndex].N,ID,Default.TopKills[StatIndex].V);
return true;
case 2:
if(StatIndex>=Default.TopExp.Length)
if (StatIndex>=Default.TopExp.Length)
return false;
class'OnlineSubsystem'.Static.StringToUniqueNetId(Default.TopExp[StatIndex].ID,ID);
PC.ClientGetStat(ListNum,false,Default.TopExp[StatIndex].N,ID,Default.TopExp[StatIndex].V);

View File

@ -10,7 +10,7 @@ function cleanup()
{
webadmin = None;
MyMutator = None;
if(ExtAdminUI!=None)
if (ExtAdminUI!=None)
{
ExtAdminUI.Cleanup();
ExtAdminUI = None;
@ -39,7 +39,7 @@ final function IncludeFile(WebAdminQuery q, string file)
{
local string S;
if(webadmin.HTMLSubDirectory!="")
if (webadmin.HTMLSubDirectory!="")
{
S = webadmin.Path $ "/" $ webadmin.HTMLSubDirectory $ "/" $ file;
if (q.response.FileExists(S))
@ -80,7 +80,7 @@ final function AddConfigEditbox(WebAdminQuery q, string InfoStr, string CurVal,
local string S;
S = "<TR><TD><abbr title=\""$Tooltip$"\">"$InfoStr$":</abbr></TD><TD><input class=\"textbox\" class=\"text\" name=\""$ResponseVar$"\" value=\""$CurVal$"\"></TD>";
if(!bSkipTrail)
if (!bSkipTrail)
S $= "</TR>";
q.response.SendText(S);
}
@ -109,7 +109,7 @@ function handleExtMod(WebAdminQuery q)
local delegate<ExtWebAdmin_UI.OnSetValue> SetV;
local bool bEditArray;
if(ExtAdminUI==None)
if (ExtAdminUI==None)
{
ExtAdminUI = new (None) class'ExtWebAdmin_UI';
MyMutator.InitWebAdmin(ExtAdminUI);
@ -117,19 +117,19 @@ function handleExtMod(WebAdminQuery q)
// First check if user is trying to get to another page.
S = q.request.getVariable("GoToPage");
if(S!="")
if (S!="")
{
if(S=="Main Menu")
if (S=="Main Menu")
EditPageIndex = -1;
else EditPageIndex = ExtAdminUI.ConfigList.Find('PageName',S);
}
if(EditPageIndex<0 || EditPageIndex>=ExtAdminUI.ConfigList.Length)
if (EditPageIndex<0 || EditPageIndex>=ExtAdminUI.ConfigList.Length)
{
// Show main links page.
SendHeader(q,"Ext Server Links page");
q.response.SendText("<table id=\"settings\" class=\"grid\"><thead><tr><th>Links</th></tr></thead><tbody>");
for(i=0; i<ExtAdminUI.ConfigList.Length; ++i)
for (i=0; i<ExtAdminUI.ConfigList.Length; ++i)
q.response.SendText("<tr><td><form action=\""$webadmin.Path$ExtWebURL$"\"><input class=\"button\" name=\"GoToPage\" type=\"submit\" value=\""$ExtAdminUI.ConfigList[i].PageName$"\"></form></td></tr>");
q.response.SendText("</tbody></table></div></div></body></html>");
}
@ -137,51 +137,51 @@ function handleExtMod(WebAdminQuery q)
{
S = q.request.getVariable("edit"$EditPageIndex);
bEditArray = false;
if(S=="Submit")
if (S=="Submit")
{
// Read setting values.
for(i=0; i<ExtAdminUI.ConfigList[EditPageIndex].Configs.Length; ++i)
for (i=0; i<ExtAdminUI.ConfigList[EditPageIndex].Configs.Length; ++i)
{
S = q.request.getVariable("PR"$i,"#NULL");
if(S!="#NULL")
if (S!="#NULL")
{
SetV = ExtAdminUI.ConfigList[EditPageIndex].SetValue;
SetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,0,S);
}
else if(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType==1) // Checkboxes return nothing if unchecked.
else if (ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType==1) // Checkboxes return nothing if unchecked.
{
SetV = ExtAdminUI.ConfigList[EditPageIndex].SetValue;
SetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,0,"0");
}
}
}
else if(Left(S,5)=="Edit ")
else if (Left(S,5)=="Edit ")
{
i = ExtAdminUI.ConfigList[EditPageIndex].Configs.Find('UIName',Mid(S,5));
if(i!=-1 && ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1) // Check if valid.
if (i!=-1 && ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1) // Check if valid.
{
// Edit dynamic array.
bEditArray = true;
}
}
else if(Left(S,7)=="Submit ")
else if (Left(S,7)=="Submit ")
{
i = ExtAdminUI.ConfigList[EditPageIndex].Configs.Find('UIName',Mid(S,7));
if(i!=-1 && ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1) // Check if valid.
if (i!=-1 && ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1) // Check if valid.
{
// Submitted dynamic array values.
GetV = ExtAdminUI.ConfigList[EditPageIndex].GetValue;
SetV = ExtAdminUI.ConfigList[EditPageIndex].SetValue;
z = int(GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,-1));
for(j=z; j>=0; --j)
for (j=z; j>=0; --j)
{
if(q.request.getVariable("DEL"$j)=="1")
if (q.request.getVariable("DEL"$j)=="1")
SetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,j,"#DELETE");
else
{
S = q.request.getVariable("PR"$j,"New Line");
if(S!="New Line")
if (S!="New Line")
SetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,j,S);
}
}
@ -192,29 +192,29 @@ function handleExtMod(WebAdminQuery q)
SendHeader(q,ExtAdminUI.ConfigList[EditPageIndex].PageName$" ("$PathName(ExtAdminUI.ConfigList[EditPageIndex].ObjClass)$")");
q.response.SendText("<form method=\"post\" action=\""$webadmin.Path$ExtWebURL$"\"><table id=\"settings\" class=\"grid\">");
if(bEditArray)
if (bEditArray)
{
q.response.SendText("<table id=\"settings\" class=\"grid\"><thead><tr><th><abbr title=\""$ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIDesc$"\">Edit Array "$ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIName$"</abbr></th><th></th><th>Delete Line</th></tr></thead><tbody>");
GetV = ExtAdminUI.ConfigList[EditPageIndex].GetValue;
z = int(GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,-1));
for(j=0; j<=z; ++j)
for (j=0; j<=z; ++j)
{
if(j<z)
if (j<z)
S = GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,j);
else S = "New Line";
switch(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType)
switch (ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType)
{
case 0: // int
AddConfigEditbox(q,"["$j$"]",S,8,"PR"$j,"",true);
if(j<z)
if (j<z)
q.response.SendText("<TD><input type=\"checkbox\" name=\"DEL"$j$"\" value=\"1\" "$S$"></TD></TR>");
else q.response.SendText("<TD></TD></TR>");
break;
case 2: // string
AddConfigEditbox(q,"["$j$"]",S,80,"PR"$j,"",true);
if(j<z)
if (j<z)
q.response.SendText("<TD><input type=\"checkbox\" name=\"DEL"$j$"\" value=\"1\" "$S$"></TD></TR>");
else q.response.SendText("<TD></TD></TR>");
break;
@ -226,9 +226,9 @@ function handleExtMod(WebAdminQuery q)
else
{
q.response.SendText("<table id=\"settings\" class=\"grid\"><thead><tr><th>Settings</th></tr></thead><tbody>");
for(i=0; i<ExtAdminUI.ConfigList[EditPageIndex].Configs.Length; ++i)
for (i=0; i<ExtAdminUI.ConfigList[EditPageIndex].Configs.Length; ++i)
{
if(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1) // Dynamic array.
if (ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1) // Dynamic array.
{
GetV = ExtAdminUI.ConfigList[EditPageIndex].GetValue;
j = int(GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,-1));
@ -238,7 +238,7 @@ function handleExtMod(WebAdminQuery q)
{
GetV = ExtAdminUI.ConfigList[EditPageIndex].GetValue;
S = GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,0);
switch(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType)
switch (ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType)
{
case 0: // Int
AddConfigEditbox(q,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIName,S,8,"PR"$i,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIDesc);

View File

@ -19,7 +19,7 @@ function WriteValue(string Key, string Value)
}
function StartIntendent(string Section, optional string Key, optional string Value)
{
if(Key!="")
if (Key!="")
Logf(Intendent$"-<"$Section$" "$Key$"=\""$Value$"\">");
else Logf(Intendent$"-<"$Section$">");
Intendent $= Chr(9);

File diff suppressed because it is too large Load Diff

View File

@ -15,14 +15,14 @@ static final function int GetMapHistory(string MapName, string MapTitle)
MapName = Caps(MapName);
i = Default.M.Find(MapName);
if(i==-1)
if (i==-1)
{
i = Default.M.Length;
Default.M.Length = i+1;
Default.M[i] = MapName;
Default.N.Length = i+1;
}
if(!(MapTitle~=MapName) && MapTitle!=Class'WorldInfo'.Default.Title && MapTitle!="")
if (!(MapTitle~=MapName) && MapTitle!=Class'WorldInfo'.Default.Title && MapTitle!="")
Default.N[i].T = MapTitle;
return i;
}
@ -39,9 +39,9 @@ static final function UpdateMapHistory(int iWon)
{
local int i;
for(i=(Default.M.Length-1); i>=0; --i)
for (i=(Default.M.Length-1); i>=0; --i)
{
if(i==iWon)
if (i==iWon)
{
++Default.N[i].N;
Default.N[i].S = 0;
@ -51,7 +51,7 @@ static final function UpdateMapHistory(int iWon)
}
static final function AddMapKarma(int i, bool bUp)
{
if(bUp)
if (bUp)
++Default.N[i].U;
else ++Default.N[i].D;
}

View File

@ -10,14 +10,14 @@ function UpdateSentText()
function Broadcast(Actor Sender, coerce string Msg, optional name Type)
{
if((Type=='Say' || Type=='TeamSay') && Left(Msg,1)=="!" && PlayerController(Sender)!=None)
if ((Type=='Say' || Type=='TeamSay') && Left(Msg,1)=="!" && PlayerController(Sender)!=None)
Handler.ParseCommand(Mid(Msg,1),PlayerController(Sender));
NextBroadcaster.Broadcast(Sender,Msg,Type);
}
function BroadcastTeam(Controller Sender, coerce string Msg, optional name Type)
{
if((Type=='Say' || Type=='TeamSay') && Left(Msg,1)=="!" && PlayerController(Sender)!=None)
if ((Type=='Say' || Type=='TeamSay') && Left(Msg,1)=="!" && PlayerController(Sender)!=None)
Handler.ParseCommand(Mid(Msg,1),PlayerController(Sender));
NextBroadcaster.BroadcastTeam(Sender,Msg,Type);
}

View File

@ -31,7 +31,7 @@ final function IncludeFile(WebAdminQuery q, string file)
{
local string S;
if(webadmin.HTMLSubDirectory!="")
if (webadmin.HTMLSubDirectory!="")
{
S = webadmin.Path $ "/" $ webadmin.HTMLSubDirectory $ "/" $ file;
if (q.response.FileExists(S))
@ -72,7 +72,7 @@ final function AddConfigEditbox(WebAdminQuery q, string InfoStr, string CurVal,
local string S;
S = "<abbr title=\""$Tooltip$"\"><TD>"$InfoStr$":</TD><TD><input class=\"textbox\" class=\"text\" name=\""$ResponseVar$"\" size=\""$Min(100,MaxLen)$"\" value=\""$CurVal$"\" maxlength=\""$MaxLen$"\"></TD></abbr>";
if(!bNoTR)
if (!bNoTR)
S = "<TR>"$S$"</TR>";
q.response.SendText(S);
}
@ -86,7 +86,7 @@ function handleMapVotes(WebAdminQuery q)
local string S;
S = q.request.getVariable("edit");
if(S=="Submit")
if (S=="Submit")
{
class'xVotingHandler'.Default.VoteTime = int(q.request.getVariable("VT",string(class'xVotingHandler'.Default.VoteTime)));
class'xVotingHandler'.Default.MidGameVotePct = float(q.request.getVariable("MV",string(class'xVotingHandler'.Default.MidGameVotePct)));
@ -96,7 +96,7 @@ function handleMapVotes(WebAdminQuery q)
class'xVotingHandler'.Static.StaticSaveConfig();
EditSettingLine = -1;
}
else if(S=="New")
else if (S=="New")
{
i = class'xVotingHandler'.Default.GameModes.Length;
class'xVotingHandler'.Default.GameModes.Length = i+1;
@ -106,9 +106,9 @@ function handleMapVotes(WebAdminQuery q)
EditSettingLine = i;
class'xVotingHandler'.Static.StaticSaveConfig();
}
else if(S=="Save")
else if (S=="Save")
{
if(EditSettingLine>=0 && EditSettingLine<class'xVotingHandler'.Default.GameModes.Length)
if (EditSettingLine>=0 && EditSettingLine<class'xVotingHandler'.Default.GameModes.Length)
{
i = EditSettingLine;
class'xVotingHandler'.Default.GameModes[i].GameName = q.request.getVariable("GN",class'xVotingHandler'.Default.GameModes[i].GameName);
@ -123,17 +123,17 @@ function handleMapVotes(WebAdminQuery q)
}
else
{
for(i=0; i<class'xVotingHandler'.Default.GameModes.Length; ++i)
for (i=0; i<class'xVotingHandler'.Default.GameModes.Length; ++i)
{
S = q.request.getVariable("edit"$i);
if(S=="Delete")
if (S=="Delete")
{
class'xVotingHandler'.Default.GameModes.Remove(i,1);
class'xVotingHandler'.Static.StaticSaveConfig();
EditSettingLine = -1;
break;
}
else if(S=="Edit")
else if (S=="Edit")
{
EditSettingLine = i;
break;
@ -154,9 +154,9 @@ function handleMapVotes(WebAdminQuery q)
q.response.SendText("<form method=\"post\" action=\""$webadmin.Path$MapVoterURL$"\"><table id=\"settings\" class=\"grid\">");
q.response.SendText("<thead><tr><th colspan=7>Mapvote game modes</th></tr></thead><tbody>");
q.response.SendText("<tr><th>Game Name</th><th>Game Short Name</th><th>Game Class</th><th>Mutators</th><th>Options</th><th>Map Prefix</th><th></th></tr>");
for(i=0; i<class'xVotingHandler'.Default.GameModes.Length; ++i)
for (i=0; i<class'xVotingHandler'.Default.GameModes.Length; ++i)
{
if(EditSettingLine==i)
if (EditSettingLine==i)
{
q.response.SendText("<tr>",false);
AddInLineEditbox(q,class'xVotingHandler'.Default.GameModes[i].GameName,48,"GN","Game type long display name");

View File

@ -26,21 +26,21 @@ function PostBeginPlay()
local int i,j,z,n,UpV,DownV,Seq,NumPl;
local string S,MapFile;
if(WorldInfo.Game.BaseMutator==None)
if (WorldInfo.Game.BaseMutator==None)
WorldInfo.Game.BaseMutator = Self;
else WorldInfo.Game.BaseMutator.AddMutator(Self);
if(bDeleteMe) // This was a duplicate instance of the mutator.
if (bDeleteMe) // This was a duplicate instance of the mutator.
return;
MapFile = string(WorldInfo.GetPackageName());
iCurrentHistory = class'xMapVoteHistory'.Static.GetMapHistory(MapFile,WorldInfo.Title);
if(LastVotedGameInfo<0 || LastVotedGameInfo>=GameModes.Length)
if (LastVotedGameInfo<0 || LastVotedGameInfo>=GameModes.Length)
LastVotedGameInfo = 0;
if(MapChangeDelay==0)
if (MapChangeDelay==0)
MapChangeDelay = 3;
if(GameModes.Length==0) // None specified, so use current settings.
if (GameModes.Length==0) // None specified, so use current settings.
{
GameModes.Length = 1;
GameModes[0].GameName = "Killing Floor";
@ -56,11 +56,11 @@ function PostBeginPlay()
// Build maplist.
z = 0;
for(i=(Class'KFGameInfo'.Default.GameMapCycles.Length-1); i>=0; --i)
for (i=(Class'KFGameInfo'.Default.GameMapCycles.Length-1); i>=0; --i)
{
for(j=(Class'KFGameInfo'.Default.GameMapCycles[i].Maps.Length-1); j>=0; --j)
for (j=(Class'KFGameInfo'.Default.GameMapCycles[i].Maps.Length-1); j>=0; --j)
{
if(MaxMapsOnList>0 && Class'KFGameInfo'.Default.GameMapCycles[i].Maps[j]~=MapFile) // If we limit the maps count, remove current map.
if (MaxMapsOnList>0 && Class'KFGameInfo'.Default.GameMapCycles[i].Maps[j]~=MapFile) // If we limit the maps count, remove current map.
continue;
Maps.Length = z+1;
Maps[z].MapName = Class'KFGameInfo'.Default.GameMapCycles[i].Maps[j];
@ -76,10 +76,10 @@ function PostBeginPlay()
}
}
if(MaxMapsOnList>0)
if (MaxMapsOnList>0)
{
// Remove random maps from list.
while(Maps.Length>MaxMapsOnList)
while (Maps.Length>MaxMapsOnList)
Maps.Remove(Rand(Maps.Length),1);
}
@ -88,9 +88,9 @@ function PostBeginPlay()
}
function AddMutator(Mutator M)
{
if(M!=Self) // Make sure we don't get added twice.
if (M!=Self) // Make sure we don't get added twice.
{
if(M.Class==Class)
if (M.Class==Class)
M.Destroy();
else Super.AddMutator(M);
}
@ -108,15 +108,15 @@ function SetupBroadcast()
B.Handler = Self;
B.NextBroadcaster = WorldInfo.Game.BroadcastHandler;
WorldInfo.Game.BroadcastHandler = B;
if(!bNoWebAdmin)
if (!bNoWebAdmin)
{
foreach AllActors(class'WebServer',W)
break;
if(W!=None)
if (W!=None)
{
for(i=0; (i<10 && A==None); ++i)
for (i=0; (i<10 && A==None); ++i)
A = WebAdmin(W.ApplicationObjects[i]);
if(A!=None)
if (A!=None)
{
xW = new (None) class'xVoteWebApp';
A.addQueryHandler(xW);
@ -130,38 +130,38 @@ final function AddVote(int Count, int MapIndex, int GameIndex)
{
local int i,j;
if(bMapvoteHasEnded)
if (bMapvoteHasEnded)
return;
for(i=0; i<ActiveVotes.Length; ++i)
if(ActiveVotes[i].GameIndex==GameIndex && ActiveVotes[i].MapIndex==MapIndex)
for (i=0; i<ActiveVotes.Length; ++i)
if (ActiveVotes[i].GameIndex==GameIndex && ActiveVotes[i].MapIndex==MapIndex)
{
ActiveVotes[i].NumVotes += Count;
for(j=(ActiveVoters.Length-1); j>=0; --j)
for (j=(ActiveVoters.Length-1); j>=0; --j)
ActiveVoters[j].ClientReceiveVote(GameIndex,MapIndex,ActiveVotes[i].NumVotes);
if(ActiveVotes[i].NumVotes<=0)
if (ActiveVotes[i].NumVotes<=0)
{
for(j=(ActiveVoters.Length-1); j>=0; --j)
if(ActiveVoters[j].DownloadStage==2 && ActiveVoters[j].DownloadIndex>=i && ActiveVoters[j].DownloadIndex>0) // Make sure client doesn't skip a download at this point.
for (j=(ActiveVoters.Length-1); j>=0; --j)
if (ActiveVoters[j].DownloadStage==2 && ActiveVoters[j].DownloadIndex>=i && ActiveVoters[j].DownloadIndex>0) // Make sure client doesn't skip a download at this point.
--ActiveVoters[j].DownloadIndex;
ActiveVotes.Remove(i,1);
}
return;
}
if(Count<=0)
if (Count<=0)
return;
ActiveVotes.Length = i+1;
ActiveVotes[i].GameIndex = GameIndex;
ActiveVotes[i].MapIndex = MapIndex;
ActiveVotes[i].NumVotes = Count;
for(j=(ActiveVoters.Length-1); j>=0; --j)
for (j=(ActiveVoters.Length-1); j>=0; --j)
ActiveVoters[j].ClientReceiveVote(GameIndex,MapIndex,Count);
}
final function LogoutPlayer(PlayerController PC)
{
local int i;
for(i=(ActiveVoters.Length-1); i>=0; --i)
if(ActiveVoters[i].PlayerOwner==PC)
for (i=(ActiveVoters.Length-1); i>=0; --i)
if (ActiveVoters[i].PlayerOwner==PC)
{
ActiveVoters[i].Destroy();
break;
@ -172,8 +172,8 @@ final function LoginPlayer(PlayerController PC)
local xVotingReplication R;
local int i;
for(i=(ActiveVoters.Length-1); i>=0; --i)
if(ActiveVoters[i].PlayerOwner==PC)
for (i=(ActiveVoters.Length-1); i>=0; --i)
if (ActiveVoters[i].PlayerOwner==PC)
return;
R = Spawn(class'xVotingReplication',PC);
R.VoteHandler = Self;
@ -182,14 +182,14 @@ final function LoginPlayer(PlayerController PC)
function NotifyLogout(Controller Exiting)
{
if(PlayerController(Exiting)!=None)
if (PlayerController(Exiting)!=None)
LogoutPlayer(PlayerController(Exiting));
if (NextMutator != None)
NextMutator.NotifyLogout(Exiting);
}
function NotifyLogin(Controller NewPlayer)
{
if(PlayerController(NewPlayer)!=None)
if (PlayerController(NewPlayer)!=None)
LoginPlayer(PlayerController(NewPlayer));
if (NextMutator != None)
NextMutator.NotifyLogin(NewPlayer);
@ -197,30 +197,30 @@ function NotifyLogin(Controller NewPlayer)
function ClientDownloadInfo(xVotingReplication V)
{
if(bMapvoteHasEnded)
if (bMapvoteHasEnded)
{
V.DownloadStage = 255;
return;
}
switch(V.DownloadStage)
switch (V.DownloadStage)
{
case 0: // Game modes.
if(V.DownloadIndex>=GameModes.Length)
if (V.DownloadIndex>=GameModes.Length)
break;
V.ClientReceiveGame(V.DownloadIndex,GameModes[V.DownloadIndex].GameName,GameModes[V.DownloadIndex].GameShortName,GameModes[V.DownloadIndex].Prefix);
++V.DownloadIndex;
return;
case 1: // Maplist.
if(V.DownloadIndex>=Maps.Length)
if (V.DownloadIndex>=Maps.Length)
break;
if(Maps[V.DownloadIndex].MapTitle=="")
if (Maps[V.DownloadIndex].MapTitle=="")
V.ClientReceiveMap(V.DownloadIndex,Maps[V.DownloadIndex].MapName,Maps[V.DownloadIndex].UpVotes,Maps[V.DownloadIndex].DownVotes,Maps[V.DownloadIndex].Sequence,Maps[V.DownloadIndex].NumPlays);
else V.ClientReceiveMap(V.DownloadIndex,Maps[V.DownloadIndex].MapName,Maps[V.DownloadIndex].UpVotes,Maps[V.DownloadIndex].DownVotes,Maps[V.DownloadIndex].Sequence,Maps[V.DownloadIndex].NumPlays,Maps[V.DownloadIndex].MapTitle);
++V.DownloadIndex;
return;
case 2: // Current votes.
if(V.DownloadIndex>=ActiveVotes.Length)
if (V.DownloadIndex>=ActiveVotes.Length)
break;
V.ClientReceiveVote(ActiveVotes[V.DownloadIndex].GameIndex,ActiveVotes[V.DownloadIndex].MapIndex,ActiveVotes[V.DownloadIndex].NumVotes);
++V.DownloadIndex;
@ -237,25 +237,25 @@ function ClientCastVote(xVotingReplication V, int GameIndex, int MapIndex, bool
{
local int i;
if(bMapvoteHasEnded)
if (bMapvoteHasEnded)
return;
if(bAdminForce && V.PlayerOwner.PlayerReplicationInfo.bAdmin)
if (bAdminForce && V.PlayerOwner.PlayerReplicationInfo.bAdmin)
{
SwitchToLevel(GameIndex,MapIndex,true);
return;
}
if(!Class'xUI_MapVote'.Static.BelongsToPrefix(Maps[MapIndex].MapName,GameModes[GameIndex].Prefix))
if (!Class'xUI_MapVote'.Static.BelongsToPrefix(Maps[MapIndex].MapName,GameModes[GameIndex].Prefix))
{
V.PlayerOwner.ClientMessage("Error: Can't vote that map (wrong Prefix to that game mode)!");
return;
}
if(V.CurrentVote[0]>=0)
if (V.CurrentVote[0]>=0)
AddVote(-1,V.CurrentVote[1],V.CurrentVote[0]);
V.CurrentVote[0] = GameIndex;
V.CurrentVote[1] = MapIndex;
AddVote(1,MapIndex,GameIndex);
for(i=(ActiveVoters.Length-1); i>=0; --i)
for (i=(ActiveVoters.Length-1); i>=0; --i)
ActiveVoters[i].ClientNotifyVote(V.PlayerOwner.PlayerReplicationInfo,GameIndex,MapIndex);
TallyVotes();
}
@ -266,7 +266,7 @@ function ClientRankMap(xVotingReplication V, bool bUp)
function ClientDisconnect(xVotingReplication V)
{
ActiveVoters.RemoveItem(V);
if(V.CurrentVote[0]>=0)
if (V.CurrentVote[0]>=0)
AddVote(-1,V.CurrentVote[1],V.CurrentVote[0]);
TallyVotes();
}
@ -283,31 +283,31 @@ final function TallyVotes(optional bool bForce)
local int i,NumVotees,c,j;
local array<int> Candidates;
if(bMapvoteHasEnded)
if (bMapvoteHasEnded)
return;
NumVotees = ActiveVoters.Length;
c = 0;
if(bForce)
if (bForce)
{
// First check for highest result.
for(i=(ActiveVotes.Length-1); i>=0; --i)
for (i=(ActiveVotes.Length-1); i>=0; --i)
c = Max(c,ActiveVotes[i].NumVotes);
if(c>0)
if (c>0)
{
// Then check how many votes for the best.
for(i=(ActiveVotes.Length-1); i>=0; --i)
if(ActiveVotes[i].NumVotes==c)
for (i=(ActiveVotes.Length-1); i>=0; --i)
if (ActiveVotes[i].NumVotes==c)
Candidates.AddItem(i);
// Finally pick a random winner from the best.
c = Candidates[Rand(Candidates.Length)];
if(NumVotees>=4 && ActiveVotes.Length==1) // If more then 4 voters and everyone voted same map?!!! Give the mapvote some orgy.
if (NumVotees>=4 && ActiveVotes.Length==1) // If more then 4 voters and everyone voted same map?!!! Give the mapvote some orgy.
{
for(j=(ActiveVoters.Length-1); j>=0; --j)
for (j=(ActiveVoters.Length-1); j>=0; --j)
ActiveVoters[j].PlayerOwner.ClientPlaySound(AnnouncerCues[13]);
}
SwitchToLevel(ActiveVotes[c].GameIndex,ActiveVotes[c].MapIndex,false);
@ -318,11 +318,11 @@ final function TallyVotes(optional bool bForce)
c = Rand(Maps.Length);
// Pick a random gametype to win along with it.
for(i=(GameModes.Length-1); i>=0; --i)
if(Class'xUI_MapVote'.Static.BelongsToPrefix(Maps[c].MapName,GameModes[i].Prefix))
for (i=(GameModes.Length-1); i>=0; --i)
if (Class'xUI_MapVote'.Static.BelongsToPrefix(Maps[c].MapName,GameModes[i].Prefix))
Candidates.AddItem(i);
if(Candidates.Length==0) // Odd, a map without gametype...
if (Candidates.Length==0) // Odd, a map without gametype...
i = Rand(GameModes.Length);
else i = Candidates[Rand(Candidates.Length)];
@ -332,14 +332,14 @@ final function TallyVotes(optional bool bForce)
}
// Check for insta-win vote.
for(i=(ActiveVotes.Length-1); i>=0; --i)
for (i=(ActiveVotes.Length-1); i>=0; --i)
{
c+=ActiveVotes[i].NumVotes;
if(GetPctOf(ActiveVotes[i].NumVotes,NumVotees)>=MapWinPct)
if (GetPctOf(ActiveVotes[i].NumVotes,NumVotees)>=MapWinPct)
{
if(NumVotees>=4 && ActiveVotes.Length==1) // If more then 4 voters and everyone voted same map?!!! Give the mapvote some orgy.
if (NumVotees>=4 && ActiveVotes.Length==1) // If more then 4 voters and everyone voted same map?!!! Give the mapvote some orgy.
{
for(j=(ActiveVoters.Length-1); j>=0; --j)
for (j=(ActiveVoters.Length-1); j>=0; --j)
ActiveVoters[j].PlayerOwner.ClientPlaySound(AnnouncerCues[13]);
}
SwitchToLevel(ActiveVotes[i].GameIndex,ActiveVotes[i].MapIndex,false);
@ -348,19 +348,19 @@ final function TallyVotes(optional bool bForce)
}
// Check for mid-game voting timer.
if(!bMapVoteTimer && NumVotees>0 && GetPctOf(c,NumVotees)>=MidGameVotePct)
if (!bMapVoteTimer && NumVotees>0 && GetPctOf(c,NumVotees)>=MidGameVotePct)
StartMidGameVote(true);
}
final function StartMidGameVote(bool bMidGame)
{
local int i;
if(bMapVoteTimer || bMapvoteHasEnded)
if (bMapVoteTimer || bMapvoteHasEnded)
return;
bMapVoteTimer = true;
if(bMidGame)
if (bMidGame)
{
for(i=(ActiveVoters.Length-1); i>=0; --i)
for (i=(ActiveVoters.Length-1); i>=0; --i)
ActiveVoters[i].ClientNotifyVoteTime(0);
}
ShowMenuDelay = 5;
@ -369,15 +369,15 @@ final function StartMidGameVote(bool bMidGame)
}
function CheckEndGameEnded()
{
if(KF==None)
if (KF==None)
{
KF = KFGameReplicationInfo(WorldInfo.GRI);
if(KF==None)
if (KF==None)
return;
}
if(KF.bMatchIsOver) // HACK, since KFGameInfo_Survival doesn't properly notify mutators of this!
if (KF.bMatchIsOver) // HACK, since KFGameInfo_Survival doesn't properly notify mutators of this!
{
if(!bMapVoteTimer)
if (!bMapVoteTimer)
StartMidGameVote(false);
ClearTimer('CheckEndGameEnded');
WorldInfo.Game.ClearTimer('ShowPostGameMenu');
@ -385,7 +385,7 @@ function CheckEndGameEnded()
}
function bool HandleRestartGame()
{
if(!bMapVoteTimer)
if (!bMapVoteTimer)
StartMidGameVote(false);
return true;
}
@ -394,9 +394,9 @@ function Timer()
local int i;
local SoundCue FX;
if(bMapvoteHasEnded)
if (bMapvoteHasEnded)
{
if(WorldInfo.NextSwitchCountdown<=0.f) // Mapswitch failed, force to random other map.
if (WorldInfo.NextSwitchCountdown<=0.f) // Mapswitch failed, force to random other map.
{
ActiveVotes.Length = 0;
bMapvoteHasEnded = false;
@ -404,31 +404,31 @@ function Timer()
}
return;
}
if(ShowMenuDelay>0 && --ShowMenuDelay==0)
if (ShowMenuDelay>0 && --ShowMenuDelay==0)
{
for(i=(ActiveVoters.Length-1); i>=0; --i)
for (i=(ActiveVoters.Length-1); i>=0; --i)
ActiveVoters[i].ClientOpenMapvote(true);
}
--VoteTimeLeft;
if(VoteTimeLeft==0)
if (VoteTimeLeft==0)
{
TallyVotes(true);
}
else if(VoteTimeLeft<=10 || VoteTimeLeft==20 || VoteTimeLeft==30 || VoteTimeLeft==60)
else if (VoteTimeLeft<=10 || VoteTimeLeft==20 || VoteTimeLeft==30 || VoteTimeLeft==60)
{
FX = None;
if(VoteTimeLeft<=10)
if (VoteTimeLeft<=10)
FX = AnnouncerCues[VoteTimeLeft-1];
else if(VoteTimeLeft==20)
else if (VoteTimeLeft==20)
FX = AnnouncerCues[10];
else if(VoteTimeLeft==30)
else if (VoteTimeLeft==30)
FX = AnnouncerCues[11];
else if(VoteTimeLeft==60)
else if (VoteTimeLeft==60)
FX = AnnouncerCues[12];
for(i=(ActiveVoters.Length-1); i>=0; --i)
for (i=(ActiveVoters.Length-1); i>=0; --i)
{
ActiveVoters[i].ClientNotifyVoteTime(VoteTimeLeft);
if(FX!=None)
if (FX!=None)
ActiveVoters[i].PlayerOwner.ClientPlaySound(FX);
}
}
@ -438,13 +438,13 @@ final function SwitchToLevel(int GameIndex, int MapIndex, bool bAdminForce)
local int i;
local string S;
if(bMapvoteHasEnded)
if (bMapvoteHasEnded)
return;
Default.LastVotedGameInfo = GameIndex;
Class.Static.StaticSaveConfig();
bMapvoteHasEnded = true;
if(!bAdminForce && !bHistorySaved)
if (!bAdminForce && !bHistorySaved)
{
class'xMapVoteHistory'.Static.UpdateMapHistory(Maps[MapIndex].History);
class'xMapVoteHistory'.Static.StaticSaveConfig();
@ -452,21 +452,21 @@ final function SwitchToLevel(int GameIndex, int MapIndex, bool bAdminForce)
}
S = Maps[MapIndex].MapName$" ("$GameModes[GameIndex].GameName$")";
for(i=(ActiveVoters.Length-1); i>=0; --i)
for (i=(ActiveVoters.Length-1); i>=0; --i)
{
KFPlayerController(ActiveVoters[i].PlayerOwner).ShowConnectionProgressPopup(PMT_AdminMessage,"Switching to level:",S);
ActiveVoters[i].ClientNotifyVoteWin(GameIndex,MapIndex,bAdminForce);
}
PendingMapURL = Maps[MapIndex].MapName$"?Game="$GameModes[GameIndex].GameClass$"?Mutator="$PathName(BaseMutator);
if(GameModes[GameIndex].Mutators!="")
if (GameModes[GameIndex].Mutators!="")
PendingMapURL $= ","$GameModes[GameIndex].Mutators;
if(GameModes[GameIndex].Options!="")
if (GameModes[GameIndex].Options!="")
PendingMapURL $= "?"$GameModes[GameIndex].Options;
`Log("MapVote: Switch map to "$PendingMapURL);
SetTimer(FMax(MapChangeDelay,0.1),false,'PendingSwitch');
}
function PendingSwitch()
function Pendingswitch ()
{
WorldInfo.ServerTravel(PendingMapURL,false);
SetTimer(1,true);
@ -474,27 +474,27 @@ function PendingSwitch()
final function ParseCommand(string Cmd, PlayerController PC)
{
if(Cmd~="Help")
if (Cmd~="Help")
{
PC.ClientMessage("MapVote commands:");
PC.ClientMessage("!MapVote - Show mapvote menu");
PC.ClientMessage("!AddMap <Mapname> - Add map to mapvote");
PC.ClientMessage("!RemoveMap <Mapname> - Remove map from mapvote");
}
else if(Cmd~="MapVote")
else if (Cmd~="MapVote")
ShowMapVote(PC);
else if(!PC.PlayerReplicationInfo.bAdmin && !PC.IsA('MessagingSpectator'))
else if (!PC.PlayerReplicationInfo.bAdmin && !PC.IsA('MessagingSpectator'))
return;
else if(Left(Cmd,7)~="AddMap ")
else if (Left(Cmd,7)~="AddMap ")
{
Cmd = Mid(Cmd,7);
PC.ClientMessage("Added map '"$Cmd$"'!");
AddMap(Cmd);
}
else if(Left(Cmd,10)~="RemoveMap ")
else if (Left(Cmd,10)~="RemoveMap ")
{
Cmd = Mid(Cmd,10);
if(RemoveMap(Cmd))
if (RemoveMap(Cmd))
PC.ClientMessage("Removed map '"$Cmd$"'!");
else PC.ClientMessage("Map '"$Cmd$"' not found!");
}
@ -503,10 +503,10 @@ function ShowMapVote(PlayerController PC)
{
local int i;
if(bMapvoteHasEnded)
if (bMapvoteHasEnded)
return;
for(i=(ActiveVoters.Length-1); i>=0; --i)
if(ActiveVoters[i].PlayerOwner==PC)
for (i=(ActiveVoters.Length-1); i>=0; --i)
if (ActiveVoters[i].PlayerOwner==PC)
{
ActiveVoters[i].ClientOpenMapvote(false);
return;
@ -514,7 +514,7 @@ function ShowMapVote(PlayerController PC)
}
final function AddMap(string M)
{
if(Class'KFGameInfo'.Default.GameMapCycles.Length==0)
if (Class'KFGameInfo'.Default.GameMapCycles.Length==0)
Class'KFGameInfo'.Default.GameMapCycles.Length = 1;
Class'KFGameInfo'.Default.GameMapCycles[0].Maps.AddItem(M);
Class'KFGameInfo'.Static.StaticSaveConfig();
@ -523,11 +523,11 @@ final function bool RemoveMap(string M)
{
local int i,j;
for(i=(Class'KFGameInfo'.Default.GameMapCycles.Length-1); i>=0; --i)
for (i=(Class'KFGameInfo'.Default.GameMapCycles.Length-1); i>=0; --i)
{
for(j=(Class'KFGameInfo'.Default.GameMapCycles[i].Maps.Length-1); j>=0; --j)
for (j=(Class'KFGameInfo'.Default.GameMapCycles[i].Maps.Length-1); j>=0; --j)
{
if(Class'KFGameInfo'.Default.GameMapCycles[i].Maps[j]~=M)
if (Class'KFGameInfo'.Default.GameMapCycles[i].Maps[j]~=M)
{
Class'KFGameInfo'.Default.GameMapCycles[i].Maps.Remove(j,1);
Class'KFGameInfo'.Static.StaticSaveConfig();