ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.231 by root, Wed Apr 4 00:02:06 2007 UTC vs.
Revision 1.233 by root, Wed Apr 4 02:20:27 2007 UTC

1147=cut 1147=cut
1148 1148
1149sub ext_event($$%) { 1149sub ext_event($$%) {
1150 my ($self, $type, %msg) = @_; 1150 my ($self, $type, %msg) = @_;
1151 1151
1152 delete $msg{msgid}; 1152 $self->ns->ext_event ($type, %msg);
1153 $msg{msgtype} = "event";
1154 $msg{eventtype} = $type;
1155
1156 $self->send ("ext " . cf::to_json \%msg);
1157} 1153}
1158 1154
1159package cf; 1155package cf;
1160 1156
1161=back 1157=back
1969 1965
1970 return unless $self->type == cf::PLAYER; 1966 return unless $self->type == cf::PLAYER;
1971 1967
1972 if ($exit->slaying eq "/!") { 1968 if ($exit->slaying eq "/!") {
1973 #TODO: this should de-fi-ni-te-ly not be a sync-job 1969 #TODO: this should de-fi-ni-te-ly not be a sync-job
1970 # the problem is that $exit might not survive long enough
1971 # so it needs to be done right now, right here
1974 cf::sync_job { prepare_random_map $exit }; 1972 cf::sync_job { prepare_random_map $exit };
1975 } 1973 }
1976 1974
1977 my $slaying = cf::map::normalise $exit->slaying, $exit->map && $exit->map->path; 1975 my $slaying = cf::map::normalise $exit->slaying, $exit->map && $exit->map->path;
1978 my $hp = $exit->stats->hp; 1976 my $hp = $exit->stats->hp;
1986 $self->goto ($slaying, $hp, $sp); 1984 $self->goto ($slaying, $hp, $sp);
1987 1985
1988 1; 1986 1;
1989 }) { 1987 }) {
1990 $self->message ("Something went wrong deep within the crossfire server. " 1988 $self->message ("Something went wrong deep within the crossfire server. "
1991 . "I'll try to bring you back to the map you were before. " 1989 . "I'll try to bring you back to the map you were before. "
1992 . "Please report this to the dungeon master!", 1990 . "Please report this to the dungeon master!",
1993 cf::NDI_UNIQUE | cf::NDI_RED); 1991 cf::NDI_UNIQUE | cf::NDI_RED);
1994 1992
1995 warn "ERROR in enter_exit: $@"; 1993 warn "ERROR in enter_exit: $@";
1996 $self->leave_link; 1994 $self->leave_link;
1997 } 1995 }
1998 })->prio (1); 1996 })->prio (1);
2014 2012
2015 utf8::encode $text; 2013 utf8::encode $text;
2016 $self->send_packet (sprintf "drawinfo %d %s", $flags || cf::NDI_BLACK, $text); 2014 $self->send_packet (sprintf "drawinfo %d %s", $flags || cf::NDI_BLACK, $text);
2017} 2015}
2018 2016
2017=item $client->ext_event ($type, %msg)
2018
2019Sends an exti event to the client.
2020
2021=cut
2022
2023sub cf::client::ext_event($$%) {
2024 my ($self, $type, %msg) = @_;
2025
2026 $msg{msgtype} = "event_$type";
2027 $self->send_packet ("ext " . cf::to_json \%msg);
2028}
2019 2029
2020=item $success = $client->query ($flags, "text", \&cb) 2030=item $success = $client->query ($flags, "text", \&cb)
2021 2031
2022Queues a query to the client, calling the given callback with 2032Queues a query to the client, calling the given callback with
2023the reply text on a reply. flags can be C<cf::CS_QUERY_YESNO>, 2033the reply text on a reply. flags can be C<cf::CS_QUERY_YESNO>,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines