ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.205 by root, Wed Nov 26 23:08:34 2008 UTC vs.
Revision 1.224 by root, Wed Nov 7 00:25:46 2012 UTC

1package DC::Protocol; 1package DC::Protocol;
2 2
3use utf8; 3use common::sense;
4use strict; 4
5use Guard ();
5 6
6use Deliantra::Protocol::Constants; 7use Deliantra::Protocol::Constants;
7 8
8use DC; 9use DC;
9use DC::DB; 10use DC::DB;
13use DC::Item; 14use DC::Item;
14 15
15use base 'Deliantra::Protocol::Base'; 16use base 'Deliantra::Protocol::Base';
16 17
17our $TEX_DIALOGUE = new_from_resource DC::Texture 18our $TEX_DIALOGUE = new_from_resource DC::Texture
18 "dialogue.png", minify => 1, mipmap => 1; 19 "dialogue.png", minify => 1, mipmap => 1;
19 20
20our $TEX_NOFACE = new_from_resource DC::Texture 21our $TEX_NOFACE = new_from_resource DC::Texture
21 "noface.png", minify => 1, mipmap => 1; 22 "noface.png", minify => 1, mipmap => 1, wrap => 1;
22 23
23sub MIN_TEXTURE_UNUSED() { 1 }#d# 24sub MIN_TEXTURE_UNUSED() { 1 }#d#
24 25
25sub new { 26sub new {
26 my ($class, %arg) = @_; 27 my ($class, %arg) = @_;
27 28
28 my $self = $class->SUPER::new (%arg, 29 my $self = $class->SUPER::new (%arg,
29 setup_req => { 30 setup_req => {
30 extmap => 1, 31 extmap => 1,
31 excmd => 1,
32 widget => 2, 32 widget => 2,
33 %{$arg{setup_req} || {}}, 33 %{$arg{setup_req} || {}},
34 }, 34 },
35 ); 35 );
36
37 $self->update_fx_want;
38
39 my $exp_guard = $self->addme_guard;
40 my $skl_guard = $self->addme_guard;
41 my $spl_guard = $self->addme_guard;
42 $self->send_exti_req (resource => qw(exp_table skill_info spell_paths), sub {
43 my ($exp, $skl, $spl) = @_;
44
45 $self->register_face_handler ($exp, sub {
46 my ($face) = @_;
47
48 undef $exp_guard;
49 $self->{exp_table} = $self->{json_coder}->decode (delete $face->{data});
50 $_->() for values %{ $self->{on_exp_update} };
51 });
52
53 $self->register_face_handler ($skl, sub {
54 my ($face) = @_;
55
56 undef $skl_guard;
57 my $info = $self->{json_coder}->decode (delete $face->{data});
58 $self->{skill_info} = { map { CS_STAT_SKILLINFO + $_ => $info->[$_][0] } 0 .. $#$info };
59 });
60
61 $self->register_face_handler ($spl, sub {
62 my ($face) = @_;
63
64 undef $spl_guard;
65 my $info = $self->{json_coder}->decode (delete $face->{data});
66 $self->{spell_paths} = { map { (1 << $_) => $info->[$_][0] } 0 .. $#$info };
67 });
68
69 ()
70 });
36 71
37 $self->{map_widget}->clr_commands; 72 $self->{map_widget}->clr_commands;
38 73
39 my @cmd_help = map { 74 my @cmd_help = map {
40 $_->[DC::Pod::N_KW][0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x 75 $_->[DC::Pod::N_KW][0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x
94 $self->{noface} = my $tex = $TEX_NOFACE; 129 $self->{noface} = my $tex = $TEX_NOFACE;
95 $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); 130 $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}});
96 } 131 }
97 132
98# $self->{expire_count} = DC::DB::FIRST_TILE_ID; # minimum non-fixed tile id 133# $self->{expire_count} = DC::DB::FIRST_TILE_ID; # minimum non-fixed tile id
99# $self->{expire_w} = EV::timer 1, 1, sub { 134# $self->{expire_w} = AE::timer 1, 1, sub {
100# my $count = (int @{ $self->{texture} } / MIN_TEXTURE_UNUSED) || 1; 135# my $count = (int @{ $self->{texture} } / MIN_TEXTURE_UNUSED) || 1;
101# 136#
102# for ($self->{map}->expire_textures ($self->{expire_count}, $count)) { 137# for ($self->{map}->expire_textures ($self->{expire_count}, $count)) {
103# warn DC::SvREFCNT $self->{texture}[$_]; 138# warn DC::SvREFCNT $self->{texture}[$_];
104# $self->{texture}[$_]->unload; 139# $self->{texture}[$_]->unload;
129} 164}
130 165
131sub ext_capabilities { 166sub ext_capabilities {
132 my ($self, %cap) = @_; 167 my ($self, %cap) = @_;
133 168
134 $self->update_fx_want;
135
136 $self->send_exti_req (resource => "exp_table", sub {
137 my ($exp_table) = @_;
138
139 $self->register_face_handler ($exp_table, sub {
140 my ($face) = @_;
141
142 $self->{exp_table} = $self->{json_coder}->decode (delete $face->{data});
143 $_->() for values %{ $self->{on_exp_update} || {} };
144 });
145
146 ()
147 });
148
149 if (my $ts = $cap{tileset}) { 169 if (my $ts = $cap{tileset}) {
150 if (my ($default) = grep $_->[2] & 1, @$ts) { 170 if (my ($default) = grep $_->[2] & 1, @$ts) {
151 $self->{tileset} = $default; 171 $self->{tileset} = $default;
152 $self->{tilesize} = $default->[3]; 172 $self->{tilesize} = $default->[3];
153 $self->setup_req (tileset => $default->[0]); 173 $self->setup_req (tileset => $default->[0]);
277 my %wkw = ( 297 my %wkw = (
278 root => $DC::UI::ROOT, 298 root => $DC::UI::ROOT,
279 tooltip => $DC::UI::TOOLTIP, 299 tooltip => $DC::UI::TOOLTIP,
280 300
281 mapwidget => $::MAPWIDGET, 301 mapwidget => $::MAPWIDGET,
302 menubar => $::MENUBAR,
303 menupopup => $::MENUPOPUP,
304 pickup_enable => $::PICKUP_ENABLE,
282 buttonbar => $::BUTTONBAR, 305 buttonbar => $::BUTTONBAR,
283 metaserver => $::METASERVER, 306 metaserver => $::METASERVER,
284 buttonbar => $::BUTTONBAR, 307 buttonbar => $::BUTTONBAR,
285 login_button => $::LOGIN_BUTTON, 308 login_button => $::LOGIN_BUTTON,
286 quit_dialog => $::QUIT_DIALOG, 309 quit_dialog => $::QUIT_DIALOG,
303 326
304 floorbox => $::FLOORBOX, 327 floorbox => $::FLOORBOX,
305 help_window => $::HELP_WINDOW, 328 help_window => $::HELP_WINDOW,
306 message_window => $::MESSAGE_WINDOW, 329 message_window => $::MESSAGE_WINDOW,
307 message_dist => $::MESSAGE_DIST, 330 message_dist => $::MESSAGE_DIST,
308 statusbox => $::SDTATUSBOX, 331 statusbox => $::STATUSBOX,
309 332
310 inv => $::INV, 333 inv => $::INV,
311 invr => $::INVR, 334 invr => $::INVR,
312 invr_hb => $::INVR_HB, 335 invr_hb => $::INVR_HB,
313 ); 336 );
397 ? (($new & $_ ? "+" : "-") . $self->{spell_paths}{$_}) 420 ? (($new & $_ ? "+" : "-") . $self->{spell_paths}{$_})
398 : () 421 : ()
399 } 422 }
400 sort { $a <=> $b } keys %{$self->{spell_paths}}; 423 sort { $a <=> $b } keys %{$self->{spell_paths}};
401 424
402 join "", @diff 425 "\u$name: " . (join ", ", @diff)
403} 426}
404 427
405# all stats that are chacked against changes 428# all stats that are chacked against changes
406my @statchange = ( 429my @statchange = (
407 [&CS_STAT_STR => \&_stat_numdiff, "Str"], 430 [&CS_STAT_STR => \&_stat_numdiff, "Str"],
450 473
451 if (my @diffs = 474 if (my @diffs =
452 ( 475 (
453 ($stats->{+CS_STAT_EXP64} > $prev->{+CS_STAT_EXP64} ? ($stats->{+CS_STAT_EXP64} - $prev->{+CS_STAT_EXP64}) . " experience gained" : ()), 476 ($stats->{+CS_STAT_EXP64} > $prev->{+CS_STAT_EXP64} ? ($stats->{+CS_STAT_EXP64} - $prev->{+CS_STAT_EXP64}) . " experience gained" : ()),
454 map { 477 map {
455 $stats->{$_} && $prev->{$_} 478 $stats->{$_} && $prev->{$_}
456 && $stats->{$_}[1] > $prev->{$_}[1] ? "($self->{skill_info}{$_}+" . ($stats->{$_}[1] - $prev->{$_}[1]) . ")" : () 479 && $stats->{$_}[1] > $prev->{$_}[1] ? "($self->{skill_info}{$_}+" . ($stats->{$_}[1] - $prev->{$_}[1]) . ")" : ()
457 } sort { $a <=> $b } keys %{$self->{skill_info}} 480 } sort { $a <=> $b } keys %{$self->{skill_info}}
458 ) 481 )
459 ) { 482 ) {
460 my $msg = join " ", @diffs; 483 my $msg = join " ", @diffs;
462 } 485 }
463 486
464 if ( 487 if (
465 my @diffs = map $_->[1]->($self, $_->[2], $prev->{$_->[0]}, $stats->{$_->[0]}), @statchange 488 my @diffs = map $_->[1]->($self, $_->[2], $prev->{$_->[0]}, $stats->{$_->[0]}), @statchange
466 ) { 489 ) {
467 my $msg = "<b>stat change</b>: " . (join " ", @diffs); 490 my $msg = "<b>stat change</b>: " . (join " ", map "($_)", @diffs);
468 $self->{statusbox}->add ($msg, group => "stat $msg", fg => [0.8, 1, 0.2, 1], timeout => 20); 491 $self->{statusbox}->add ($msg, group => "stat $msg", fg => [0.8, 1, 0.2, 1], timeout => 20);
469 } 492 }
470 493
471 $self->update_stats_window ($stats, $prev); 494 $self->update_stats_window ($stats, $prev);
472 495
510 533
511 $::GAUGES->{hp} ->set_value ($hp, $hp_m); 534 $::GAUGES->{hp} ->set_value ($hp, $hp_m);
512 $::GAUGES->{mana} ->set_value ($sp, $sp_m); 535 $::GAUGES->{mana} ->set_value ($sp, $sp_m);
513 $::GAUGES->{food} ->set_value ($fo, $fo_m); 536 $::GAUGES->{food} ->set_value ($fo, $fo_m);
514 $::GAUGES->{grace} ->set_value ($gr, $gr_m); 537 $::GAUGES->{grace} ->set_value ($gr, $gr_m);
515 $::GAUGES->{exp} ->set_text ("Exp: " . (::formsep ($stats->{+CS_STAT_EXP64})) 538 $::GAUGES->{exp} ->set_label ("Exp: " . (::formsep ($stats->{+CS_STAT_EXP64}))#d#
516 . " (lvl " . ($stats->{+CS_STAT_LEVEL} * 1) . ")"); 539 . " (lvl " . ($stats->{+CS_STAT_LEVEL} * 1) . ")");
517 $::GAUGES->{prg} ->set_value ($stats->{+CS_STAT_LEVEL}, $stats->{+CS_STAT_EXP64}); 540 $::GAUGES->{exp} ->set_value ($stats->{+CS_STAT_LEVEL}, $stats->{+CS_STAT_EXP64});
518 $::GAUGES->{range} ->set_text ($stats->{+CS_STAT_RANGE}); 541 $::GAUGES->{range} ->set_text ($stats->{+CS_STAT_RANGE});
519 my $title = $stats->{+CS_STAT_TITLE}; 542 my $title = $stats->{+CS_STAT_TITLE};
520 $title =~ s/^Player: //; 543 $title =~ s/^Player: //;
521 $::STATWIDS->{title} ->set_text ("Title: " . $title); 544 $::STATWIDS->{title} ->set_text ("Title: " . $title);
522 545
534 $::STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); 557 $::STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED});
535 $::STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); 558 $::STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP});
536 559
537 $self->update_weight; 560 $self->update_weight;
538 561
539 $::STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$RES_TBL{$_}}) 562 $::STATWIDS->{"res_$_"}->set_text (sprintf "%d%%", $stats->{$RES_TBL{$_}})
540 for keys %RES_TBL; 563 for keys %RES_TBL;
541 564
542 my $sktbl = $::STATWIDS->{skill_tbl}; 565 my $sktbl = $::STATWIDS->{skill_tbl};
543 my @skills = keys %{ $self->{skill_info} }; 566 my @skills = keys %{ $self->{skill_info} };
544 567
563 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), 586 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0),
564 ]; 587 ];
565 588
566 my @add = @$sw; 589 my @add = @$sw;
567 590
568 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; 591 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use skill\nRight click - further options</small>";
569 592
570 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); 593 my @TOOLTIP_LVL = (tooltip => "<b>Level</b>. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
571 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1); 594 my @TOOLTIP_EXP = (tooltip => "<b>Experience</b>. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
572 595
573 my ($x, $y) = (0, 1); 596 my ($x, $y) = (0, 1);
635 my $sw = $self->{skillwid}{$idx}; 658 my $sw = $self->{skillwid}{$idx};
636 $sw->[0]->set_text (::formsep ($val->[1])); 659 $sw->[0]->set_text (::formsep ($val->[1]));
637 $sw->[1]->set_text ($val->[0] * 1); 660 $sw->[1]->set_text ($val->[0] * 1);
638 $sw->[2]->set_value (@$val); 661 $sw->[2]->set_value (@$val);
639 662
640 $::GAUGES->{sklprg}->set_label ("$name %d%%"); 663 $::GAUGES->{skillexp}->set_label ("$name %d%%");
641 $::GAUGES->{sklprg}->set_value (@$val); 664 $::GAUGES->{skillexp}->set_value (@$val);
642 } 665 }
643} 666}
644 667
645sub user_send { 668sub user_send {
646 my ($self, $command) = @_; 669 my ($self, $command) = @_;
665} 688}
666 689
667sub feed_map1a { 690sub feed_map1a {
668 my ($self, $data) = @_; 691 my ($self, $data) = @_;
669 692
670 my $missing = $self->{map}->map1a_update ($data, $self->{setup}{extmap}); 693 my $missing = $self->{map}->map1a_update ($data);
671 my $delay; 694 my $delay;
672 695
673 for my $tile (@$missing) { 696 for my $tile (@$missing) {
674 next if $self->{delay}{$tile}; 697 next if $self->{delay}{$tile};
675 698
985 1008
986 my $tex = $self->{texture}[$tile] ||= 1009 my $tex = $self->{texture}[$tile] ||=
987 new DC::Texture 1010 new DC::Texture
988 tile => $tile, 1011 tile => $tile,
989 image => $data, delete_image => 1, 1012 image => $data, delete_image => 1,
990 minify => 1, mipmap => 1; 1013 minify => 1;
991 1014
992 if (my $cbs = delete $self->{tile_cb}{$tile}) { 1015 if (my $cbs = delete $self->{tile_cb}{$tile}) {
993 $_->($tex) for @$cbs; 1016 $_->($tex) for @$cbs;
994 } 1017 }
995} 1018}
1000 my ($self, $num, $cb) = @_; 1023 my ($self, $num, $cb) = @_;
1001 1024
1002 push @{$self->{face_cb}{$num}}, $cb; 1025 push @{$self->{face_cb}{$num}}, $cb;
1003 1026
1004 defined wantarray 1027 defined wantarray
1005 ? DC::guard { 1028 ? Guard::guard {
1006 @{$self->{face_cb}{$num}} 1029 @{$self->{face_cb}{$num}}
1007 = grep $_ != $cb, 1030 = grep $_ != $cb,
1008 @{$self->{face_cb}{$num}}; 1031 @{$self->{face_cb}{$num}};
1009 } 1032 }
1010 : () 1033 : ()
1038 my ($self, $flags, $prompt) = @_; 1061 my ($self, $flags, $prompt) = @_;
1039 1062
1040 $prompt = $LAST_QUERY unless length $prompt; 1063 $prompt = $LAST_QUERY unless length $prompt;
1041 $LAST_QUERY = $prompt; 1064 $LAST_QUERY = $prompt;
1042 1065
1043 $self->{query}-> ($self, $flags, $prompt); 1066 $self->{query}->($self, $flags, $prompt);
1044} 1067}
1045 1068
1046sub sanitise_xml($) { 1069sub sanitise_xml($) {
1047 local $_ = shift; 1070 local $_ = shift;
1048 1071
1080 tan => 12, 1103 tan => 12,
1081); 1104);
1082 1105
1083our @CF_COLOR = ( 1106our @CF_COLOR = (
1084 [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00], 1107 [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00],
1085 [1.00, 1.00, 1.00], 1108 [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00],
1086 [0.50, 0.50, 1.00], #[0.00, 0.00, 0.55] 1109 [0.50, 0.50, 1.00], #[0.00, 0.00, 0.55],
1087 [1.00, 0.00, 0.00], 1110 [1.00, 0.00, 0.00],
1088 [1.00, 0.54, 0.00], 1111 [1.00, 0.54, 0.00],
1089 [0.11, 0.56, 1.00], 1112 [0.11, 0.56, 1.00],
1090 [0.93, 0.46, 0.00], 1113 [0.93, 0.46, 0.00],
1091 [0.18, 0.54, 0.34], 1114 [0.18, 0.54, 0.34],
1109 } else { 1132 } else {
1110 $self->logprint ("msg: ", $text); 1133 $self->logprint ("msg: ", $text);
1111 return if $color < 0; # negative color == ignore if not understood 1134 return if $color < 0; # negative color == ignore if not understood
1112 1135
1113 my $fg = $CF_COLOR[$color & NDI_COLOR_MASK] || [1, 0, 0]; 1136 my $fg = $CF_COLOR[$color & NDI_COLOR_MASK] || [1, 0, 0];
1114
1115 ## try to create single paragraphs of multiple lines sent by the server
1116 # no longer neecssary with TRT servers
1117 #$text =~ s/(?<=\S)\n(?=\w)/ /g;
1118 1137
1119 ::message ({ 1138 ::message ({
1120 fg => $fg, 1139 fg => $fg,
1121 markup => $text, 1140 markup => $text,
1122 type => $type, 1141 type => $type,
1343sub update_server_info { 1362sub update_server_info {
1344 my ($self) = @_; 1363 my ($self) = @_;
1345 1364
1346 my @yesno = ("<span foreground='red'>no</span>", "<span foreground='green'>yes</span>"); 1365 my @yesno = ("<span foreground='red'>no</span>", "<span foreground='green'>yes</span>");
1347 1366
1367 my $version = JSON::XS->new->encode ($self->{s_version});
1368
1348 $::SERVER_INFO->set_markup ( 1369 $::SERVER_INFO->set_markup (
1349 "server <tt>$self->{host}:$self->{port}</tt>\n" 1370 "server <tt>$self->{host}:$self->{port}</tt>\n"
1350 . "protocol version <tt>$self->{version}</tt>\n" 1371 . "protocol version <tt>$version</tt>\n"
1351 . "minimap support $yesno[$self->{setup}{mapinfocmd} > 0]\n"
1352 . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n"
1353 . "examine command support $yesno[$self->{setup}{excmd} > 0]\n"
1354 . "editing support $yesno[!!$self->{editor_support}]\n" 1372 . "editing support $yesno[!!$self->{editor_support}]\n"
1355 . "map attributes $yesno[$self->{setup}{extmap} > 0]\n"
1356 . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n"
1357 . "client support $yesno[$self->{cfplus_ext} > 0]" 1373 . "client support $yesno[$self->{cfplus_ext} > 0]"
1358 . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" 1374 . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n"
1359 . "map size $self->{mapw}×$self->{maph}\n" 1375 . "map size $self->{mapw}×$self->{maph}\n"
1360 ); 1376 );
1361 1377
1383 }); 1399 });
1384 1400
1385 $self->update_server_info; 1401 $self->update_server_info;
1386 1402
1387 $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; 1403 $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0;
1388 $self->send_command ("pickup $::CFG->{pickup}"); 1404 $self->send_pickup ($::CFG->{pickup});
1389
1390 $self->send_exti_msg (clientlog => sprintf "OpenGL Info: %s [%s]",
1391 DC::OpenGL::gl_vendor, DC::OpenGL::gl_version);#d#
1392} 1405}
1393 1406
1394sub lookat { 1407sub lookat {
1395 my ($self, $x, $y) = @_; 1408 my ($self, $x, $y) = @_;
1396 1409
1398 $self->send_ext_req (lookat => $x, $y, sub { 1411 $self->send_ext_req (lookat => $x, $y, sub {
1399 my (%msg) = @_; 1412 my (%msg) = @_;
1400 1413
1401 if (exists $msg{npc_dialog}) { 1414 if (exists $msg{npc_dialog}) {
1402 # start npc chat dialog 1415 # start npc chat dialog
1403 $self->{npc_dialog} = new DC::NPCDialog:: 1416 $self->{w}{npc_dialog} = new DC::NPCDialog::
1404 token => $msg{npc_dialog}, 1417 token => $msg{npc_dialog},
1405 title => "$msg{npc_dialog}[0] (NPC)", 1418 title => "$msg{npc_dialog}[0] (NPC)",
1406 conn => $self, 1419 conn => $self,
1407 ; 1420 ;
1408 } 1421 }
1413} 1426}
1414 1427
1415sub destroy { 1428sub destroy {
1416 my ($self) = @_; 1429 my ($self) = @_;
1417 1430
1418 (delete $self->{npc_dialog})->destroy 1431 $_->destroy
1419 if $self->{npc_dialog}; 1432 for values %{ $self->{w} };
1420 1433
1421 $self->SUPER::destroy; 1434 $self->SUPER::destroy;
1422 1435
1423 %$self = (); 1436 %$self = ();
1424} 1437}
1578 1591
1579 #Carp::cluck "debug\n";#d# #todo# enable: destroy gets called twice because scalar keys {} is 1 1592 #Carp::cluck "debug\n";#d# #todo# enable: destroy gets called twice because scalar keys {} is 1
1580 1593
1581 if ($self->{conn}) { 1594 if ($self->{conn}) {
1582 $self->{conn}->send_ext_msg (npc_dialog_end => $self->{id}) if $self->{id}; 1595 $self->{conn}->send_ext_msg (npc_dialog_end => $self->{id}) if $self->{id};
1583 delete $self->{conn}{npc_dialog}; 1596 delete $self->{conn}{w}{npc_dialog};
1584 $self->{conn}->disconnect_ext ($self->{id}); 1597 $self->{conn}->disconnect_ext ($self->{id});
1585 } 1598 }
1586 1599
1587 $self->SUPER::destroy; 1600 $self->SUPER::destroy;
1588} 1601}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines