Roman M. Parparov > Empire > Empire

Download:
Empire-0.121.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.121   Source  

NAME ^

Empire - an interface for the Empire game http://www.wolfpackempire.com

SYNOPSIS ^

  use Empire;
  my $empire = Empire(-full=>1, # or 0
                      -host=>$host,
                      -port=>$port,
                      -country=>$coun,
                      -player=>$play,
                      -name=>$name,
                      -user=>$user);
  if ($empire->{SOCKET}) {
      $empire->empcmd($cmd);
      my ($status,$data) = $empire->empreadline();
  }

DESCRIPTION ^

This is a module that provides a connection interface to the Wolfpack Empire server. The constructor reads the server and the login data and creates a socket to the server. Then the following main methods become available:

Constructor

new Empire(%args).

The arguments as shown in synopsis are quite self-explainable. The -full argument indicates that the additional utility modules (Ship, Sector, Plane etc. - which are not fully ready yet) should also be loaded.

empcmd

$empire->empcmd($cmd);

This one just sends a command to the server

empreadline

$empire->empreadline($cmd);

This reads lines from the server until a prompt or a connection close protocol response is received. The inform, flash and data responses are consumed into three different variables to be manipulated correctly by the implementing program. A special treatment for notifying telegrams and announcements also exists.

coun pass user empkill killit play

$empire->coun($coun) et al.

These are methods used by the login procedure including killing the connection.

empstatus

%empstatus = $empire->empstatus();

This method returns a hash containing the field EMPSTATUS which is the last protocol response the server sent and the textual string accompanying it.

empbuffer

$empire->empbuffer(?cont)

This method is implemented for future use to serve as an information exchange buffer.

host port country player name

$empire->host() et al.

These methods serve the clients to find out information about the current connection in the $empire object.

minutes btu

$empire->btu()

$empire->minutes()

These methods provide information about the BTU (Bureaucratic Time Units) and the time used in the game by the player as presented in the main game prompt.

hasflash hasinform hastele hasanno clearflash clearinform cleartele clearanno

$empire->hasflash() et al.

These methods manipulate the received flash, inform, telexes and announcements as read by the empreadline method.

disconnect

$empire->disconnect()

Obvoious. =back

EXPORT ^

The protocol numbers of the Empire server are being exported.

SEE ALSO ^

The Wolfpack Empire site

http://www.wolfpackempire.com

The Wolfpack Empire Server project

http://sourceforge.net/projects/empserver

Programs based on this module:

http://empire.tau.ac.il/~romm/emp/

AUTHOR ^

Roman M. Parparov, <romm@empire.tau.ac.il>

COPYRIGHT AND LICENSE ^

Copyright (C) 2004 by Roman M. Parparov

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: