Marc Lehmann > Deliantra-1.30 > Deliantra::Protocol::Base



Annotate this POD

View/Report Bugs
Module Version: 1.22   Source  


Deliantra::Protocol::Base - client protocol module


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


Base class to implement a crossfire client.

new Deliantra::Protocol::Base host => ..., port => ...


$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->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->drawextinfo ($color, $type, $subtype, $message)

default implementation calls msg

$conn->drawinfo ($color, $text)

default implementation calls msg

$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         => ...,
         message      => ...,
$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.


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[, $cb1[, $cb2]])

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

If the server supports a fixed version of the ncom command and this is detected by this module, the following is also supported:

If the callback $cb1 is given, calls it with the absolute time when this command has finished processing, as soon as this information is available.

If the callback $cb2 is given it will be called when the command has finished processing, to the best knowledge of this module :)

$conn->send_pickup ($pickup)

Sets the pickup configuration.


 Marc Lehmann <>

 Robin Redeker <>
syntax highlighting: