--- deliantra/Deliantra-Client/DC/Protocol.pm 2007/12/26 21:03:21 1.183 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2012/11/04 02:14:11 1.222 @@ -1,7 +1,8 @@ package DC::Protocol; -use utf8; -use strict; +use common::sense; + +use Guard (); use Deliantra::Protocol::Constants; @@ -14,23 +15,77 @@ use base 'Deliantra::Protocol::Base'; +our $TEX_DIALOGUE = new_from_resource DC::Texture + "dialogue.png", minify => 1, mipmap => 1; + +our $TEX_NOFACE = new_from_resource DC::Texture + "noface.png", minify => 1, mipmap => 1, wrap => 1; + +sub MIN_TEXTURE_UNUSED() { 1 }#d# + sub new { my ($class, %arg) = @_; my $self = $class->SUPER::new (%arg, setup_req => { extmap => 1, - excmd => 1, - widget => 1, + widget => 2, %{$arg{setup_req} || {}}, }, ); + $self->update_fx_want; + + my $guard = $self->addme_guard; + $self->send_exti_req (resource => "exp_table", sub { + my ($idx) = @_; + + $self->register_face_handler ($idx, sub { + my ($face) = @_; + + undef $guard; + $self->{exp_table} = $self->{json_coder}->decode (delete $face->{data}); + $_->() for values %{ $self->{on_exp_update} }; + }); + + () + }); + + my $guard = $self->addme_guard; + $self->send_exti_req (resource => "skill_info", sub { + my ($idx) = @_; + + $self->register_face_handler ($idx, sub { + my ($face) = @_; + + undef $guard; + my $info = $self->{json_coder}->decode (delete $face->{data}); + $self->{skill_info} = { map { CS_STAT_SKILLINFO + $_ => $info->[$_][0] } 0 .. $#$info }; + }); + + () + }); + + my $guard = $self->addme_guard; + $self->send_exti_req (resource => "spell_paths", sub { + my ($idx) = @_; + + $self->register_face_handler ($idx, sub { + my ($face) = @_; + + undef $guard; + my $info = $self->{json_coder}->decode (delete $face->{data}); + $self->{spell_paths} = { map { (1 << $_) => $info->[$_][0] } 0 .. $#$info }; + }); + + () + }); + $self->{map_widget}->clr_commands; my @cmd_help = map { - $_->{kw}[0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x - or die "unparseable command help: $_->{kw}[0]"; + $_->[DC::Pod::N_KW][0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x + or die "unparseable command help: $_->[DC::Pod::N_KW][0]"; my $cmd = $1; my @args = split /\|/, $2; @@ -45,7 +100,7 @@ map ["$cmd$_", $text], sort { (length $a) <=> (length $b) } @args - } sort { $a->{par} <=> $b->{par} } + } sort { $a->[DC::Pod::N_PAR] <=> $b->[DC::Pod::N_PAR] } DC::Pod::find command => "*"; $self->{json_coder} @@ -66,23 +121,42 @@ $_->destroy for values %{delete $ws->{w} || {}}; } + + delete $self->{items}; + $::INV->clear; + $::INVR->clear; + $::INVR_HB->clear; + $::FLOORBOX->clear; }); $self->{map_widget}->add_command (@$_) for @cmd_help; { - $self->{dialogue} = my $tex = new_from_file DC::Texture - DC::find_rcfile "dialogue.png", minify => 1, mipmap => 1; + $self->{dialogue} = my $tex = $TEX_DIALOGUE; $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}}); } { - $self->{noface} = my $tex = new_from_file DC::Texture - DC::find_rcfile "noface.png", minify => 1, mipmap => 1; + $self->{noface} = my $tex = $TEX_NOFACE; $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); } +# $self->{expire_count} = DC::DB::FIRST_TILE_ID; # minimum non-fixed tile id +# $self->{expire_w} = AE::timer 1, 1, sub { +# my $count = (int @{ $self->{texture} } / MIN_TEXTURE_UNUSED) || 1; +# +# for ($self->{map}->expire_textures ($self->{expire_count}, $count)) { +# warn DC::SvREFCNT $self->{texture}[$_]; +# $self->{texture}[$_]->unload; +# warn "expire texture $_\n";#d# +# } +# +# ($self->{expire_count} += $count) < @{ $self->{texture} } +# or $self->{expire_count} = DC::DB::FIRST_TILE_ID; +# warn "count is $count\n";#d# +# }; + $self->{open_container} = 0; # per server @@ -104,22 +178,6 @@ sub ext_capabilities { my ($self, %cap) = @_; - #$self->send ("setup sound 0"); # we use a different protocol - $self->update_fx_want; - - $self->send_exti_req (resource => "exp_table", sub { - my ($exp_table) = @_; - - $self->register_face_handler ($exp_table, sub { - my ($face) = @_; - - $self->{exp_table} = $self->{json_coder}->decode (delete $face->{data}); - $_->() for values %{ $self->{on_exp_update} || {} }; - }); - - () - }); - if (my $ts = $cap{tileset}) { if (my ($default) = grep $_->[2] & 1, @$ts) { $self->{tileset} = $default; @@ -195,6 +253,54 @@ ); } +# widgetset create template +sub ext_ws_ct { + my ($self, $ws, $type, $template, $done_cb, $cfg) = @_; + + $done_cb ||= sub { }; + + my $parse_list; $parse_list = sub { + my ($list) = @_; + my @w; + + while (@$list) { + my ($class, $args) = splice @$list, 0, 2; + my $name = delete $args->{s_id}; + my $cl = delete $args->{s_cl}; + my $cfg = delete $cfg->{$name}; + my $id = delete $cfg->{id}; + my $w = eval { "DC::UI::$class"->new (%$args, %{ $cfg || {} }) } + or next; + + $self->widget_associate ($ws, $id, $w) + if $id; + + $w->add ($parse_list->($cl)) + if $cl; + + push @w, $w; + } + + @w + }; + + # either array reference, or face # + if ($type eq "inline") { + $done_cb->(); + $parse_list->($template); + } elsif ($type eq "face") { + my $handler; $handler = $self->register_face_handler ($template, sub { + my ($face) = @_; + + undef $handler; + $done_cb->(); + $parse_list->($self->{json_coder}->decode ($face->{data})); + }); + } else { + $done_cb->(0); + } +} + # widgetset associate sub ext_ws_a { my ($self, %ass) = @_; @@ -205,6 +311,9 @@ tooltip => $DC::UI::TOOLTIP, mapwidget => $::MAPWIDGET, + menubar => $::MENUBAR, + menupopup => $::MENUPOPUP, + pickup_enable => $::PICKUP_ENABLE, buttonbar => $::BUTTONBAR, metaserver => $::METASERVER, buttonbar => $::BUTTONBAR, @@ -230,7 +339,8 @@ floorbox => $::FLOORBOX, help_window => $::HELP_WINDOW, message_window => $::MESSAGE_WINDOW, - statusbox => $::SDTATUSBOX, + message_dist => $::MESSAGE_DIST, + statusbox => $::STATUSBOX, inv => $::INV, invr => $::INVR, @@ -288,7 +398,7 @@ sub ext_channel_info { my ($self, $info) = @_; $self->{channels}->{$info->{id}} = $info; - $::MESSAGE_WINDOW->add_channel ($info); + $::MESSAGE_DIST->add_channel ($info); } ############################################################################# @@ -324,7 +434,7 @@ } sort { $a <=> $b } keys %{$self->{spell_paths}}; - join "", @diff + "\u$name: " . (join ", ", @diff) } # all stats that are chacked against changes @@ -377,7 +487,7 @@ ( ($stats->{+CS_STAT_EXP64} > $prev->{+CS_STAT_EXP64} ? ($stats->{+CS_STAT_EXP64} - $prev->{+CS_STAT_EXP64}) . " experience gained" : ()), map { - $stats->{$_} && $prev->{$_} + $stats->{$_} && $prev->{$_} && $stats->{$_}[1] > $prev->{$_}[1] ? "($self->{skill_info}{$_}+" . ($stats->{$_}[1] - $prev->{$_}[1]) . ")" : () } sort { $a <=> $b } keys %{$self->{skill_info}} ) @@ -389,7 +499,7 @@ if ( my @diffs = map $_->[1]->($self, $_->[2], $prev->{$_->[0]}, $stats->{$_->[0]}), @statchange ) { - my $msg = "stat change: " . (join " ", @diffs); + my $msg = "stat change: " . (join " ", map "($_)", @diffs); $self->{statusbox}->add ($msg, group => "stat $msg", fg => [0.8, 1, 0.2, 1], timeout => 20); } @@ -437,9 +547,9 @@ $::GAUGES->{mana} ->set_value ($sp, $sp_m); $::GAUGES->{food} ->set_value ($fo, $fo_m); $::GAUGES->{grace} ->set_value ($gr, $gr_m); - $::GAUGES->{exp} ->set_text ("Exp: " . (::formsep ($stats->{+CS_STAT_EXP64})) - . " (lvl " . ($stats->{+CS_STAT_LEVEL} * 1) . ")"); - $::GAUGES->{prg} ->set_value ($stats->{+CS_STAT_LEVEL}, $stats->{+CS_STAT_EXP64}); + $::GAUGES->{exp} ->set_label ("Exp: " . (::formsep ($stats->{+CS_STAT_EXP64}))#d# + . " (lvl " . ($stats->{+CS_STAT_LEVEL} * 1) . ")"); + $::GAUGES->{exp} ->set_value ($stats->{+CS_STAT_LEVEL}, $stats->{+CS_STAT_EXP64}); $::GAUGES->{range} ->set_text ($stats->{+CS_STAT_RANGE}); my $title = $stats->{+CS_STAT_TITLE}; $title =~ s/^Player: //; @@ -461,7 +571,7 @@ $self->update_weight; - $::STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$RES_TBL{$_}}) + $::STATWIDS->{"res_$_"}->set_text (sprintf "%d%%", $stats->{$RES_TBL{$_}}) for keys %RES_TBL; my $sktbl = $::STATWIDS->{skill_tbl}; @@ -480,17 +590,17 @@ my $sw = $self->{skillwid}{""} ||= [ 0, 0, (new DC::UI::Label text => "Experience", align => 1), 1, 0, (new DC::UI::Label text => "Lvl.", align => 1), - 2, 0, (new DC::UI::Label text => "Progress", align => 0), - 3, 0, (new DC::UI::Label text => "Skill", expand => 1), + 2, 0, (new DC::UI::Label text => "Progress"), + 3, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), 4, 0, (new DC::UI::Label text => "Experience", align => 1), 5, 0, (new DC::UI::Label text => "Lvl.", align => 1), - 6, 0, (new DC::UI::Label text => "Progress", align => 0), - 7, 0, (new DC::UI::Label text => "Skill", expand => 1), + 6, 0, (new DC::UI::Label text => "Progress"), + 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), ]; my @add = @$sw; - my $TOOLTIP_ALL = "\n\nLeft click - ready skill\nMiddle click - use spell\nRight click - further options"; + my $TOOLTIP_ALL = "\n\nLeft click - ready skill\nMiddle click - use skill\nRight click - further options"; my @TOOLTIP_LVL = (tooltip => "Level. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); my @TOOLTIP_EXP = (tooltip => "Experience. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); @@ -534,7 +644,7 @@ (new DC::UI::ExperienceProgress), # label - (new DC::UI::Label text => $name, on_button_down => $spell_cb, + (new DC::UI::Label text => $name, on_button_down => $spell_cb, align => 0, can_events => 1, can_hover => 1, tooltip => (DC::Pod::section_label skill_description => $name) . $TOOLTIP_ALL), ]; @@ -562,8 +672,8 @@ $sw->[1]->set_text ($val->[0] * 1); $sw->[2]->set_value (@$val); - $::GAUGES->{sklprg}->set_label ("$name %d%%"); - $::GAUGES->{sklprg}->set_value (@$val); + $::GAUGES->{skillexp}->set_label ("$name %d%%"); + $::GAUGES->{skillexp}->set_value (@$val); } } @@ -586,13 +696,13 @@ sub map_scroll { my ($self, $dx, $dy) = @_; - $self->{map}->scroll ($dx, $dy); + $self->{map_widget}->scroll ($dx, $dy); } sub feed_map1a { my ($self, $data) = @_; - my $missing = $self->{map}->map1a_update ($data, $self->{setup}{extmap}); + my $missing = $self->{map}->map1a_update ($data); my $delay; for my $tile (@$missing) { @@ -600,12 +710,12 @@ $delay = 1; - if (my $tex = $::CONN->{texture}[$tile]) { + if (my $tex = $self->{texture}[$tile]) { $tex->upload; } else { $self->{delay}{$tile} = 1; - # we assume the face is in-flight and will eventually come + # we assume the face is in-flight and will eventually arrive push @{$self->{tile_cb}{$tile}}, sub { delete $self->{delay}{$tile}; $_[0]->upload; @@ -614,7 +724,7 @@ } if ($delay) { - # delay the map drawing a tiny bit in the hope of getting the missing fetched + # delay the map drawing a tiny bit in the hope of getting the missing tiles fetched EV::once undef, 0, 0.03, sub { $self->{map_widget}->update if $self->{map_widget}; @@ -633,20 +743,26 @@ sub flush_map { my ($self) = @_; - my $map_info = delete $self->{map_info} - or return; + return unless $self->{map_info}; + + for my $map_info (values %{ $self->{map_cache} || {} }) { + my ($hash, $rdata, $x, $y, $w, $h) = @$map_info; - my ($hash, $x, $y, $w, $h) = @$map_info; + my $data = $self->{map}->get_rect ($x, $y, $w, $h); - my $data = Compress::LZF::compress $self->{map}->get_rect ($x, $y, $w, $h); - $self->{map_cache_new}{$hash} = \$data; - DC::DB::put $self->{mapcache} => $hash => $data, sub { }; + if ($data ne $$rdata) { + $map_info->[1] = \$data; + my $cdata = Compress::LZF::compress $data; + DC::DB::put $self->{mapcache} => $hash => $cdata, sub { }; + } + } } sub map_clear { my ($self) = @_; $self->flush_map; + delete $self->{map_info}; delete $self->{neigh_map}; $self->{map}->clear; @@ -677,36 +793,34 @@ }; } -sub load_map($$$) { - my ($self, $hash, $x, $y) = @_; +sub load_map($$$$$$) { + my ($self, $hash, $x, $y, $w, $h) = @_; - my $gen = $self->{map_change_gen}; + my $map_info = $self->{map_cache}{$hash} = [$hash, \"", $x, $y, $w, $h]; my $cb = sub { - return unless $gen == $self->{map_change_gen}; - - my ($data) = @_; - - if (defined $data) { - $self->{map_cache_new}{$hash} = \$data; - - my $data = Compress::LZF::decompress $data; + $map_info->[1] = \$_[0]; - my $inprogress = @{ $self->{bg_fetch} || [] }; - unshift @{ $self->{bg_fetch} }, $self->{map}->set_rect ($x, $y, $data); - $self->bg_fetch unless $inprogress; - } + my $inprogress = @{ $self->{bg_fetch} || [] }; + unshift @{ $self->{bg_fetch} }, $self->{map}->set_rect ($x, $y, $_[0]); + $self->bg_fetch unless $inprogress; }; - if (my $rdata = $self->{map_cache_old}{$hash}) { - $cb->($$rdata); + if (my $map_info = $self->{map_cache_old}{$hash}) { + $cb->(${ $map_info->[1] }); } else { - DC::DB::get $self->{mapcache} => $hash, $cb; + my $gen = $self->{map_change_gen}; + + DC::DB::get $self->{mapcache} => $hash, sub { + return unless $gen == $self->{map_change_gen}; + return unless defined $_[0]; + $cb->(Compress::LZF::decompress $_[0]); + }; } } # hardcode /world/world_xxx_xxx map names, the savings are enourmous, -# (server resource,s latency, bandwidth), so this hack is warranted. +# (server resources, latency, bandwidth), so this hack is warranted. # the right fix is to make real tiled maps with an overview file sub send_mapinfo { my ($self, $data, $cb) = @_; @@ -741,7 +855,7 @@ # this method does a "flood fill" into every tile direction # it assumes that tiles are arranged in a rectangular grid, # i.e. a map is the same as the left of the right map etc. -# failure to comply are harmless and result in display errors +# failure to comply is harmless and results in display errors # at worst. sub flood_fill { my ($self, $block, $gx, $gy, $path, $hash, $flags) = @_; @@ -787,7 +901,7 @@ $x += $self->{map}->ox; $y += $self->{map}->oy; - $self->load_map ($hash, $x, $y) + $self->load_map ($hash, $x, $y, $w, $h) unless $self->{neigh_map}{$hash}[5]++;#d# $neigh->[$tile] = [$flags, $x, $y, $w, $h, $hash]; @@ -805,7 +919,7 @@ $self->flush_map; ++$self->{map_change_gen}; - $self->{map_cache_old} = delete $self->{map_cache_new}; + $self->{map_cache_old} = delete $self->{map_cache}; my ($ox, $oy) = ($::MAP->ox, $::MAP->oy); @@ -827,7 +941,7 @@ (my $map = $hash) =~ s/^.*?\/([^\/]+)$/\1/; $::STATWIDS->{map}->set_text ("Map: " . $map); - $self->load_map ($hash, $x, $y); + $self->load_map ($hash, $x, $y, $w, $h); $self->flood_fill (0, 0, 0, "", $hash, $flags); } @@ -908,7 +1022,7 @@ new DC::Texture tile => $tile, image => $data, delete_image => 1, - minify => 1, mipmap => 1; + minify => 1; if (my $cbs = delete $self->{tile_cb}{$tile}) { $_->($tex) for @$cbs; @@ -923,7 +1037,7 @@ push @{$self->{face_cb}{$num}}, $cb; defined wantarray - ? DC::guard { + ? Guard::guard { @{$self->{face_cb}{$num}} = grep $_ != $cb, @{$self->{face_cb}{$num}}; @@ -961,7 +1075,7 @@ $prompt = $LAST_QUERY unless length $prompt; $LAST_QUERY = $prompt; - $self->{query}-> ($self, $flags, $prompt); + $self->{query}->($self, $flags, $prompt); } sub sanitise_xml($) { @@ -980,6 +1094,8 @@ s/(.*?)<\/fg>/$2<\/span>/gs; s/(.*?)<\/fg>/$2<\/span>/gs; + s/\s+$//; + $_ } @@ -1031,25 +1147,19 @@ my $fg = $CF_COLOR[$color & NDI_COLOR_MASK] || [1, 0, 0]; - ## try to create single paragraphs of multiple lines sent by the server - # no longer neecssary with TRT servers - #$text =~ s/(?<=\S)\n(?=\w)/ /g; - - for (split /\n/, $text) { - ::message ({ - fg => $fg, - markup => $_, - type => $type, - extra => [@extra], - color_flags => $color, #d# ugly, kill - }); + ::message ({ + fg => $fg, + markup => $text, + type => $type, + extra => [@extra], + color_flags => $color, #d# ugly, kill + }); - $color &= ~NDI_CLEAR; # only clear once for multiline messages - # actually, this is an ugly design. _we_ should control the channels, - # not some random other widget, as the channels are clearly protocol-specific. - # then we could also react to flags such as CLEAR without resorting to - # hacks such as color_flags, above. - } +# $color &= ~NDI_CLEAR; # only clear once for multiline messages +# # actually, this is an ugly design. _we_ should control the channels, +# # not some random other widget, as the channels are clearly protocol-specific. +# # then we could also react to flags such as CLEAR without resorting to +# # hacks such as color_flags, above. $self->{statusbox}->add ($text, group => $text, @@ -1094,7 +1204,7 @@ for my $node (DC::Pod::find skill_description => "*") { my (undef, @par) = DC::Pod::section_of $node; - $skill_help{$node->{kw}[0]} = DC::Pod::as_label @par; + $skill_help{$node->[DC::Pod::N_KW][0]} = DC::Pod::as_label @par; }; for my $skill (values %{$self->{skill_info}}) { @@ -1124,7 +1234,8 @@ my @add; my $row; - for (sort { $a->{count} <=> $b->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) { + for (sort { $b->{count} <=> $a->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) { + next if $_->{tag} & 0x80000000; if ($row < 6) { local $_->{face_widget}; # hack to force recreation of widget local $_->{desc_widget}; # hack to force recreation of widget @@ -1161,8 +1272,8 @@ $conn->{open_container} = $tag; update_floorbox; - $::INVR_HB->clear (); - $::INVR_HB->add (new DC::UI::Label align => 0, expand => 1, text => $name); + $::INVR_HB->clear; + $::INVR_HB->add (new DC::UI::Label expand => 1, text => $name); if ($tag != 0) { # Floor isn't closable, is it? $::INVR_HB->add (new DC::UI::Button @@ -1227,10 +1338,10 @@ sub item_update { my ($self, $item) = @_; - #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($::CONN->{open_container})\n"; + #print "item_update: $item->{tag} in $item->{container} pt($self->{player}{tag}) oc($::CONN->{open_container}) f($item->{flags})\n"; DC::Item::update_widgets $item; - + if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { set_opencont ($::CONN, 0, "Floor"); @@ -1256,7 +1367,7 @@ my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM}; $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight); - $::STATWIDS->{m_weight}->set_text (sprintf "%.1fkg", $limit); + $::STATWIDS->{m_weight}->set_text (sprintf "Max Weight: %.1fkg", $limit); $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit); } @@ -1265,16 +1376,13 @@ my @yesno = ("no", "yes"); + my $version = JSON::XS->new->encode ($self->{s_version}); + $::SERVER_INFO->set_markup ( "server $self->{host}:$self->{port}\n" - . "protocol version $self->{version}\n" - . "minimap support $yesno[$self->{setup}{mapinfocmd} > 0]\n" - . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n" - . "examine command support $yesno[$self->{setup}{excmd} > 0]\n" + . "protocol version $version\n" . "editing support $yesno[!!$self->{editor_support}]\n" - . "map attributes $yesno[$self->{setup}{extmap} > 0]\n" - . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n" - . "cfplus support $yesno[$self->{cfplus_ext} > 0]" + . "client support $yesno[$self->{cfplus_ext} > 0]" . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" . "map size $self->{mapw}×$self->{maph}\n" ); @@ -1305,7 +1413,7 @@ $self->update_server_info; $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; - $self->send_command ("pickup $::CFG->{pickup}"); + $self->send_pickup ($::CFG->{pickup}); } sub lookat { @@ -1317,7 +1425,7 @@ if (exists $msg{npc_dialog}) { # start npc chat dialog - $self->{npc_dialog} = new DC::NPCDialog:: + $self->{w}{npc_dialog} = new DC::NPCDialog:: token => $msg{npc_dialog}, title => "$msg{npc_dialog}[0] (NPC)", conn => $self, @@ -1332,8 +1440,8 @@ sub destroy { my ($self) = @_; - (delete $self->{npc_dialog})->destroy - if $self->{npc_dialog}; + $_->destroy + for values %{ $self->{w} }; $self->SUPER::destroy; @@ -1479,7 +1587,12 @@ sub send { my ($self, $msg) = @_; - $self->{textview}->add_paragraph ({ markup => "\n" . DC::asxml $msg }); + $self->{textview}->add_paragraph ({ + markup => + "\n" + . (DC::asxml $msg) + . "" + }); $self->{textview}->scroll_to_bottom; $self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg); @@ -1492,7 +1605,7 @@ if ($self->{conn}) { $self->{conn}->send_ext_msg (npc_dialog_end => $self->{id}) if $self->{id}; - delete $self->{conn}{npc_dialog}; + delete $self->{conn}{w}{npc_dialog}; $self->{conn}->disconnect_ext ($self->{id}); }