NAME

Deliantra::Protocol::Base - client protocol module

SYNOPSIS

   use base 'Deliantra::Protocol::Base'; # you have to subclass

DESCRIPTION

Base class to implement a crossfire client.

new Deliantra::Protocol::Base host => ..., port => ..., user => ..., pass => ...
my $guard = $con->addme_guard

Delays an addme until thre guard is destroyed.

METHODS THAT CAN/MUST BE OVERWRITTEN

$self->setup_req (key => value, ...)

Send a setup request for the given setting.

$self->setup_chk ($changed_setup)

Called when a setup reply is received from the server.

$self->setup ($setup)

Called after the last setup packet has been received, just before an addme request is sent.

$self->eof
$self->smooth_update ($facenum, $face)
$conn->ask_face ($num, $pri, $data_cb, $finish_cb)
$conn->anim_update ($num) [OVERWRITE]
$conn->sound_play ($type, $face, $dx, $dy, $volume)
$conn->query ($flags, $prompt)
$conn->msg ($default_color, $type, $text, @extra)
$conn->ex ($tag, $cb)
$conn->player_update ($player)

tag, weight, face, name

$conn->stats_update ($stats)
$conn->container_add ($id, $item...)
$conn->container_clear ($id)
$conn->item_update ($item)
$conn->item_delete ($item...)
$conn->spell_add ($spell)
      $spell = {
         tag          => ...,
         minlevel     => ...,
         casting_time => ...,
         mana         => ...,
         grace        => ...,
         level        => ...,
         skill        => ...,
         path         => ...,
         face         => ...,
         name         => ...,
      };
$conn->spell_update ($spell)

(the default implementation calls delete then add)

$conn->spell_delete ($spell)
$conn->magicmap ($w, $h, $px, $py, $data)
$conn->map_change ($type, ...)
$conn->map_change ($mode, ...) [OVERWRITE]
   current <flags> <x> <y> <width> <height> <hashstring>
$conn->map_clear [OVERWRITE]

Called whenever the map is to be erased completely.

$conn->map_update

Called whenever map data or faces have been received.

$conn->map_scroll ($dx, $dy) [OVERWRITE]

Called whenever the map has been scrolled.

$conn->face_update ($facenum, $facedata, $changed) [OVERWRITE]

Called with the face number of face structure whenever a face image becomes known (either because face_find returned it, in which case $changed is false, or because we got an update, in which case $changed is true).

$conn->face_find ($facenum, $facedata, $cb) [OVERWRITE]

Find and pass to the $cb callback the png image data for the given face, or the empty list if no face could be found, in which case it will be requested from the server.

$conn->send ($data)

Send a single packet/line to the server.

$conn->send_utf8 ($data)

Send a single packet/line to the server and encodes it to utf-8 before sending it.

$conn->send_command ($command])

Uses command to send a user-level command to the server. Encodes the command to UTF-8.

$conn->send_pickup ($pickup)

Sets the pickup configuration.

AUTHOR

 Marc Lehmann <schmorp@schmorp.de>
 http://home.schmorp.de/

 Robin Redeker <elmex@ta-sa.org>
 http://www.ta-sa.org/