NAME
Crossfire::Protocol::Base - client protocol module
SYNOPSIS
use base 'Crossfire::Protocol::Base'; # you have to subclass
DESCRIPTION
Base class to implement a crossfire client.
METHODS THAT CAN/MUST BE OVERWRITTEN
- $self->addme_success
- $self->addme_failure
- $self->eof
- $conn->anim_update ($num) [OVERWRITE]
- $conn->sound_play ($x, $y, $soundnum, $type)
- $conn->query ($flags, $prompt)
- $conn->drawextinfo ($color, $type, $subtype, $message)
- $conn->drawinfo ($color, $text)
- $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 => ..., level => ..., casting_time => ..., mana => ..., grace => ..., damage => ..., 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->image_info ($numfaces, $chksum, [...image-sets])
- $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 ([ [x,y], [x,y], ...]) [OVERWRITE]
-
Called with a list of x|y coordinate pairs (as arrayrefs) for cells that have been updated and need refreshing.
- $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) [OVERWRITE]
-
Find and return the png image 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_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 :)
AUTHOR
Marc Lehmann <schmorp@schmorp.de>
http://home.schmorp.de/
Robin Redeker <elmex@ta-sa.org>
http://www.ta-sa.org/