diff options
| -rwxr-xr-x | Changelog | 22 | ||||
| -rwxr-xr-x | data/settings.pl | 8 | ||||
| -rwxr-xr-x | data/style.css | 8 | ||||
| -rwxr-xr-x | lib/MasterWebInterface/Handler/ServInfo.pm | 13 | ||||
| -rwxr-xr-x | lib/MasterWebInterface/Handler/Servers.pm | 15 | ||||
| -rwxr-xr-x | lib/MasterWebInterface/Util/GameTypes.pm | 59 | ||||
| -rw-r--r-- | s/style/333networks/style.css | 10 | ||||
| -rw-r--r-- | s/style/errorist/style.css | 10 | ||||
| -rw-r--r-- | s/style/gonespy/style.css | 10 | ||||
| -rw-r--r-- | s/style/halloween/style.css | 10 | ||||
| -rw-r--r-- | s/style/newbies/style.css | 10 | ||||
| -rw-r--r-- | s/style/oldunreal/style.css | 10 | ||||
| -rw-r--r-- | s/style/rune/style.css | 10 | ||||
| -rwxr-xr-x | util/skingen.pl | 4 |
14 files changed, 137 insertions, 62 deletions
@@ -1,12 +1,20 @@ Changelog: +09-09-2021: style fix, readable gametypes + * fix style so tabs are not overlapping title bars + * function to label game types as their readable counterparts + * replace "unknown" map title with mapname. Hover to display full name. + * adjust column widths to accomodate mapname and gametype length + * display only days after long timeout of server info update + + 05-09-2021: functional masterinterface with styles -* remove json api documentation (now at 333networks.com/json) -* refine the information fields in server info -* add style generation code to utilities -* 333networks style as default style -* update readme with style generation instructions + * remove json api documentation (now at 333networks.com/json) + * refine the information fields in server info + * add style generation code to utilities + * 333networks style as default style + * update readme with style generation instructions 23-05-2021: first version of masterinterface -* initial working version of webinterface compatible with MasterServer-Qt5 -* descriptive readme with user instructions + * initial working version of webinterface compatible with MasterServer-Qt5 + * descriptive readme with user instructions diff --git a/data/settings.pl b/data/settings.pl index 20f1db5..fff087d 100755 --- a/data/settings.pl +++ b/data/settings.pl @@ -2,16 +2,20 @@ package MasterWebInterface; our %S = (%S, # retain options from parent script - # site info + # site (for sharing options) site_url => "http://master.333networks.com", site_name => "333networks", email => 'master@333networks.com', + # database connection db_login => ["dbi:SQLite:dbname=/path/to/your/data/masterserver.db",'',''], # display - style => "default", + style => "333networks", + + # display the style selection/test box + style_box => 0, # do not display servers older than [seconds] window_time => 1800, diff --git a/data/style.css b/data/style.css index 5c674a1..6f38fa8 100755 --- a/data/style.css +++ b/data/style.css @@ -63,7 +63,7 @@ a:hover { /* mainboxes */ div.mainbox { border: 1px solid $textcol2$; - margin-bottom:21px; + margin: 21px 0 -10px 0; padding: 5px; box-shadow: 2px 2px 5px $shadow$; $_boxbg1$ @@ -359,16 +359,16 @@ div.mainbox.browse.serverlist table tr td.tc3.icon a { } div.mainbox.browse.serverlist table tr td.tc4 { - width:90px;text-align:left + width:110px;text-align:left } div.mainbox.browse.serverlist table tr td.tc5 { - width:70px; + width:60px; text-align:center } div.mainbox.browse.serverlist table tr td.tc6 { - width:140px; + width:150px; text-align:left } 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; diff --git a/s/style/333networks/style.css b/s/style/333networks/style.css index 48017c9..a94b81c 100644 --- a/s/style/333networks/style.css +++ b/s/style/333networks/style.css @@ -44,7 +44,7 @@ a:hover { margin: 0 auto; min-height: 100%; background: url(/style/333networks/333networks.png) no-repeat center 10px fixed; - padding-top: 113px; + padding-top: 88px; background-size: 500px; } @@ -63,7 +63,7 @@ a:hover { /* mainboxes */ div.mainbox { border: 1px solid #0af; - margin-bottom:21px; + margin: 21px 0 -10px 0; padding: 5px; box-shadow: 2px 2px 5px #222; background: #333; @@ -359,16 +359,16 @@ div.mainbox.browse.serverlist table tr td.tc3.icon a { } div.mainbox.browse.serverlist table tr td.tc4 { - width:90px;text-align:left + width:110px;text-align:left } div.mainbox.browse.serverlist table tr td.tc5 { - width:70px; + width:60px; text-align:center } div.mainbox.browse.serverlist table tr td.tc6 { - width:140px; + width:150px; text-align:left } diff --git a/s/style/errorist/style.css b/s/style/errorist/style.css index d656885..34af196 100644 --- a/s/style/errorist/style.css +++ b/s/style/errorist/style.css @@ -44,7 +44,7 @@ a:hover { margin: 0 auto; min-height: 100%; background: url(/style/errorist/errorist.png) no-repeat center 10px fixed; - padding-top: 76px; + padding-top: 51px; background-size: 500px; } @@ -63,7 +63,7 @@ a:hover { /* mainboxes */ div.mainbox { border: 1px solid #88f; - margin-bottom:21px; + margin: 21px 0 -10px 0; padding: 5px; box-shadow: 2px 2px 5px #111; background: #333; @@ -359,16 +359,16 @@ div.mainbox.browse.serverlist table tr td.tc3.icon a { } div.mainbox.browse.serverlist table tr td.tc4 { - width:90px;text-align:left + width:110px;text-align:left } div.mainbox.browse.serverlist table tr td.tc5 { - width:70px; + width:60px; text-align:center } div.mainbox.browse.serverlist table tr td.tc6 { - width:140px; + width:150px; text-align:left } diff --git a/s/style/gonespy/style.css b/s/style/gonespy/style.css index 21541bb..2d00859 100644 --- a/s/style/gonespy/style.css +++ b/s/style/gonespy/style.css @@ -44,7 +44,7 @@ a:hover { margin: 0 auto; min-height: 100%; background: url(/style/gonespy/gonespytm.png) no-repeat center 10px fixed; - padding-top: 144px; + padding-top: 119px; background-size: 500px; } @@ -63,7 +63,7 @@ a:hover { /* mainboxes */ div.mainbox { border: 1px solid #0e0; - margin-bottom:21px; + margin: 21px 0 -10px 0; padding: 5px; box-shadow: 2px 2px 5px #222; background: #333; @@ -359,16 +359,16 @@ div.mainbox.browse.serverlist table tr td.tc3.icon a { } div.mainbox.browse.serverlist table tr td.tc4 { - width:90px;text-align:left + width:110px;text-align:left } div.mainbox.browse.serverlist table tr td.tc5 { - width:70px; + width:60px; text-align:center } div.mainbox.browse.serverlist table tr td.tc6 { - width:140px; + width:150px; text-align:left } diff --git a/s/style/halloween/style.css b/s/style/halloween/style.css index 58c0865..66ceb98 100644 --- a/s/style/halloween/style.css +++ b/s/style/halloween/style.css @@ -44,7 +44,7 @@ a:hover { margin: 0 auto; min-height: 100%; background: url(/style/halloween/333hw1.png) no-repeat center 10px fixed; - padding-top: 145px; + padding-top: 120px; background-size: 500px; } @@ -63,7 +63,7 @@ a:hover { /* mainboxes */ div.mainbox { border: 1px solid #fa0; - margin-bottom:21px; + margin: 21px 0 -10px 0; padding: 5px; box-shadow: 2px 2px 5px #552500; background: url(/style/halloween/g75.png) repeat center top; @@ -359,16 +359,16 @@ div.mainbox.browse.serverlist table tr td.tc3.icon a { } div.mainbox.browse.serverlist table tr td.tc4 { - width:90px;text-align:left + width:110px;text-align:left } div.mainbox.browse.serverlist table tr td.tc5 { - width:70px; + width:60px; text-align:center } div.mainbox.browse.serverlist table tr td.tc6 { - width:140px; + width:150px; text-align:left } diff --git a/s/style/newbies/style.css b/s/style/newbies/style.css index 8ffb4c7..aa57ad3 100644 --- a/s/style/newbies/style.css +++ b/s/style/newbies/style.css @@ -44,7 +44,7 @@ a:hover { margin: 0 auto; min-height: 100%; background: url(/style/newbies/newbs2.png) no-repeat center 10px fixed; - padding-top: 101px; + padding-top: 76px; background-size: 500px; } @@ -63,7 +63,7 @@ a:hover { /* mainboxes */ div.mainbox { border: 1px solid #2d851f; - margin-bottom:21px; + margin: 21px 0 -10px 0; padding: 5px; box-shadow: 2px 2px 5px #2d851f; background: #333; @@ -359,16 +359,16 @@ div.mainbox.browse.serverlist table tr td.tc3.icon a { } div.mainbox.browse.serverlist table tr td.tc4 { - width:90px;text-align:left + width:110px;text-align:left } div.mainbox.browse.serverlist table tr td.tc5 { - width:70px; + width:60px; text-align:center } div.mainbox.browse.serverlist table tr td.tc6 { - width:140px; + width:150px; text-align:left } diff --git a/s/style/oldunreal/style.css b/s/style/oldunreal/style.css index d03b829..61f78c1 100644 --- a/s/style/oldunreal/style.css +++ b/s/style/oldunreal/style.css @@ -44,7 +44,7 @@ a:hover { margin: 0 auto; min-height: 100%; background: url(/style/oldunreal/oldunreal.png) no-repeat center 10px fixed; - padding-top: 102px; + padding-top: 77px; background-size: 500px; } @@ -63,7 +63,7 @@ a:hover { /* mainboxes */ div.mainbox { border: 1px solid #0f0; - margin-bottom:21px; + margin: 21px 0 -10px 0; padding: 5px; box-shadow: 2px 2px 5px #222; background: #333; @@ -359,16 +359,16 @@ div.mainbox.browse.serverlist table tr td.tc3.icon a { } div.mainbox.browse.serverlist table tr td.tc4 { - width:90px;text-align:left + width:110px;text-align:left } div.mainbox.browse.serverlist table tr td.tc5 { - width:70px; + width:60px; text-align:center } div.mainbox.browse.serverlist table tr td.tc6 { - width:140px; + width:150px; text-align:left } diff --git a/s/style/rune/style.css b/s/style/rune/style.css index f8c55e9..cafe77f 100644 --- a/s/style/rune/style.css +++ b/s/style/rune/style.css @@ -44,7 +44,7 @@ a:hover { margin: 0 auto; min-height: 100%; background: url(/style/rune/333runic.png) no-repeat center 10px fixed; - padding-top: 145px; + padding-top: 120px; background-size: 500px; } @@ -63,7 +63,7 @@ a:hover { /* mainboxes */ div.mainbox { border: 1px solid #fa0; - margin-bottom:21px; + margin: 21px 0 -10px 0; padding: 5px; box-shadow: 2px 2px 5px #552500; background: url(/style/rune/g75.png) repeat center top; @@ -359,16 +359,16 @@ div.mainbox.browse.serverlist table tr td.tc3.icon a { } div.mainbox.browse.serverlist table tr td.tc4 { - width:90px;text-align:left + width:110px;text-align:left } div.mainbox.browse.serverlist table tr td.tc5 { - width:70px; + width:60px; text-align:center } div.mainbox.browse.serverlist table tr td.tc6 { - width:140px; + width:150px; text-align:left } diff --git a/util/skingen.pl b/util/skingen.pl index 4304b88..81304e9 100755 --- a/util/skingen.pl +++ b/util/skingen.pl @@ -165,7 +165,9 @@ sub writeskin # get height my ($w, $h) = imgsize("$ROOT/s/style/$name/$o{bglogo}") or die $!; $o{_bglogo} = "background: url(/style/$name/$o{bglogo}) no-repeat center 10px fixed;"; - $o{_bgpadd} = "padding-top: " . int(500/$w*$h+20) . "px;"; + + # padding compensates for div.mainbox { margin } + $o{_bgpadd} = "padding-top: " . int(500/$w*$h-5) . "px;"; } # write the CSS |
