--- deliantra/server/ext/cfplus.ext 2007/11/14 08:09:46 1.10 +++ deliantra/server/ext/cfplus.ext 2010/04/11 04:52:07 1.17 @@ -64,7 +64,7 @@ if ($pl->cell_visible ($dx, $dy)) { for my $ob ($pl->ob->map->at ($pl->ob->x + $dx, $pl->ob->y + $dy)) { $res{npc_dialog} = [$ob->name, $dx, $dy] - if $near && NPC_Dialogue::has_dialogue $ob && !$pl->{npc_dialog}; + if $near && $ob->has_dialogue && !$pl->{npc_dialog}; } } @@ -87,7 +87,7 @@ my ($pl, $id, $token) = @_; #TODO: - # this is not a request, so returnign does no good: make it a request and die on error + # this is not a request, so returning does no good: make it a request and die on error return unless $pl->ob && $pl->ob->map; @@ -98,7 +98,7 @@ return (error => "only one dialog can be open at a time") if $pl->{npc_dialog}; # only one dialog at a time for my $npc ($pl->ob->map->at ($pl->ob->x + $dx, $pl->ob->y + $dy)) { - if (NPC_Dialogue::has_dialogue $npc) { + if ($npc->has_dialogue) { $pl->attach ("npc_dialog_active"); $pl->{npc_dialog} = new NPC_Dialogue pl => $pl, npc => $npc, id => $id; dialog_tell $id, $pl->{npc_dialog}, "hi"; @@ -151,7 +151,7 @@ gameserver => the hostname:port of the normal game server testserver => the hostname:port of the test server the maps can be tested on cvs_root => the (http) url where the cvs root for downloading is located - lib_root => the (http) url where crossfire.0 and archetypes can be found + lib_root => the (http) url where archetypes data can be found upload => the (http) url where clients can upload maps If those values are not supplied or empty strings, the server does not @@ -165,15 +165,21 @@ mapdir: the cvs root url originally used to download the map revision: cvs-revision originally used to download the map comment: a comment supplied by the user that documents the changes - cf_login: crossfire server login - cf_password: crossfire server password, optionally used for authentication purposes + login: deliantra server login + password: deliantra server password, optionally used for authentication purposes =cut cf::register_extcmd editor_support => sub { my ($pl, %msg) = @_; - map +($_ => $cf::CFG{"editor_$_"}), qw(servertype gameserver testserver cvs_root lib_root builder_ui) + my %cfg = map +($_ => $cf::CFG{"editor_$_"}), qw(servertype servertypes gameserver testserver cvs_root lib_root builder_ui); + + # clients 2.10 and below check for type and "nameserver" :/ + $cfg{type} = $cfg{servertype}; + $cfg{nameserver} = $cfg{gameserver}; + + %cfg }; sub unload { @@ -192,11 +198,20 @@ delete $pl->{npc_dialog}; $pl->detach ("npc_dialog_active"); }, + on_map_change => sub { + my ($pl) = @_; + + my $dialog = delete $pl->{npc_dialog} + or return; + + $pl->ext_msg ($dialog->{id} => error => "out of range"); + $pl->detach ("npc_dialog_active"); + }, on_move => sub { my ($pl, $dir) = @_; # must delay a bit :/ - my $delay; $delay = EV::timer 0, 0, sub { + my $delay; $delay = AE::timer 0, 0, sub { undef $delay; if (my $dialog = $pl->{npc_dialog}) { @@ -204,12 +219,11 @@ return if (abs $dx) <= 2 && (abs $dy) <= 2; + delete $pl->{npc_dialog}; $pl->ext_msg ($dialog->{id} => error => "out of range"); + $pl->detach ("npc_dialog_active"); } - - delete $pl->{npc_dialog}; - $pl->detach ("npc_dialog_active"); - }); + }; }, ;