diff options
| author | Darkelarious <darkelarious@333networks.com> | 2021-09-09 14:02:36 +0200 |
|---|---|---|
| committer | Darkelarious <darkelarious@333networks.com> | 2021-09-09 14:02:36 +0200 |
| commit | abf0ef36b57c72b17d414673ecaadd74cf408134 (patch) | |
| tree | 9f56739bf25d209a7a795b28fe39ace05647b7ed /lib/MasterWebInterface/Handler | |
| parent | 91729ec8ac5a8098cef2aa1c006aba88f6ef7eb3 (diff) | |
| download | WebInterface-Perl-abf0ef36b57c72b17d414673ecaadd74cf408134.tar.gz WebInterface-Perl-abf0ef36b57c72b17d414673ecaadd74cf408134.zip | |
style fix, readable gametypes
Diffstat (limited to 'lib/MasterWebInterface/Handler')
| -rwxr-xr-x | lib/MasterWebInterface/Handler/ServInfo.pm | 13 | ||||
| -rwxr-xr-x | lib/MasterWebInterface/Handler/Servers.pm | 15 |
2 files changed, 15 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; }, ); |
