The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

BZFlag::Info - Extracts infomation about BZFlag servers and players

SYNOPSIS

    use BZFlag::Info;
    
    my $bzinfo = new BZFlag::Info;
    
    my $serverlist = $bzinfo->serverlist;
    my $serverlist = $bzinfo->serverlist(Proxy => 'host:port', Server => 'http://listserver/');
    
    my $serverinfo = $bzinfo->queryserver(Server => 'host:port');
    

DESCRIPTION

BZFlag::Info is a class for extracting information about BZFlag clients and servers. Currently, 6 methods are implemented, new, serverlist, queryserver, parsestyle, listserver, and geterror.

METHODS

my $bzinfo = new BZFlag::Info;

new constructs a new BZFlag::Info object. It takes no arguments.

my $serverlist = $bzinfo->serverlist;

serverlist retrieves the current list of public servers. Then returns a data structure that would be displayed by Data::Dumper like this:

    $VAR1 = {
          'totalservers' => 1,
          'totalplayers' => 6
          'servers' => {
                         'bzflag.secretplace.us:5255' => {
                                                           'serverconfig' => {
                                                                               'purplemax' => 5,
                                                                               'redmax' => 5,
                                                                               'bluemax' => 5,
                                                                               'greenmax' => 5,
                                                                               'roguemax' => 10,
                                                                               'shakewins' => 1,
                                                                               'observermax' => 5,
                                                                               'style' => {
                                                                                            'ctf' => 0,
                                                                                            'jumping' => 1,
                                                                                            'shakable' => 1,
                                                                                            'antidoteflags' => 1,
                                                                                            'inertia' => 0,
                                                                                            'ricochet' => 1,
                                                                                            'timesync' => 0,
                                                                                            'rabbitchase' => 0,
                                                                                            'superflags' => 1,
                                                                                            'rogues' => 0
                                                                                          },
                                                                               'maxshots' => 10,
                                                                               'maxteamscore' => 0,
                                                                               'shaketimeout' => '5',
                                                                               'maxtime' => 0,
                                                                               'maxplayerscore' => 0
                                                                             },
                                                           'ip' => '69.28.129.162',
                                                           'version' => 'BZFS1910',
                                                           'redsize' => 0,
                                                           'description' => 'Now playing Spirals 3.0 by BZDoug.',
                                                           'bluesize' => 1,
                                                           'numplayers' => 6,
                                                           'roguesize' => 4,
                                                           'observersize' => 0,
                                                           'purplesize' => 0,
                                                           'greensize' => 1
                                                         },
          };

It can also take 2 options. The Proxy option specifies a proxy server to handle the HTTP request. The Server option specifies an alternate BZFlag list server to retrieve the server list from.

my $serverinfo = $bzinfo->queryserver(Server => 'host:port');

queryserver extracts information about players and teams from the BZFlag server specified with the Server option. It returns a data structure that would be displayed by Data::Dumper like this:

    ## brlcad.org:14244

    $VAR1 = {
          'numplayers' => 2,
          'serverconfig' => {
                              'purplemax' => 200,
                              'redmax' => 200,
                              'bluemax' => 200,
                              'shakewins' => 0,
                              'greenmax' => 200,
                              'roguemax' => 200,
                              'style' => {
                                           'ctf' => 1,
                                           'jumping' => 1,
                                           'shakable' => 0,
                                           'antidoteflags' => 1,
                                           'inertia' => 0,
                                           'ricochet' => 1,
                                           'timesync' => 0,
                                           'rabbitchase' => 0,
                                           'superflags' => 1,
                                           'rogues' => 0
                                         },
                              'maxshots' => 2,
                              'maxteamscore' => 10,
                              'maxplayers' => 8,
                              'maxtime' => 0,
                              'shaketimeout' => 0,
                              'maxplayerscore' => 100
                            },
          'numteams' => 5,
          'teams' => {
                       'X' => {
                                'losses' => 0,
                                'wins' => 0,
                                'score' => 0,
                                'size' => 1
                              },
                       'P' => {
                                'losses' => 0,
                                'wins' => 0,
                                'score' => 0,
                                'size' => 0
                              },
                       'R' => {
                                'losses' => 0,
                                'wins' => 0,
                                'score' => 0,
                                'size' => 0
                              },
                       'G' => {
                                'losses' => 0,
                                'wins' => 0,
                                'score' => 0,
                                'size' => 0
                              },
                       'B' => {
                                'losses' => 0,
                                'wins' => 0,
                                'score' => 0,
                                'size' => 1
                              }
                     },
          'players' => {
                         'romfis' => {
                                       'losses' => 34,
                                       'wins' => 95,
                                       'email' => 'Roman Fischer@fischer-medion',
                                       'pID' => 1,
                                       'score' => 61,
                                       'team' => 'X',
                                       'tks' => 0
                                     },
                         'slowfox' => {
                                        'losses' => 80,
                                        'wins' => 29,
                                        'email' => 'tester@linux.local',
                                        'pID' => 0,
                                        'score' => -51,
                                        'team' => 'B',
                                        'tks' => 0
                                      }
                       }
        };

X, R, G, B, P, O, and H stand for Rogue, Red, Green, Blue, Purple, Observer, and Rabbit, respectively.

If there was an error retrieving information on a BZFlag server, queryserver will return undef, geterror will return the error.

my $styleinfo = $bzinfo->parsestyle($style);

parsestyle extracts information about game style from one of the style field returned from either the list server or the game server. BZFlag server specified with the Server option. It returns a data structure that would be displayed by Data::Dumper like this:

    $VAR1 = {
           'ctf' => 1,
           'jumping' => 1,
           'shakable' => 0,
           'antidoteflags' => 1,
           'inertia' => 0,
           'ricochet' => 1,
           'timesync' => 0,
           'rabbitchase' => 0,
           'superflags' => 1,
           'rogues' => 0
         },

BUGS

I have no idea, tell me if there are any.

AUTHOR

Tucker McLean, tuckerm@noodleroni.com

COPYRIGHT

Copyright (c) 2003 Tucker McLean, Tim Riker.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.