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.2

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.

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' => 0,
                                        'Setill' => 0,
                                        'Baston' => 0,
                                        'Soshise' => 0,
                                        'Mardun' => 0,
                                        'Ehasara' => 0
                                },
                'most_active_players' => {
                                        'Javeroal' => '1960.31',
                                        'Ganinos' => '1383.72',
                                        'Proteous' => '1849.31',
                                        'Ogu' => '1486.75',
                                        'Verrliit' => '1545.64'
                                        },
                'best_advisors' => {
                                'Wechafel' => '0',
                                'Greldolin' => '0',
                                'Carling' => '0',
                                'Nightelf' => '0',
                                'Yosir' => '0'
                                },
                'cleverer_players' => {
                                        'Maximillian' => '127.00',
                                        'Chromo' => '127.00',
                                        'Thinkundus' => '139.00',
                                        'Marco' => '140.00',
                                        'Lemethian' => '124.00'
                                },
                'best_player_average' => {
                                        'Anfa' => {
                                                        'hours_per_day' => '9.0277',
                                                        'day_active' => '62'
                                                },
                                        'Javeroal' => {
                                                        'hours_per_day' => '11.2662',
                                                        'day_active' => '174'
                                                        },
                                        'Covirose' => {
                                                        'hours_per_day' => '8.7113',
                                                        'day_active' => '23'
                                                        },
                                        'Tutoned' => {
                                                        'hours_per_day' => '8.8385',
                                                        'day_active' => '27'
                                                        },
                                        'Satayne' => {
                                                        'hours_per_day' => '9.7779',
                                                        'day_active' => '127'
                                                        }
                                        },
                'stronger_players' => {
                                        'Ozbi' => '150.00',
                                        'Kordin' => '150.00',
                                        'Eolius' => '151.00',
                                        'Rilno' => '150.00',
                                        'Slimx' => '150.00'
                                },
                'dueling_champs' => {
                                        'Tarel' => '516.96',
                                        '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"?>
        <planeshift-info>
                <server-status>
                        <time>Sat Feb 25 22:30:57 SGT 2006</time>
                        <total-online>28</total-online>
                        <accounts>197554</accounts>
                        <report-time->Sat Feb 25 22:30:57 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>75408</characters>
                        <net-version>0x47 </net-version>
                </server-status>
                <online-players>
                </online-players>
                <most-active-players>
                        <player name="Javeroal" hours="1960.31"/>
                        <player name="Ganinos" hours="1383.72"/>
                        <player name="Proteous" hours="1849.31"/>
                        <player name="Ogu" hours="1486.75"/>
                        <player name="Verrliit" hours="1545.64"/>
                </most-active-players>
                <best-advisors>
                        <player name="Lokizzle" points="0"/>
                        <player name="Kamarier" points="0"/>
                        <player name="Tfecw" points="0"/>
                        <player name="Hanarray" points="0"/>
                        <player name="Mannoth" points="0"/>
                </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="9.0277" day-active="62"/>
                        <player name="Javeroal" hours-per-day="11.2662" day-active="174"/>
                        <player name="Covirose" hours-per-day="8.7113" day-active="23"/>
                        <player name="Tutoned" hours-per-day="8.8385" day-active="27"/>
                        <player name="Satayne" hours-per-day="9.7779" day-active="127"/>
                </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.96"/>
                        <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>
        </planeshift-info>

AUTHOR

Arnaud DUPUIS, <dupuisarn at cpan.org>

BUGS

Please report any bugs or feature requests to bug-planeshift-info at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=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.