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.216 by root, Sat Apr 3 03:02:28 2010 UTC vs.
Revision 1.228 by root, Wed Nov 21 13:23:10 2012 UTC

7use Deliantra::Protocol::Constants; 7use Deliantra::Protocol::Constants;
8 8
9use DC; 9use DC;
10use DC::DB; 10use DC::DB;
11use DC::UI; 11use DC::UI;
12use DC::Pod;
13use DC::Macro; 12use DC::Macro;
14use DC::Item; 13use DC::Item;
15 14
16use base 'Deliantra::Protocol::Base'; 15use base 'Deliantra::Protocol::Base';
17 16
18our $TEX_DIALOGUE = new_from_resource DC::Texture 17our $TEX_DIALOGUE = new_from_resource DC::Texture
19 "dialogue.png", minify => 1, mipmap => 1; 18 "dialogue.png", minify => 1, mipmap => 1;
20 19
21our $TEX_NOFACE = new_from_resource DC::Texture 20our $TEX_NOFACE = new_from_resource DC::Texture
22 "noface.png", minify => 1, mipmap => 1, wrap => 1; 21 "noface.png", minify => 1, mipmap => 1, wrap => 1;
23 22
24sub MIN_TEXTURE_UNUSED() { 1 }#d# 23sub MIN_TEXTURE_UNUSED() { 1 }#d#
27 my ($class, %arg) = @_; 26 my ($class, %arg) = @_;
28 27
29 my $self = $class->SUPER::new (%arg, 28 my $self = $class->SUPER::new (%arg,
30 setup_req => { 29 setup_req => {
31 extmap => 1, 30 extmap => 1,
32 excmd => 1,
33 widget => 2, 31 widget => 2,
34 %{$arg{setup_req} || {}}, 32 %{$arg{setup_req} || {}},
35 }, 33 },
36 ); 34 );
37 35
38 $self->{map_widget}->clr_commands; 36 $self->update_fx_want;
39 37
40 my @cmd_help = map { 38 my $exp_guard = $self->addme_guard;
41 $_->[DC::Pod::N_KW][0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x 39 my $skl_guard = $self->addme_guard;
42 or die "unparseable command help: $_->[DC::Pod::N_KW][0]"; 40 my $spl_guard = $self->addme_guard;
41 $self->send_exti_req (resource => qw(exp_table skill_info spell_paths), sub {
42 my ($exp, $skl, $spl) = @_;
43 43
44 my $cmd = $1; 44 $self->register_face_handler ($exp, sub {
45 my @args = split /\|/, $2; 45 my ($face) = @_;
46 @args = (".*") unless @args;
47 46
48 my (undef, @par) = DC::Pod::section_of $_; 47 undef $exp_guard;
49 my $text = DC::Pod::as_label @par; 48 $self->{exp_table} = $self->{json_coder}->decode (delete $face->{data});
49 $_->() for values %{ $self->{on_exp_update} };
50 });
50 51
51 $_ = $_ eq ".*" ? "" : " $_" 52 $self->register_face_handler ($skl, sub {
52 for @args; 53 my ($face) = @_;
53 54
54 map ["$cmd$_", $text], 55 undef $skl_guard;
55 sort { (length $a) <=> (length $b) } 56 my $info = $self->{json_coder}->decode (delete $face->{data});
56 @args 57 $self->{skill_info} = { map { CS_STAT_SKILLINFO + $_ => $info->[$_][0] } 0 .. $#$info };
57 } sort { $a->[DC::Pod::N_PAR] <=> $b->[DC::Pod::N_PAR] } 58 });
58 DC::Pod::find command => "*"; 59
60 $self->register_face_handler ($spl, sub {
61 my ($face) = @_;
62
63 undef $spl_guard;
64 my $info = $self->{json_coder}->decode (delete $face->{data});
65 $self->{spell_paths} = { map { (1 << $_) => $info->[$_][0] } 0 .. $#$info };
66 });
67
68 ()
69 });
70
71 $::COMPLETER->reset;
59 72
60 $self->{json_coder} 73 $self->{json_coder}
61 ->convert_blessed 74 ->convert_blessed
62 ->filter_json_single_key_object ("\fw" => sub { 75 ->filter_json_single_key_object ("\fw" => sub {
63 $self->{widget}{$_[0]} 76 $self->{widget}{$_[0]}
81 $::INVR->clear; 94 $::INVR->clear;
82 $::INVR_HB->clear; 95 $::INVR_HB->clear;
83 $::FLOORBOX->clear; 96 $::FLOORBOX->clear;
84 }); 97 });
85 98
86 $self->{map_widget}->add_command (@$_)
87 for @cmd_help;
88
89 { 99 {
90 $self->{dialogue} = my $tex = $TEX_DIALOGUE; 100 $self->{dialogue} = my $tex = $TEX_DIALOGUE;
91 $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}}); 101 $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}});
92 } 102 }
93 103
95 $self->{noface} = my $tex = $TEX_NOFACE; 105 $self->{noface} = my $tex = $TEX_NOFACE;
96 $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); 106 $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}});
97 } 107 }
98 108
99# $self->{expire_count} = DC::DB::FIRST_TILE_ID; # minimum non-fixed tile id 109# $self->{expire_count} = DC::DB::FIRST_TILE_ID; # minimum non-fixed tile id
100# $self->{expire_w} = EV::timer 1, 1, sub { 110# $self->{expire_w} = AE::timer 1, 1, sub {
101# my $count = (int @{ $self->{texture} } / MIN_TEXTURE_UNUSED) || 1; 111# my $count = (int @{ $self->{texture} } / MIN_TEXTURE_UNUSED) || 1;
102# 112#
103# for ($self->{map}->expire_textures ($self->{expire_count}, $count)) { 113# for ($self->{map}->expire_textures ($self->{expire_count}, $count)) {
104# warn DC::SvREFCNT $self->{texture}[$_]; 114# warn DC::SvREFCNT $self->{texture}[$_];
105# $self->{texture}[$_]->unload; 115# $self->{texture}[$_]->unload;
117 $self->{mapcache} = "mapcache_$self->{host}_$self->{port}"; 127 $self->{mapcache} = "mapcache_$self->{host}_$self->{port}";
118 128
119 $self 129 $self
120} 130}
121 131
132 #$self->send_exti_req (nickmon => 1, sub { use Data::Dump; ddx \@_ });#d#
133#sub ext_nicklist { shift; use Data::Dump; ddx \@_; } #d#
134
122sub update_fx_want { 135sub update_fx_want {
123 my ($self) = @_; 136 my ($self) = @_;
124 137
125 $self->send_exti_msg (fx_want => { 138 $self->send_exti_msg (fx_want => {
126 3 => !!$::CFG->{bgm_enable}, # FT_MUSIC 139 3 => !!$::CFG->{bgm_enable}, # FT_MUSIC
130} 143}
131 144
132sub ext_capabilities { 145sub ext_capabilities {
133 my ($self, %cap) = @_; 146 my ($self, %cap) = @_;
134 147
135 $self->update_fx_want;
136
137 $self->send_exti_req (resource => "exp_table", sub {
138 my ($exp_table) = @_;
139
140 $self->register_face_handler ($exp_table, sub {
141 my ($face) = @_;
142
143 $self->{exp_table} = $self->{json_coder}->decode (delete $face->{data});
144 $_->() for values %{ $self->{on_exp_update} || {} };
145 });
146
147 ()
148 });
149
150 if (my $ts = $cap{tileset}) { 148 if (my $ts = $cap{tileset}) {
151 if (my ($default) = grep $_->[2] & 1, @$ts) { 149 if (my ($default) = grep $_->[2] & 1, @$ts) {
152 $self->{tileset} = $default; 150 $self->{tileset} = $default;
153 $self->{tilesize} = $default->[3]; 151 $self->{tilesize} = $default->[3];
154 $self->setup_req (tileset => $default->[0]); 152 $self->setup_req (tileset => $default->[0]);
162} 160}
163 161
164sub ext_ambient_music { 162sub ext_ambient_music {
165 my ($self, $songs) = @_; 163 my ($self, $songs) = @_;
166 &::audio_music_set_ambient ($songs); 164 &::audio_music_set_ambient ($songs);
165}
166
167sub ext_command_list {
168 my ($self, @faces) = @_;
169
170 my $handler = $self->{command_facehandler} = {};
171 my $commands = $::COMPLETER->{command_list} = {};
172
173 for my $idx (@faces) {
174 $handler->{$idx} = $self->register_face_handler ($idx, sub {
175 my ($face) = @_;
176
177 $commands->{$idx} =
178 $face->{cache} ||= $self->{json_coder}->decode ($face->{data});
179 });
180 }
167} 181}
168 182
169############################################################################# 183#############################################################################
170 184
171sub widget_associate { 185sub widget_associate {
454 468
455 if (my @diffs = 469 if (my @diffs =
456 ( 470 (
457 ($stats->{+CS_STAT_EXP64} > $prev->{+CS_STAT_EXP64} ? ($stats->{+CS_STAT_EXP64} - $prev->{+CS_STAT_EXP64}) . " experience gained" : ()), 471 ($stats->{+CS_STAT_EXP64} > $prev->{+CS_STAT_EXP64} ? ($stats->{+CS_STAT_EXP64} - $prev->{+CS_STAT_EXP64}) . " experience gained" : ()),
458 map { 472 map {
459 $stats->{$_} && $prev->{$_} 473 $stats->{$_} && $prev->{$_}
460 && $stats->{$_}[1] > $prev->{$_}[1] ? "($self->{skill_info}{$_}+" . ($stats->{$_}[1] - $prev->{$_}[1]) . ")" : () 474 && $stats->{$_}[1] > $prev->{$_}[1] ? "($self->{skill_info}{$_}+" . ($stats->{$_}[1] - $prev->{$_}[1]) . ")" : ()
461 } sort { $a <=> $b } keys %{$self->{skill_info}} 475 } sort { $a <=> $b } keys %{$self->{skill_info}}
462 ) 476 )
463 ) { 477 ) {
464 my $msg = join " ", @diffs; 478 my $msg = join " ", @diffs;
612 # progress 626 # progress
613 (new DC::UI::ExperienceProgress), 627 (new DC::UI::ExperienceProgress),
614 628
615 # label 629 # label
616 (new DC::UI::Label text => $name, on_button_down => $spell_cb, align => 0, 630 (new DC::UI::Label text => $name, on_button_down => $spell_cb, align => 0,
617 can_events => 1, can_hover => 1, tooltip => (DC::Pod::section_label skill_description => $name) . $TOOLTIP_ALL), 631 can_events => 1, can_hover => 1, tooltip => "#(skill/$name)$TOOLTIP_ALL"),
618 ]; 632 ];
619 633
620 push @add, 634 push @add,
621 $x * 4 + 0, $y, $sw->[0], 635 $x * 4 + 0, $y, $sw->[0],
622 $x * 4 + 1, $y, $sw->[1], 636 $x * 4 + 1, $y, $sw->[1],
669} 683}
670 684
671sub feed_map1a { 685sub feed_map1a {
672 my ($self, $data) = @_; 686 my ($self, $data) = @_;
673 687
674 my $missing = $self->{map}->map1a_update ($data, $self->{setup}{extmap}); 688 my $missing = $self->{map}->map1a_update ($data);
675 my $delay; 689 my $delay;
676 690
677 for my $tile (@$missing) { 691 for my $tile (@$missing) {
678 next if $self->{delay}{$tile}; 692 next if $self->{delay}{$tile};
679 693
1042 my ($self, $flags, $prompt) = @_; 1056 my ($self, $flags, $prompt) = @_;
1043 1057
1044 $prompt = $LAST_QUERY unless length $prompt; 1058 $prompt = $LAST_QUERY unless length $prompt;
1045 $LAST_QUERY = $prompt; 1059 $LAST_QUERY = $prompt;
1046 1060
1047 $self->{query}-> ($self, $flags, $prompt); 1061 $self->{query}->($self, $flags, $prompt);
1048}
1049
1050sub sanitise_xml($) {
1051 local $_ = shift;
1052
1053 # we now weed out all tags we do not support
1054 s{ <(?! /?i> | /?u> | /?b> | /?big | /?small | /?s | /?tt | fg\ | /fg>)
1055 }{
1056 "&lt;"
1057 }gex;
1058
1059 # now all entities
1060 s/&(?!amp;|lt;|gt;|apos;|quot;|#[0-9]+;|#x[0-9a-fA-F]+;)/&amp;/g;
1061
1062 # handle some elements
1063 s/<fg name='([^']*)'>(.*?)<\/fg>/<span foreground='$1'>$2<\/span>/gs;
1064 s/<fg name="([^"]*)">(.*?)<\/fg>/<span foreground="$1">$2<\/span>/gs;
1065
1066 s/\s+$//;
1067
1068 $_
1069} 1062}
1070 1063
1071our %NAME_TO_COLOR = ( 1064our %NAME_TO_COLOR = (
1072 black => 0, 1065 black => 0,
1073 white => 1, 1066 white => 1,
1084 tan => 12, 1077 tan => 12,
1085); 1078);
1086 1079
1087our @CF_COLOR = ( 1080our @CF_COLOR = (
1088 [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00], 1081 [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00],
1089 [1.00, 1.00, 1.00], 1082 [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00],
1090 [0.50, 0.50, 1.00], #[0.00, 0.00, 0.55] 1083 [0.50, 0.50, 1.00], #[0.00, 0.00, 0.55],
1091 [1.00, 0.00, 0.00], 1084 [1.00, 0.00, 0.00],
1092 [1.00, 0.54, 0.00], 1085 [1.00, 0.54, 0.00],
1093 [0.11, 0.56, 1.00], 1086 [0.11, 0.56, 1.00],
1094 [0.93, 0.46, 0.00], 1087 [0.93, 0.46, 0.00],
1095 [0.18, 0.54, 0.34], 1088 [0.18, 0.54, 0.34],
1101); 1094);
1102 1095
1103sub msg { 1096sub msg {
1104 my ($self, $color, $type, $text, @extra) = @_; 1097 my ($self, $color, $type, $text, @extra) = @_;
1105 1098
1106 $text = sanitise_xml $text; 1099 $text = DC::sanitise_cfxml $text;
1107 1100
1108 if (my $cb = $self->{cb_msg}{$type}) { 1101 if (my $cb = $self->{cb_msg}{$type}) {
1109 $_->($self, $color, $type, $text, @extra) for values %$cb; 1102 $_->($self, $color, $type, $text, @extra) for values %$cb;
1110 } elsif ($type =~ /^(?:chargen-race-title|chargen-race-description)$/) { 1103 } elsif ($type =~ /^(?:chargen-race-title|chargen-race-description)$/) {
1111 $type =~ s/-/_/g; 1104 $type =~ s/-/_/g;
1114 $self->logprint ("msg: ", $text); 1107 $self->logprint ("msg: ", $text);
1115 return if $color < 0; # negative color == ignore if not understood 1108 return if $color < 0; # negative color == ignore if not understood
1116 1109
1117 my $fg = $CF_COLOR[$color & NDI_COLOR_MASK] || [1, 0, 0]; 1110 my $fg = $CF_COLOR[$color & NDI_COLOR_MASK] || [1, 0, 0];
1118 1111
1119 ## try to create single paragraphs of multiple lines sent by the server
1120 # no longer neecssary with TRT servers
1121 #$text =~ s/(?<=\S)\n(?=\w)/ /g;
1122
1123 ::message ({ 1112 ::message ({
1124 fg => $fg, 1113 fg => $fg,
1125 markup => $text, 1114 markup => $text,
1126 type => $type, 1115 type => $type,
1127 extra => [@extra], 1116 extra => [@extra],
1144} 1133}
1145 1134
1146sub spell_add { 1135sub spell_add {
1147 my ($self, $spell) = @_; 1136 my ($self, $spell) = @_;
1148 1137
1149 # try to create single paragraphs out of the multiple lines sent by the server
1150 $spell->{message} =~ s/(?<=\S)\n(?=\w)/ /g;
1151 $spell->{message} =~ s/\n+$//;
1152 $spell->{message} ||= "Server did not provide a description for this spell.";
1153
1154 $::SPELL_LIST->add_spell ($spell); 1138 $::SPELL_LIST->add_spell ($spell);
1155 1139 delete $::COMPLETER->{command_list}{spells};
1156 $self->{map_widget}->add_command ("invoke $spell->{name}", DC::asxml $spell->{message});
1157 $self->{map_widget}->add_command ("cast $spell->{name}", DC::asxml $spell->{message});
1158} 1140}
1159 1141
1160sub spell_delete { 1142sub spell_delete {
1161 my ($self, $spell) = @_; 1143 my ($self, $spell) = @_;
1162 1144
1163 $::SPELL_LIST->remove_spell ($spell); 1145 $::SPELL_LIST->remove_spell ($spell);
1146 delete $::COMPLETER->{command_list}{spells};
1164} 1147}
1165 1148
1166sub setup { 1149sub setup {
1167 my ($self, $setup) = @_; 1150 my ($self, $setup) = @_;
1168 1151
1169 $self->{map_widget}->set_tilesize ($self->{tilesize}); 1152 $self->{map_widget}->set_tilesize ($self->{tilesize});
1170 $::MAP->resize ($self->{mapw}, $self->{maph}); 1153 $::MAP->resize ($self->{mapw}, $self->{maph});
1171} 1154}
1172 1155
1173sub addme_success {
1174 my ($self) = @_;
1175
1176 my %skill_help;
1177
1178 for my $node (DC::Pod::find skill_description => "*") {
1179 my (undef, @par) = DC::Pod::section_of $node;
1180 $skill_help{$node->[DC::Pod::N_KW][0]} = DC::Pod::as_label @par;
1181 };
1182
1183 for my $skill (values %{$self->{skill_info}}) {
1184 $self->{map_widget}->add_command ("ready_skill $skill",
1185 (DC::asxml "Ready the skill '$skill'\n\n")
1186 . $skill_help{$skill});
1187 $self->{map_widget}->add_command ("use_skill $skill",
1188 (DC::asxml "Immediately use the skill '$skill'\n\n")
1189 . $skill_help{$skill});
1190 }
1191}
1192
1193sub eof { 1156sub eof {
1194 my ($self) = @_; 1157 my ($self) = @_;
1195 1158
1196 $self->{map_widget}->clr_commands; 1159 $::COMPLETER->reset;
1197 1160
1198 ::stop_game (); 1161 ::stop_game ();
1199} 1162}
1200 1163
1201sub update_floorbox { 1164sub update_floorbox {
1347sub update_server_info { 1310sub update_server_info {
1348 my ($self) = @_; 1311 my ($self) = @_;
1349 1312
1350 my @yesno = ("<span foreground='red'>no</span>", "<span foreground='green'>yes</span>"); 1313 my @yesno = ("<span foreground='red'>no</span>", "<span foreground='green'>yes</span>");
1351 1314
1315 my $version = JSON::XS->new->encode ($self->{s_version});
1316
1352 $::SERVER_INFO->set_markup ( 1317 $::SERVER_INFO->set_markup (
1353 "server <tt>$self->{host}:$self->{port}</tt>\n" 1318 "server <tt>$self->{host}:$self->{port}</tt>\n"
1354 . "protocol version <tt>$self->{version}</tt>\n" 1319 . "protocol version <tt>$version</tt>\n"
1355 . "minimap support $yesno[$self->{setup}{mapinfocmd} > 0]\n"
1356 . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n"
1357 . "examine command support $yesno[$self->{setup}{excmd} > 0]\n"
1358 . "editing support $yesno[!!$self->{editor_support}]\n" 1320 . "editing support $yesno[!!$self->{editor_support}]\n"
1359 . "map attributes $yesno[$self->{setup}{extmap} > 0]\n"
1360 . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n"
1361 . "client support $yesno[$self->{cfplus_ext} > 0]" 1321 . "client support $yesno[$self->{cfplus_ext} > 0]"
1362 . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" 1322 . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n"
1363 . "map size $self->{mapw}×$self->{maph}\n" 1323 . "map size $self->{mapw}×$self->{maph}\n"
1364 ); 1324 );
1365 1325
1388 1348
1389 $self->update_server_info; 1349 $self->update_server_info;
1390 1350
1391 $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; 1351 $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0;
1392 $self->send_pickup ($::CFG->{pickup}); 1352 $self->send_pickup ($::CFG->{pickup});
1393
1394 $self->send_exti_msg (clientlog => sprintf "OpenGL Info: %s [%s]",
1395 DC::OpenGL::gl_vendor, DC::OpenGL::gl_version);#d#
1396} 1353}
1397 1354
1398sub lookat { 1355sub lookat {
1399 my ($self, $x, $y) = @_; 1356 my ($self, $x, $y) = @_;
1400 1357
1402 $self->send_ext_req (lookat => $x, $y, sub { 1359 $self->send_ext_req (lookat => $x, $y, sub {
1403 my (%msg) = @_; 1360 my (%msg) = @_;
1404 1361
1405 if (exists $msg{npc_dialog}) { 1362 if (exists $msg{npc_dialog}) {
1406 # start npc chat dialog 1363 # start npc chat dialog
1407 $self->{npc_dialog} = new DC::NPCDialog:: 1364 $self->{w}{npc_dialog} = new DC::NPCDialog::
1408 token => $msg{npc_dialog}, 1365 token => $msg{npc_dialog},
1409 title => "$msg{npc_dialog}[0] (NPC)", 1366 title => "$msg{npc_dialog}[0] (NPC)",
1410 conn => $self, 1367 conn => $self,
1411 ; 1368 ;
1412 } 1369 }
1417} 1374}
1418 1375
1419sub destroy { 1376sub destroy {
1420 my ($self) = @_; 1377 my ($self) = @_;
1421 1378
1422 (delete $self->{npc_dialog})->destroy 1379 $_->destroy
1423 if $self->{npc_dialog}; 1380 for values %{ $self->{w} };
1424 1381
1425 $self->SUPER::destroy; 1382 $self->SUPER::destroy;
1426 1383
1427 %$self = (); 1384 %$self = ();
1428} 1385}
1528 1485
1529 $self->{kw}{$_} = 1 for @{$info{add_topics} || []}; 1486 $self->{kw}{$_} = 1 for @{$info{add_topics} || []};
1530 $self->{kw}{$_} = 0 for @{$info{del_topics} || []}; 1487 $self->{kw}{$_} = 0 for @{$info{del_topics} || []};
1531 1488
1532 if (exists $info{msg}) { 1489 if (exists $info{msg}) {
1533 my $text = "\n" . DC::Protocol::sanitise_xml $info{msg}; 1490 my $text = "\n" . DC::sanitise_cfxml $info{msg};
1534 my $match = join "|", map "\\b\Q$_\E\\b", sort { (length $b) <=> (length $a) } keys %{ $self->{kw} }; 1491 my $match = join "|", map "\\b\Q$_\E\\b", sort { (length $b) <=> (length $a) } keys %{ $self->{kw} };
1535 my @link; 1492 my @link;
1536 $text =~ s{ 1493 $text =~ s{
1537 ($match) 1494 ($match)
1538 }{ 1495 }{
1582 1539
1583 #Carp::cluck "debug\n";#d# #todo# enable: destroy gets called twice because scalar keys {} is 1 1540 #Carp::cluck "debug\n";#d# #todo# enable: destroy gets called twice because scalar keys {} is 1
1584 1541
1585 if ($self->{conn}) { 1542 if ($self->{conn}) {
1586 $self->{conn}->send_ext_msg (npc_dialog_end => $self->{id}) if $self->{id}; 1543 $self->{conn}->send_ext_msg (npc_dialog_end => $self->{id}) if $self->{id};
1587 delete $self->{conn}{npc_dialog}; 1544 delete $self->{conn}{w}{npc_dialog};
1588 $self->{conn}->disconnect_ext ($self->{id}); 1545 $self->{conn}->disconnect_ext ($self->{id});
1589 } 1546 }
1590 1547
1591 $self->SUPER::destroy; 1548 $self->SUPER::destroy;
1592} 1549}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines