aboutsummaryrefslogtreecommitdiff
path: root/lib/MasterWebInterface
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MasterWebInterface')
-rwxr-xr-xlib/MasterWebInterface/Handler/ServInfo.pm13
-rwxr-xr-xlib/MasterWebInterface/Handler/Servers.pm15
-rwxr-xr-xlib/MasterWebInterface/Util/GameTypes.pm59
3 files changed, 74 insertions, 13 deletions
diff --git a/lib/MasterWebInterface/Handler/ServInfo.pm b/lib/MasterWebInterface/Handler/ServInfo.pm
index 7dc5e55..032f929 100755
--- a/lib/MasterWebInterface/Handler/ServInfo.pm
+++ b/lib/MasterWebInterface/Handler/ServInfo.pm
@@ -176,12 +176,17 @@ sub show_server
my @t = gmtime( time - ( $info->{dt_updated} // 0 ) );
my $diff;
- $diff .= ($t[5]-70)*365 + $t[7] > 0 ? ( ($t[5]-70)*365 + $t[7])."d" : "" ; # years+days
- $diff .= ($t[2] ? $t[2]."h" : ""); # hours
- $diff .= ($t[1] ? $t[1]."m" : ""); # minutes
- $diff .= ($t[0] ? sprintf "%02ds", $t[0] : ""); # seconds
+ $diff .= ($t[5]-70)*365 + $t[7] > 0 ? ( ($t[5]-70)*365 + $t[7])." days" : "" ; # years+days
+ # if no years/days, add hours/minutes/seconds to display
+ if ( ($t[5]-70)*365 + $t[7] <= 0 )
+ {
+ $diff .= ($t[2] ? $t[2]."h" : ""); # hours
+ $diff .= ($t[1] ? $t[1]."m" : ""); # minutes
+ $diff .= ($t[0] ? sprintf "%02ds", $t[0] : ""); # seconds
+ }
+ # output and coloring
if ( length $diff )
{
span class => ( ($t[5]-70 or $t[7]) ? "r" : ($t[2] ? "o" : "g") ), $diff;
diff --git a/lib/MasterWebInterface/Handler/Servers.pm b/lib/MasterWebInterface/Handler/Servers.pm
index 374cddf..c360683 100755
--- a/lib/MasterWebInterface/Handler/Servers.pm
+++ b/lib/MasterWebInterface/Handler/Servers.pm
@@ -152,10 +152,10 @@ sub serverlist
td $gn;
}
- # game type (CTF, DM, Masterserver, CoopGame)
- td class => "tc4",
- title => $l->{gametype} // "",
- $l->{gametype} // "";
+ # game type (hover: raw, display: parsed)
+ td class => "tc4",
+ title => $l->{gametype},
+ $self->better_gametype($l->{gametype});
# number of players / maximum players
td class => "tc5";
@@ -165,11 +165,8 @@ sub serverlist
end;
# map title/name
- my $mapname = $l->{mapname} // $l->{maptitle} // "";
- my $maptitle = ( $l->{maptitle} && lc $l->{maptitle} ne "untitled" )
- ? $l->{maptitle}
- : $mapname;
- td class => "tc6", title => $mapname, $maptitle;
+ my $maplabel = ($l->{maptitle} && lc $l->{maptitle} ne "untitled" ? $l->{maptitle} : $l->{mapname});
+ td class => "tc6", title => $maplabel // "---", $maplabel // "---";
end;
},
);
diff --git a/lib/MasterWebInterface/Util/GameTypes.pm b/lib/MasterWebInterface/Util/GameTypes.pm
new file mode 100755
index 0000000..6dc26f4
--- /dev/null
+++ b/lib/MasterWebInterface/Util/GameTypes.pm
@@ -0,0 +1,59 @@
+package MasterWebInterface::Util::GameTypes;
+use strict;
+use warnings;
+use Exporter 'import';
+our @EXPORT = qw| better_gametype |;
+
+# translate default gametype names to better readable equivalents
+# in: string, out: string
+sub better_gametype
+{
+ my ($s, $gametype) = @_;
+
+ return " " unless $gametype;
+
+ # all available equivalents
+ my %types = (
+
+ # general abbreviations
+ "DM" => "Deathmatch",
+ "CTF" => "Capture the Flag",
+ "COOP" => "Cooperative Mission",
+
+
+ # Rune
+ "ArenaGameInfo" => "Arena",
+ "RuneMultiPlayer" => "Deathmatch",
+ "TVGame" => "Thirsty Vikings",
+ "SRGame" => "Shadow Rules",
+ "NomadsGame" => "Nomads",
+ "CapTheTorchGame" => "Capture the Torch",
+ "HeadBallGame" => "Headball",
+ "SarkballGame" => "Sarkball",
+ "VasArenaGame" => "VAS Arena",
+
+ # Unreal and Unreal Tournament
+ "DeathMatchPlus" => "Deathmatch",
+ "TeamGamePlus" => "Team Deathmatch",
+ "EUTDeathMatchPlus" => "Extra UT Deathmatch",
+ "CTFGame" => "Capture the Flag",
+ "Domination" => "Domination",
+ "LastManStanding" => "Last Man Standing",
+ "TLastManStanding" => "Team Last Man Standing",
+ "InstaGibDeathMatch" => "InstaGib",
+ "Assault" => "Assault",
+ "MonsterHunt" => "Monsterhunt",
+ "BunnyTrackGame" => "Bunnytrack",
+ "BunnyTrackNewNet" => "Bunnytrack",
+ "JailBreak" => "Jailbreak",
+ "TO3" => "Tactical Ops",
+ "LeagueAssault" => "League Assault",
+ "s_SWATGame" => "S.W.A.T.",
+ "SiegeGI" => "Siege",
+ "FreeSiegeGI" => "Siege",
+ );
+
+ return ($types{$gametype} // $gametype);
+}
+
+1;