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

NAME

Game::Planeshift::Info - A module to retrieve players' data on the main Planeshift server.

VERSION

Version 0.3

SYNOPSIS

Planeshift is a free MMORPG available at : http://www.planeshift.it.

This module allow you to easily get and parse data from the info page of a Planeshift server (so this module depend on LWP::Simple).

the default web page used to retrieve informations is on the Laanx server : http://laanx.fragnetics.com/index.php?page=char_stats.

    use Game::Planeshift::Info;

    my $ps = Game::Planeshift::Info->new(
        encoding => 'utf-8',
        players => ['Baston', 'Ehasara', 'Narita', 'Setill', 'Soshise', 'Mardun', 'Caules', 'Javeroal']
    );
    my $data = $ps->retrieve_info ;

CONSTRUCTOR

new([args])

The constructor take the followings arguments which are all optionnal :

encoding : A string. The encoding you currently use (default: iso-8859-1)

players : An arrayref. The list of players you want to see the status.

info_page : A string. The URL of the page to parse to retrieve informations on the Planeshift server (default: http://laanx.fragnetics.com/index.php?page=char_stats)

FUNCTIONS

retrieve_info

Get informations from the info page of the Planeshift server, parse the result and return a hashref with parsed data.

Here is an example :

        use Data::Dumper
        use Game::Planeshift::Info ;
        
        my my $ps = Game::Planeshift::Info->new(players => ['Baston', 'Ehasara', 'Narita', 'Setill', 'Soshise', 'Mardun', 'Caules', 'Javeroal']) ;
        print Dumper( $ps->retrieve_info );

On screen you will have :

        $VAR1 = {
                'online_players' => {
                                        'Caules' => 0,
                                        'Narita' => 0,
                                        'Javeroal' => 1,
                                        'Setill' => 0,
                                        'Baston' => 0,
                                        'Soshise' => 0,
                                        'Mardun' => 0,
                                        'Ehasara' => 0
                                },
                'most_active_players' => {
                                        'Javeroal' => '1963.53',
                                        'Ganinos' => '1388.28',
                                        'Proteous' => '1851.65',
                                        'Ogu' => '1486.75',
                                        'Verrliit' => '1552.45'
                                        },
                'server_status' => {
                                'Time' => 'Sun Feb 26 15:31:57 SGT 2006',
                                'Total_Online' => 45,
                                'Accounts' => '197993',
                                'Report_Time_' => 'Sun Feb 26 15:31:56 SGT 2006',
                                'Cal3d_Date' => '2005-05-15 00:00:00',
                                'PS_Date' => '2006-01-14 00:00:00',
                                'CS_Date' => '2006-01-04 00:00:00',
                                'CEL_Date' => '2006-01-04 00:00:00',
                                'Characters' => '75687',
                                'Net_Version' => '0x47 '
                                },
                'best_advisors' => {
                                'Waoredo' => '3',
                                'Virtutes' => '4',
                                'Janner' => '18',
                                'Minuis' => '18',
                                'Gigelf' => '8'
                                },
                'cleverer_players' => {
                                        'Maximillian' => '127.00',
                                        'Chromo' => '127.00',
                                        'Thinkundus' => '139.00',
                                        'Marco' => '140.00',
                                        'Lemethian' => '124.00'
                                        },
                'best_player_average' => {
                                        'Anfa' => {
                                                        'hours_per_day' => '8.9571',
                                                        'day_active' => '63'
                                                },
                                        'Javeroal' => {
                                                        'hours_per_day' => '11.2202',
                                                        'day_active' => '175'
                                                        },
                                        'Setill' => {
                                                        'hours_per_day' => '8.5811',
                                                        'day_active' => '130'
                                                        },
                                        'Tutoned' => {
                                                        'hours_per_day' => '8.5708',
                                                        'day_active' => '28'
                                                        },
                                        'Satayne' => {
                                                        'hours_per_day' => '9.7551',
                                                        'day_active' => '128'
                                                        }
                                        },
                'stronger_players' => {
                                        'Ozbi' => '150.00',
                                        'Kordin' => '150.00',
                                        'Eolius' => '151.00',
                                        'Rilno' => '150.00',
                                        'Slimx' => '150.00'
                                        },
                'dueling_champs' => {
                                        'Tarel' => '516.23',
                                        'Xshii' => '324.00',
                                        'Xeohna' => '300.00',
                                        'Brittany' => '263.33',
                                        'Kyixi' => '1008.00'
                                }
                };

NOTE: In the 'online_players' section you will find a hashref where keys are players' name and value a boolean (0 or 1). So obviously 0 is when player is not online and 1 when he is.

NOTE2: The only information keep in mind by the object after a call to this method is the list off online players.

is_online

Return true is the player is online.

        print "My coder is online !!!\n" if($ps->is_online('Baston')) ;

This method can be called statically :

        print "My coder is online !!!\n" if(Game::Planeshift::Info::is_online($data,'Baston));

server_is_up

Return a boolean (0 or 1). True if the server is up.

data2xml

Translate a data (returned by the retrieve_info() method) to XML :

        print $ps->data2xml( $ps->retrieve_info ) ;

The XML generated by this method on the data previously retrieve is :

        <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
        <Game-Planeshift-Info>
                <server-status>
                        <time>Sun Feb 26 15:31:57 SGT 2006</time>
                        <total-online>45</total-online>
                        <accounts>197993</accounts>
                        <report-time->Sun Feb 26 15:31:56 SGT 2006</report-time->
                        <cal3d-date>2005-05-15 00:00:00</cal3d-date>
                        <ps-date>2006-01-14 00:00:00</ps-date>
                        <cs-date>2006-01-04 00:00:00</cs-date>
                        <cel-date>2006-01-04 00:00:00</cel-date>
                        <characters>75687</characters>
                        <net-version>0x47 </net-version>
                </server-status>
                <online-players>
                        <player name="Javeroal" />
                </online-players>
                <most-active-players>
                        <player name="Javeroal" hours="1963.53"/>
                        <player name="Ganinos" hours="1388.28"/>
                        <player name="Proteous" hours="1851.65"/>
                        <player name="Ogu" hours="1486.75"/>
                        <player name="Verrliit" hours="1552.45"/>
                </most-active-players>
                <best-advisors>
                        <player name="Waoredo" points="3"/>
                        <player name="Virtutes" points="4"/>
                        <player name="Janner" points="18"/>
                        <player name="Minuis" points="18"/>
                        <player name="Gigelf" points="8"/>
                </best-advisors>
                <cleverer-players>
                        <player name="Maximillian" intelligence="127.00"/>
                        <player name="Chromo" intelligence="127.00"/>
                        <player name="Thinkundus" intelligence="139.00"/>
                        <player name="Marco" intelligence="140.00"/>
                        <player name="Lemethian" intelligence="124.00"/>
                </cleverer-players>
                <best-player-average>
                        <player name="Anfa" hours-per-day="8.9571" day-active="63"/>
                        <player name="Javeroal" hours-per-day="11.2202" day-active="175"/>
                        <player name="Setill" hours-per-day="8.5811" day-active="130"/>
                        <player name="Tutoned" hours-per-day="8.5708" day-active="28"/>
                        <player name="Satayne" hours-per-day="9.7551" day-active="128"/>
                </best-player-average>
                <stronger-players>
                        <player name="Ozbi" strength="150.00"/>
                        <player name="Kordin" strength="150.00"/>
                        <player name="Eolius" strength="151.00"/>
                        <player name="Rilno" strength="150.00"/>
                        <player name="Slimx" strength="150.00"/>
                </stronger-players>
                <dueling-champs>
                        <player name="Tarel" points="516.23"/>
                        <player name="Xshii" points="324.00"/>
                        <player name="Xeohna" points="300.00"/>
                        <player name="Brittany" points="263.33"/>
                        <player name="Kyixi" points="1008.00"/>
                </dueling-champs>
        </Game-Planeshift-Info>

AUTHOR

Arnaud DUPUIS, <dupuisarn at cpan.org>

BUGS

Please report any bugs or feature requests to bug-Game-Planeshift-Info at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Game-Planeshift-Info. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Game::Planeshift::Info

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2006 Arnaud DUPUIS, all rights reserved.

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